diff --git a/.travis.yml b/.travis.yml index a230e5bbea0a..16e740818d68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,6 +105,17 @@ jobs: go: $GO_VERSION stage: test + # Functionbeat + - os: linux + env: TARGETS="-C x-pack/functionbeat testsuite" + go: $GO_VERSION + stage: test + + - os: osx + env: TARGETS="TEST_ENVIRONMENT=0 -C x-pack/functionbeat testsuite" + go: $GO_VERSION + stage: test + # Generators - os: linux env: TARGETS="-C generator/metricbeat test" diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ebbd068321a1..2b31b47d2272 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -27,6 +27,8 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff] *Winlogbeat* +*Functionbeat* + ==== Bugfixes *Affecting all Beats* @@ -95,6 +97,7 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff] *Winlogbeat* +*Functionbeat* ==== Added @@ -167,6 +170,10 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff] - Add automatic config file reloading. {pull}8023[8023] +*Functionbeat* + +- Initial version of Functionbeat. {pull}8678[8678] + ==== Deprecated *Affecting all Beats* @@ -188,6 +195,8 @@ https://github.com/elastic/beats/compare/v6.4.0...6.x[Check the HEAD diff] *Winlogbeat* +*Functionbeat* + ==== Known Issue diff --git a/Makefile b/Makefile index 5aa03bb01991..2783cbda9f75 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BUILD_DIR=$(CURDIR)/build COVERAGE_DIR=$(BUILD_DIR)/coverage -BEATS?=auditbeat filebeat heartbeat journalbeat metricbeat packetbeat winlogbeat +BEATS?=auditbeat filebeat heartbeat journalbeat metricbeat packetbeat winlogbeat x-pack/functionbeat PROJECTS=libbeat $(BEATS) PROJECTS_ENV=libbeat filebeat metricbeat PYTHON_ENV?=$(BUILD_DIR)/python-env @@ -11,6 +11,7 @@ GOLINT_REPO=github.com/golang/lint/golint REVIEWDOG=reviewdog REVIEWDOG_OPTIONS?=-diff "git diff master" REVIEWDOG_REPO=github.com/haya14busa/reviewdog/cmd/reviewdog +XPACK_SUFFIX=x-pack/ # Runs complete testsuites (unit, system, integration) for all beats with coverage and race detection. # Also it builds the docs and the generators @@ -152,7 +153,7 @@ release: beats-dashboards @$(foreach var,$(BEATS),$(MAKE) -C $(var) release || exit 1;) @$(foreach var,$(BEATS), \ test -d $(var)/build/distributions && test -n "$$(ls $(var)/build/distributions)" || exit 0; \ - mkdir -p build/distributions/$(var) && mv -f $(var)/build/distributions/* build/distributions/$(var)/ || exit 1;) + mkdir -p build/distributions/$(subst $(XPACK_SUFFIX),'',$(var)) && mv -f $(var)/build/distributions/* build/distributions/$(subst $(XPACK_SUFFIX),'',$(var))/ || exit 1;) # Builds a snapshot release. The Go version defined in .go-version will be # installed and used for the build. diff --git a/NOTICE.txt b/NOTICE.txt index d3dde837cd9f..95c35757a368 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -115,6 +115,66 @@ 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. +-------------------------------------------------------------------- +Dependency: github.com/aws/aws-lambda-go +Version: =v1.6.0 +Revision: 2d482ef09017ae953b1e8d5a6ddac5b696663a3c +License type (autodetected): Apache-2.0 +./vendor/github.com/aws/aws-lambda-go/LICENSE: +-------------------------------------------------------------------- +Apache License 2.0 + + +-------------------------------------------------------------------- +Dependency: github.com/aws/aws-lambda-go +Version: =v1.6.0 +Revision: 2d482ef09017ae953b1e8d5a6ddac5b696663a3c +License type (autodetected): MIT +./vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE: +-------------------------------------------------------------------- +MIT No Attribution + +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. + +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. + + +-------------------------------------------------------------------- +Dependency: github.com/aws/aws-sdk-go-v2 +Version: v2.0.0-preview.5 +Revision: d52522b5f4b95591ff6528d7c54923951aadf099 +License type (autodetected): Apache-2.0 +./vendor/github.com/aws/aws-sdk-go-v2/LICENSE.txt: +-------------------------------------------------------------------- +Apache License 2.0 + +-------NOTICE.txt----- +AWS SDK for Go +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2014-2015 Stripe, Inc. + +-------------------------------------------------------------------- +Dependency: github.com/awslabs/goformation +Version: 1.2.2 +Revision: d42502ef32a8892bf380256e2f57c6f69190d802 +License type (autodetected): Apache-2.0 +./vendor/github.com/awslabs/goformation/LICENSE: +-------------------------------------------------------------------- +Apache License 2.0 + +-------NOTICE----- +GoFormation +Copyright 2011-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + -------------------------------------------------------------------- Dependency: github.com/bsm/sarama-cluster Revision: 7e67d87a6b3f83fe08c096fd084691bd9dca112f @@ -723,6 +783,14 @@ 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. +-------------------------------------------------------------------- +Dependency: github.com/go-ini/ini +License type (autodetected): Apache-2.0 +./vendor/github.com/go-ini/ini/LICENSE: +-------------------------------------------------------------------- +Apache License 2.0 + + -------------------------------------------------------------------- Dependency: github.com/go-ole/go-ole Revision: de8695c8edbf8236f30d6e1376e20b198a028d42 @@ -1377,6 +1445,41 @@ License type (autodetected): Apache-2.0 Apache License 2.0 +-------------------------------------------------------------------- +Dependency: github.com/imdario/mergo +Revision: 9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4 +License type (autodetected): BSD-3-Clause +./vendor/github.com/imdario/mergo/LICENSE: +-------------------------------------------------------------------- +Copyright (c) 2013 Dario Castañé. All rights reserved. +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. + -------------------------------------------------------------------- Dependency: github.com/inconshreveable/mousetrap Revision: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 @@ -1422,6 +1525,16 @@ 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. +-------------------------------------------------------------------- +Dependency: github.com/jmespath/go-jmespath +Version: 0.2.2 +Revision: 3433f3ea46d9f8019119e7dd41274e112a2359a9 +License type (autodetected): Apache-2.0 +./vendor/github.com/jmespath/go-jmespath/LICENSE: +-------------------------------------------------------------------- +Apache License 2.0 + + -------------------------------------------------------------------- Dependency: github.com/joeshaw/multierror Revision: 69b34d4ec901851247ae7e77d33909caf9df99ed @@ -2138,6 +2251,112 @@ 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. +-------------------------------------------------------------------- +Dependency: github.com/sanathkr/go-yaml +Version: v2 +Revision: ed9d249f429b3f5a69f80a7abef6bfce81fef894 +License type (autodetected): Apache-2.0 +./vendor/github.com/sanathkr/go-yaml/LICENSE: +-------------------------------------------------------------------- +Apache License 2.0 + + +-------------------------------------------------------------------- +Dependency: github.com/sanathkr/go-yaml +Version: v2 +Revision: ed9d249f429b3f5a69f80a7abef6bfce81fef894 +License type (autodetected): MIT +./vendor/github.com/sanathkr/go-yaml/LICENSE.libyaml: +-------------------------------------------------------------------- +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original copyright and license: + + apic.go + emitterc.go + parserc.go + readerc.go + scannerc.go + writerc.go + yamlh.go + yamlprivateh.go + +Copyright (c) 2006 Kirill Simonov + +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. + +-------------------------------------------------------------------- +Dependency: github.com/sanathkr/yaml +Revision: 0056894fa522748ca336761ffeeeb6bbae654d07 +License type (autodetected): MIT +./vendor/github.com/sanathkr/yaml/LICENSE: +-------------------------------------------------------------------- +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. + -------------------------------------------------------------------- Dependency: github.com/shirou/gopsutil Version: v2.18.06 diff --git a/dev-tools/generate_notice.py b/dev-tools/generate_notice.py index b8a24feb1911..393adc9402c7 100644 --- a/dev-tools/generate_notice.py +++ b/dev-tools/generate_notice.py @@ -7,6 +7,7 @@ import json import csv import re +import pdb import copy @@ -87,6 +88,8 @@ def gather_dependencies(vendor_dirs, overrides=None): # Allow to skip files that could match the `LICENSE` pattern but does not have any license information. SKIP_FILES = [ + # AWS lambda go defines that some part of the code is APLv2 and other on a MIT Modified license. + "./vendor/github.com/aws/aws-lambda-go/LICENSE-SUMMARY" ] diff --git a/dev-tools/mage/pkgspecs.go b/dev-tools/mage/pkgspecs.go index 20767d9a4297..1ddce32dfffe 100644 --- a/dev-tools/mage/pkgspecs.go +++ b/dev-tools/mage/pkgspecs.go @@ -35,15 +35,7 @@ var Packages []OSPackageArgs // UseCommunityBeatPackaging configures the package target to build packages for // a community Beat. func UseCommunityBeatPackaging() { - beatsDir, err := ElasticBeatsDir() - if err != nil { - panic(err) - } - - err = LoadNamedSpec("community_beat", filepath.Join(beatsDir, packageSpecFile)) - if err != nil { - panic(err) - } + MustUsePackaging("community_beat", packageSpecFile) } // UseElasticBeatPackaging configures the package target to build packages for @@ -51,15 +43,7 @@ func UseCommunityBeatPackaging() { // that is purely OSS under Apache 2.0 and one that is licensed under the // Elastic License and may contain additional X-Pack features. func UseElasticBeatPackaging() { - beatsDir, err := ElasticBeatsDir() - if err != nil { - panic(err) - } - - err = LoadNamedSpec("elastic_beat", filepath.Join(beatsDir, packageSpecFile)) - if err != nil { - panic(err) - } + MustUsePackaging("elastic_beat", packageSpecFile) } // UseElasticBeatWithoutXPackPackaging configures the package target to build packages for @@ -71,12 +55,20 @@ func UseElasticBeatPackaging() { // a temporary packaging target for projects that depends on beat but do have concrete x-pack // binaries. func UseElasticBeatWithoutXPackPackaging() { + MustUsePackaging("elastic_beat_without_xpack", packageSpecFile) +} + +// MustUsePackaging will load a named spec from a named file, if any errors occurs when loading +// the specs it will panic. +// +// NOTE: we assume that specFile is relative to the beatsDir. +func MustUsePackaging(specName, specFile string) { beatsDir, err := ElasticBeatsDir() if err != nil { panic(err) } - err = LoadNamedSpec("elastic_beat_without_xpack", filepath.Join(beatsDir, packageSpecFile)) + err = LoadNamedSpec(specName, filepath.Join(beatsDir, specFile)) if err != nil { panic(err) } diff --git a/libbeat/common/cli/cli.go b/libbeat/common/cli/cli.go index 54e0ac8704ad..6785ea3de656 100644 --- a/libbeat/common/cli/cli.go +++ b/libbeat/common/cli/cli.go @@ -45,3 +45,14 @@ func RunWith( } } } + +// GetEnvOr return the value of the environment variable if the value is set, if its not set it will +// return the default value. +// +// Note: if the value is set but it is an empty string we will return the empty string. +func GetEnvOr(name, def string) string { + if env, ok := os.LookupEnv(name); ok { + return env + } + return def +} diff --git a/libbeat/common/string.go b/libbeat/common/string.go index d9cd6215a26f..e2c4017a876f 100644 --- a/libbeat/common/string.go +++ b/libbeat/common/string.go @@ -17,6 +17,8 @@ package common +import "strings" + // NetString store the byte length of the data that follows, making it easier // to unambiguously pass text and byte data between programs that could be // sensitive to values that could be interpreted as delimiters or terminators @@ -28,3 +30,25 @@ type NetString []byte func (n NetString) MarshalText() ([]byte, error) { return n, nil } + +// RemoveChars takes a string candidate and a string of chars to remove from the candidate. +func RemoveChars(s string, chars string) string { + buf := &strings.Builder{} + for len(s) > 0 { + idx := strings.IndexAny(s, chars) + if idx < 0 { + if buf.Len() > 0 { + buf.WriteString(s) + } + break + } + + buf.WriteString(s[:idx]) + s = s[idx+1:] + } + + if buf.Len() == 0 { + return s + } + return buf.String() +} diff --git a/libbeat/common/string_test.go b/libbeat/common/string_test.go new file mode 100644 index 000000000000..2ad2ed5a4b5f --- /dev/null +++ b/libbeat/common/string_test.go @@ -0,0 +1,64 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package common + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestRemoveChar(t *testing.T) { + tests := []struct { + title string + candidate string + chars string + expected string + }{ + { + title: "when we have one char to replace", + candidate: "hello foobar", + chars: "a", + expected: "hello foobr", + }, + { + title: "when we have multiple chars to replace", + candidate: "hello foobar", + chars: "all", + expected: "heo foobr", + }, + { + title: "when we have no chars to replace", + candidate: "hello foobar", + chars: "x", + expected: "hello foobar", + }, + { + title: "when we have an empty string", + candidate: "", + chars: "x", + expected: "", + }, + } + + for _, test := range tests { + t.Run(test.title, func(t *testing.T) { + assert.Equal(t, test.expected, RemoveChars(test.candidate, test.chars)) + }) + } +} diff --git a/libbeat/feature/feature.go b/libbeat/feature/feature.go index 0180e37cb0d7..b051f07c8ca1 100644 --- a/libbeat/feature/feature.go +++ b/libbeat/feature/feature.go @@ -23,7 +23,7 @@ import ( // Registry is the global plugin registry, this variable is meant to be temporary to move all the // internal factory to receive a context that include the current beat registry. -var Registry = newRegistry() +var registry = NewRegistry() // Featurable implements the description of a feature. type Featurable interface { @@ -96,10 +96,15 @@ func New(namespace, name string, factory interface{}, description Describer) *Fe } } +// GlobalRegistry return the configured global registry. +func GlobalRegistry() *Registry { + return registry +} + // RegisterBundle registers a bundle of features. func RegisterBundle(bundle *Bundle) error { for _, f := range bundle.Features() { - err := Registry.Register(f) + err := GlobalRegistry().Register(f) if err != nil { return err } @@ -119,7 +124,7 @@ func MustRegisterBundle(bundle *Bundle) { // implementation. func OverwriteBundle(bundle *Bundle) error { for _, f := range bundle.Features() { - err := Registry.Register(f) + err := GlobalRegistry().Register(f) if err != nil { return err } @@ -138,7 +143,7 @@ func MustOverwriteBundle(bundle *Bundle) { // Register register a new feature on the global registry. func Register(feature Featurable) error { - return Registry.Register(feature) + return GlobalRegistry().Register(feature) } // MustRegister register a new Feature on the global registry and panic on error. diff --git a/libbeat/feature/registry.go b/libbeat/feature/registry.go index 4d5751ece382..77d829ac994d 100644 --- a/libbeat/feature/registry.go +++ b/libbeat/feature/registry.go @@ -28,18 +28,18 @@ import ( type mapper map[string]map[string]Featurable -// Registry implements a global registry for any kind of feature in beats. +// Registry implements a global FeatureRegistry for any kind of feature in beats. // feature are grouped by namespace, a namespace is a kind of plugin like outputs, inputs, or queue. // The feature name must be unique. -type registry struct { +type Registry struct { sync.RWMutex namespaces mapper log *logp.Logger } // NewRegistry returns a new registry. -func newRegistry() *registry { - return ®istry{ +func NewRegistry() *Registry { + return &Registry{ namespaces: make(mapper), log: logp.NewLogger("registry"), } @@ -47,7 +47,7 @@ func newRegistry() *registry { // Register registers a new feature into a specific namespace, namespace are lazy created. // Feature name must be unique. -func (r *registry) Register(feature Featurable) error { +func (r *Registry) Register(feature Featurable) error { r.Lock() defer r.Unlock() @@ -97,7 +97,7 @@ func (r *registry) Register(feature Featurable) error { } // Unregister removes a feature from the registry. -func (r *registry) Unregister(namespace, name string) error { +func (r *Registry) Unregister(namespace, name string) error { r.Lock() defer r.Unlock() ns := normalize(namespace) @@ -117,7 +117,7 @@ func (r *registry) Unregister(namespace, name string) error { } // Lookup searches for a Feature by the namespace-name pair. -func (r *registry) Lookup(namespace, name string) (Featurable, error) { +func (r *Registry) Lookup(namespace, name string) (Featurable, error) { r.RLock() defer r.RUnlock() @@ -138,7 +138,7 @@ func (r *registry) Lookup(namespace, name string) (Featurable, error) { } // LookupAll returns all the features for a specific namespace. -func (r *registry) LookupAll(namespace string) ([]Featurable, error) { +func (r *Registry) LookupAll(namespace string) ([]Featurable, error) { r.RLock() defer r.RUnlock() @@ -160,7 +160,7 @@ func (r *registry) LookupAll(namespace string) ([]Featurable, error) { } // Overwrite allow to replace an existing feature with a new implementation. -func (r *registry) Overwrite(feature Featurable) error { +func (r *Registry) Overwrite(feature Featurable) error { _, err := r.Lookup(feature.Namespace(), feature.Name()) if err == nil { err := r.Unregister(feature.Namespace(), feature.Name()) @@ -173,7 +173,7 @@ func (r *registry) Overwrite(feature Featurable) error { } // Size returns the number of registered features in the registry. -func (r *registry) Size() int { +func (r *Registry) Size() int { r.RLock() defer r.RUnlock() diff --git a/libbeat/feature/registry_test.go b/libbeat/feature/registry_test.go index 4b733a0d9f05..03da4c471d6d 100644 --- a/libbeat/feature/registry_test.go +++ b/libbeat/feature/registry_test.go @@ -29,7 +29,7 @@ func TestRegister(t *testing.T) { f := func() {} t.Run("when the factory is nil", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() err := r.Register(New("outputs", "null", nil, defaultDetails)) if !assert.Error(t, err) { return @@ -37,7 +37,7 @@ func TestRegister(t *testing.T) { }) t.Run("namespace and feature doesn't exist", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() err := r.Register(New("outputs", "null", f, defaultDetails)) if !assert.NoError(t, err) { return @@ -47,7 +47,7 @@ func TestRegister(t *testing.T) { }) t.Run("namespace exists and feature doesn't exist", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "bar", f, defaultDetails)) err := r.Register(New("processor", "foo", f, defaultDetails)) if !assert.NoError(t, err) { @@ -58,7 +58,7 @@ func TestRegister(t *testing.T) { }) t.Run("namespace exists and feature exists and not the same factory", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", func() {}, defaultDetails)) err := r.Register(New("processor", "foo", f, defaultDetails)) if !assert.Error(t, err) { @@ -69,7 +69,7 @@ func TestRegister(t *testing.T) { t.Run("when the exact feature is already registered", func(t *testing.T) { feature := New("processor", "foo", f, defaultDetails) - r := newRegistry() + r := NewRegistry() r.Register(feature) err := r.Register(feature) if !assert.NoError(t, err) { @@ -82,7 +82,7 @@ func TestRegister(t *testing.T) { func TestFeature(t *testing.T) { f := func() {} - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) r.Register(New("HOLA", "fOO", f, defaultDetails)) @@ -112,7 +112,7 @@ func TestFeature(t *testing.T) { func TestLookup(t *testing.T) { f := func() {} - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) r.Register(New("processor", "foo2", f, defaultDetails)) r.Register(New("HELLO", "fOO", f, defaultDetails)) @@ -146,7 +146,7 @@ func TestUnregister(t *testing.T) { f := func() {} t.Run("when the namespace and the feature exists", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) assert.Equal(t, 1, r.Size()) err := r.Unregister("processor", "foo") @@ -157,7 +157,7 @@ func TestUnregister(t *testing.T) { }) t.Run("when the namespace exist and the feature doesn't", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) assert.Equal(t, 1, r.Size()) err := r.Unregister("processor", "bar") @@ -168,7 +168,7 @@ func TestUnregister(t *testing.T) { }) t.Run("when the namespace doesn't exists", func(t *testing.T) { - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) assert.Equal(t, 1, r.Size()) err := r.Unregister("outputs", "bar") @@ -182,7 +182,7 @@ func TestUnregister(t *testing.T) { func TestOverwrite(t *testing.T) { t.Run("when the feature doesn't exist", func(t *testing.T) { f := func() {} - r := newRegistry() + r := NewRegistry() assert.Equal(t, 0, r.Size()) r.Overwrite(New("processor", "foo", f, defaultDetails)) assert.Equal(t, 1, r.Size()) @@ -190,7 +190,7 @@ func TestOverwrite(t *testing.T) { t.Run("overwrite when the feature exists", func(t *testing.T) { f := func() {} - r := newRegistry() + r := NewRegistry() r.Register(New("processor", "foo", f, defaultDetails)) assert.Equal(t, 1, r.Size()) diff --git a/libbeat/management/management.go b/libbeat/management/management.go index b7ca617e469f..5725eea77157 100644 --- a/libbeat/management/management.go +++ b/libbeat/management/management.go @@ -59,7 +59,7 @@ func Register(name string, fn FactoryFunc, stability feature.Stability) { // Factory retrieves config manager constructor. If no one is registered // it will create a nil manager func Factory() FactoryFunc { - factories, err := feature.Registry.LookupAll(Namespace) + factories, err := feature.GlobalRegistry().LookupAll(Namespace) if err != nil { return nilFactory } diff --git a/libbeat/publisher/queue/queue_reg.go b/libbeat/publisher/queue/queue_reg.go index 0f860b233444..2703bcd75878 100644 --- a/libbeat/publisher/queue/queue_reg.go +++ b/libbeat/publisher/queue/queue_reg.go @@ -32,7 +32,7 @@ func RegisterType(name string, fn Factory) { // FindFactory retrieves a queue types constructor. Returns nil if queue type is unknown func FindFactory(name string) Factory { - f, err := feature.Registry.Lookup(Namespace, name) + f, err := feature.GlobalRegistry().Lookup(Namespace, name) if err != nil { return nil } diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index 7ad46eb29822..74f623fd32e4 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -82,6 +82,7 @@ VIRTUALENV_PARAMS?= INTEGRATION_TESTS?= FIND=. ${PYTHON_ENV}/bin/activate; find . -type f -not -path "*/vendor/*" -not -path "*/build/*" -not -path "*/.git/*" PERM_EXEC?=$(shell [ `uname -s` = "Darwin" ] && echo "+111" || echo "/a+x") +XPACK_ONLY?=false ifeq ($(DOCKER_CACHE),0) DOCKER_NOCACHE=--no-cache @@ -339,7 +340,7 @@ endif ifneq ($(shell [[ $(BEAT_NAME) == libbeat || $(BEAT_NAME) == metricbeat ]] && echo true ),true) mkdir -p include - go run ${ES_BEATS}/dev-tools/cmd/asset/asset.go -pkg include -in fields.yml -out include/fields.go $(BEAT_NAME) + go run ${ES_BEATS}/dev-tools/cmd/asset/asset.go -license $(LICENSE) -pkg include -in fields.yml -out include/fields.go $(BEAT_NAME) endif @# Update docs diff --git a/magefile.go b/magefile.go index 5c4ae837ffba..25dcf7f554e8 100644 --- a/magefile.go +++ b/magefile.go @@ -35,6 +35,7 @@ var ( "metricbeat", "packetbeat", "winlogbeat", + "x-pack/functionbeat", } ) @@ -69,5 +70,5 @@ func PackageBeatDashboards() error { // DumpVariables writes the template variables and values to stdout. func DumpVariables() error { - return mage.DumpVariables() + return mage.DumpVariables() } diff --git a/vendor/github.com/aws/aws-lambda-go/Gopkg.lock b/vendor/github.com/aws/aws-lambda-go/Gopkg.lock new file mode 100644 index 000000000000..a49283106fef --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/Gopkg.lock @@ -0,0 +1,33 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "346938d642f2ec3594ed81d874461961cd0faa76" + version = "v1.1.0" + +[[projects]] + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" + +[[projects]] + name = "github.com/stretchr/testify" + packages = ["assert"] + revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71" + version = "v1.2.1" + +[[projects]] + name = "gopkg.in/urfave/cli.v1" + packages = ["."] + revision = "cfb38830724cc34fedffe9a2a29fb54fa9169cd1" + version = "v1.20.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "21bf02839d69eb4ab638d20ad48614cf2e71753b2005ef5fa2b05cb9704ab5d2" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/aws/aws-lambda-go/Gopkg.toml b/vendor/github.com/aws/aws-lambda-go/Gopkg.toml new file mode 100644 index 000000000000..323002ca8a86 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/Gopkg.toml @@ -0,0 +1,21 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" diff --git a/vendor/github.com/aws/aws-lambda-go/LICENSE b/vendor/github.com/aws/aws-lambda-go/LICENSE new file mode 100644 index 000000000000..6b0b1270ff0c --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/LICENSE @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE b/vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE new file mode 100644 index 000000000000..11f98088c66f --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/LICENSE-LAMBDACODE @@ -0,0 +1,15 @@ +MIT No Attribution + +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. + +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/aws/aws-lambda-go/LICENSE-SUMMARY b/vendor/github.com/aws/aws-lambda-go/LICENSE-SUMMARY new file mode 100644 index 000000000000..cd56e29eac27 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/LICENSE-SUMMARY @@ -0,0 +1,7 @@ +Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +Lambda functions are made available under a modified MIT license. +See LICENSE-LAMBDACODE for details. + +The remainder of the project is made available under the terms of the +Apache License, version 2.0. See LICENSE for details. diff --git a/vendor/github.com/aws/aws-lambda-go/README.md b/vendor/github.com/aws/aws-lambda-go/README.md new file mode 100644 index 000000000000..9cc2eae4e685 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/README.md @@ -0,0 +1,85 @@ +# aws-lambda-go + +Libraries, samples and tools to help Go developers develop AWS Lambda functions. + +To learn more about writing AWS Lambda functions in Go, go to [the offical documentation](https://docs.aws.amazon.com/lambda/latest/dg/go-programming-model.html) + +[![GoDoc][1]][2] +[![GoCard][3]][4] +[![Build Status][5]][6] +[![codecov][7]][8] + +[1]: https://godoc.org/github.com/aws/aws-lambda-go?status.svg +[2]: https://godoc.org/github.com/aws/aws-lambda-go +[3]: https://goreportcard.com/badge/github.com/aws/aws-lambda-go +[4]: https://goreportcard.com/report/github.com/aws/aws-lambda-go +[5]: https://travis-ci.org/aws/aws-lambda-go.svg?branch=master +[6]: https://travis-ci.org/aws/aws-lambda-go +[7]: https://codecov.io/gh/aws/aws-lambda-go/branch/master/graph/badge.svg +[8]: https://codecov.io/gh/aws/aws-lambda-go + +# Getting Started + +``` Go +// main.go +package main + +import ( + "github.com/aws/aws-lambda-go/lambda" +) + +func hello() (string, error) { + return "Hello ƛ!", nil +} + +func main() { + // Make the handler available for Remote Procedure Call by AWS Lambda + lambda.Start(hello) +} +``` + +# Building your function + +Preparing a binary to deploy to AWS Lambda requires that it is compiled for Linux and placed into a .zip file. + +## For developers on Linux and macOS +``` shell +# Remember to build your handler executable for Linux! +GOOS=linux GOARCH=amd64 go build -o main main.go +zip main.zip main +``` + +## For developers on Windows + +Windows developers may have trouble producing a zip file that marks the binary as exectuable on Linux. To create a .zip that will work on AWS Lambda, the `build-lambda-zip` tool may be helpful. + +Get the tool +``` shell +go.exe get -u github.com/aws/aws-lambda-go/cmd/build-lambda-zip +``` + +Use the tool from your `GOPATH`. If you have a default installation of Go, the tool will be in `%USERPROFILE%\Go\bin`. + +in cmd.exe: +``` bat +set GOOS=linux +set GOARCH=amd64 +go build -o main main.go +%USERPROFILE%\Go\bin\build-lambda-zip.exe -o main.zip main +``` + +in Powershell: +``` posh +$env:GOOS = "linux" +$env:GOARCH = "amd64" +go build -o main main.go +~\Go\Bin\build-lambda-zip.exe -o main.zip main +``` +# Deploying your functions + +To deploy your function, refer to the offical documentation for [deploying using the AWS CLI, AWS Cloudformation, and AWS SAM](https://docs.aws.amazon.com/lambda/latest/dg/deploying-lambda-apps.html). + +# Event Integrations + +The [event models](https://github.com/aws/aws-lambda-go/tree/master/events) can be used to model AWS event sources. The offical documentation has [detailed walkthroughs](https://docs.aws.amazon.com/lambda/latest/dg/use-cases.html). + diff --git a/vendor/github.com/aws/aws-lambda-go/events/README.md b/vendor/github.com/aws/aws-lambda-go/events/README.md new file mode 100644 index 000000000000..7821a28b681e --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README.md @@ -0,0 +1,29 @@ +# Overview + +[![GoDoc](https://godoc.org/github.com/aws/aws-lambda-go/events?status.svg)](https://godoc.org/github.com/aws/aws-lambda-go/events) + +This package provides input types for Lambda functions that process AWS events. + +# Samples + +[API Gateway](README_ApiGatewayEvent.md) + +[API Gateway Custom Authorizer](README_ApiGatewayCustomAuthorizer.md) + +[CloudFormation Events](../cfn/README.md) + +[Code Commit Events](README_CodeCommit.md) + +[Cognito Events](README_Cognito.md) + +[Config Events](README_Config.md) + +[DynamoDB Events](README_DynamoDB.md) + +[Kinesis Events](README_Kinesis.md) + +[Kinesis Firehose Events](README_KinesisFirehose.md) + +[S3 Events](README_S3.md) + +[SNS Events](README_SNS.md) diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayCustomAuthorizer.md b/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayCustomAuthorizer.md new file mode 100644 index 000000000000..adb86078e46d --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayCustomAuthorizer.md @@ -0,0 +1,67 @@ +# Sample Function + +The following is a simple TOKEN authorizer example to demonstrate how to use an authorization +token to allow or deny a request. In this example, the caller named "user" is allowed to invoke +a request if the client-supplied token value is "allow". The caller is not allowed to invoke +the request if the token value is "deny". If the token value is "Unauthorized", the function +returns the "Unauthorized" error with an HTTP status code of 401. For any other token value, +the authorizer returns an "Invalid token" error. + +This example is based on the [JavaScript sample](https://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-token-lambda-function-create) from the API Gateway documentation + +```go +package main + +import ( + "context" + "errors" + "strings" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +// Help function to generate an IAM policy +func generatePolicy(principalId, effect, resource string) events.APIGatewayCustomAuthorizerResponse { + authResponse := events.APIGatewayCustomAuthorizerResponse{PrincipalID: principalId} + + if effect != "" && resource != "" { + authResponse.PolicyDocument = events.APIGatewayCustomAuthorizerPolicy{ + Version: "2012-10-17", + Statement: []events.IAMPolicyStatement{ + { + Action: []string{"execute-api:Invoke"}, + Effect: effect, + Resource: []string{resource}, + }, + }, + } + } + + // Optional output with custom properties of the String, Number or Boolean type. + authResponse.Context = map[string]interface{}{ + "stringKey": "stringval", + "numberKey": 123, + "booleanKey": true, + } + return authResponse +} + +func handleRequest(ctx context.Context, event events.APIGatewayCustomAuthorizerRequest) (events.APIGatewayCustomAuthorizerResponse, error) { + token := event.AuthorizationToken + switch strings.ToLower(token) { + case "allow": + return generatePolicy("user", "Allow", event.MethodArn), nil + case "deny": + return generatePolicy("user", "Deny", event.MethodArn), nil + case "unauthorized": + return events.APIGatewayCustomAuthorizerResponse{}, errors.New("Unauthorized") // Return a 401 Unauthorized response + default: + return events.APIGatewayCustomAuthorizerResponse{}, errors.New("Error: Invalid token") + } +} + +func main() { + lambda.Start(handleRequest) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayEvent.md b/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayEvent.md new file mode 100644 index 000000000000..65ceabce1ee0 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_ApiGatewayEvent.md @@ -0,0 +1,36 @@ +# Overview + +API Gateway events consist of a request that was routed to a Lambda function by API Gateway. When this happens, API Gateway expects the result of the function to be the response that API Gateway should respond with. + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon API Gateway event record data as an input, writes some of the record data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handleRequest(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { + fmt.Printf("Processing request data for request %s.\n", request.RequestContext.RequestID) + fmt.Printf("Body size = %d.\n", len(request.Body)) + + fmt.Println("Headers:") + for key, value := range request.Headers { + fmt.Printf(" %s: %s\n", key, value) + } + + return events.APIGatewayProxyResponse{Body: request.Body, StatusCode: 200}, nil +} + +func main() { + lambda.Start(handleRequest) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md b/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md new file mode 100644 index 000000000000..18a0ec457f81 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_AutoScaling.md @@ -0,0 +1,16 @@ +# Sample Function + +The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +import ( + "strings" + "github.com/aws/aws-lambda-go/events") + +func handler(ctx context.Context, autoScalingEvent events.AutoScalingEvent) { + fmt.Printf("Instance-Id available in event is %s \n",autoScalingEvent.Detail["EC2InstanceId"]) + } +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_CodeCommit.md b/vendor/github.com/aws/aws-lambda-go/events/README_CodeCommit.md new file mode 100644 index 000000000000..aea1d7032f1a --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_CodeCommit.md @@ -0,0 +1,17 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon CodeCommit event +records input and prints them to `os.Stdout`.) + +```go +import ( + "fmt" + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(evt events.CodeCommitEvent) { + for _, record := range evt.Records { + fmt.Println(record) + } +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md new file mode 100644 index 000000000000..a8ee5867c8d5 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito.md @@ -0,0 +1,32 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito Sync event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(cognitoEvent events.CognitoEvent) error { + for datasetName, datasetRecord := range cognitoEvent.DatasetRecords { + fmt.Printf("[%s -- %s] %s -> %s -> %s \n", + cognitoEvent.EventType, + datasetName, + datasetRecord.OldValue, + datasetRecord.Op, + datasetRecord.NewValue) + } + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md new file mode 100644 index 000000000000..347183744d28 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PostConfirmation.md @@ -0,0 +1,25 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools post-confirmation event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPostConfirmation) (events.CognitoEventUserPoolsPostConfirmation, error) { + fmt.Printf("PostConfirmation for user: %s\n", event.UserName) + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md new file mode 100644 index 000000000000..9e782fcca4f6 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Cognito_UserPools_PreSignup.md @@ -0,0 +1,26 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Cognito User Pools pre-signup event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +Please see instructions for setting up the Cognito triggers at https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html . + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-lambda-go/lambda" + "github.com/aws/aws-lambda-go/events" +) + +func handler(event events.CognitoEventUserPoolsPreSignup) (events.CognitoEventUserPoolsPreSignup, error) { + fmt.Printf("PreSignup of user: %s\n", event.UserName) + event.Response.AutoConfirmUser = true + return event, nil +} + +func main() { + lambda.Start(handler) +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Config.md b/vendor/github.com/aws/aws-lambda-go/events/README_Config.md new file mode 100644 index 000000000000..e2d217a928cd --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Config.md @@ -0,0 +1,18 @@ +# Sample Function + +The following is a sample Lambda function that receives Amazon Config event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +import ( + "strings" + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(ctx context.Context, configEvent events.ConfigEvent) { + fmt.Printf("AWS Config rule: %s\n", configEvent.ConfigRuleName) + fmt.Printf("Invoking event JSON: %s\n", configEvent.InvokingEvent) + fmt.Printf("Event version: %s\n", configEvent.Version) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md b/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md new file mode 100644 index 000000000000..e33b144a668c --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Connect.md @@ -0,0 +1,35 @@ +# Sample Function + +The following is a sample Lambda function that receives an Amazon Connect event as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func main() { + lambda.Start(handler) +} + +func handler(ctx context.Context, connectEvent events.ConnectEvent) (events.ConnectResponse, error) { + fmt.Printf("Processing Connect event with ContactID %s.\n", connectEvent.Details.ContactData.ContactID) + + fmt.Printf("Invoked with %d parameters\n", len(connectEvent.Details.Parameters)) + for k, v := range connectEvent.Details.Parameters { + fmt.Printf("%s : %s\n", k, v) + } + + resp := events.ConnectResponse{ + "Result": "Success", + "NewAttribute": "NewValue", + } + + return resp, nil +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_DynamoDB.md b/vendor/github.com/aws/aws-lambda-go/events/README_DynamoDB.md new file mode 100644 index 000000000000..a01201ff2d60 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_DynamoDB.md @@ -0,0 +1,80 @@ +# Sample Function + +The following is a sample Lambda function that receives DynamoDB event data as input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs.) + +```go +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(ctx context.Context, e events.DynamoDBEvent) { + + for _, record := range e.Records { + fmt.Printf("Processing request data for event ID %s, type %s.\n", record.EventID, record.EventName) + + // Print new values for attributes of type String + for name, value := range record.Change.NewImage { + if value.DataType() == events.DataTypeString { + fmt.Printf("Attribute name: %s, value: %s\n", name, value.String()) + } + } + } +} +``` + +# Reading attribute values + +Stream notifications are delivered to the Lambda handler whenever data in the DynamoDB table is modified. +Depending on the Stream settings, a StreamRecord may contain the following data: + +* Keys: key attributes of the modified item. +* NewImage: the entire item, as it appears after it was modified. +* OldImage: the entire item, as it appeared before it was modified. + +The values for the attributes can be accessed using the AttributeValue type. For each type +supported natively by DynamoDB, there is a corresponding accessor method: + +DynamoDB type | AttributeValue accessor method | Return type | DataType constant +---------------|--------------------------------|---------------------------|------------------ +B (Binary) | Binary() | []byte | DataTypeBinary +BOOL (Boolean) | Boolean() | bool | DataTypeBoolean +BS (Binary Set)| BinarySet() | [][]byte | DataTypeBinarySet +L (List) | List() | []AttributeValue | DataTypeList +M (Map) | Map() | map[string]AttributeValue | DataTypeMap +N (Number) | Number() / Integer() / Float() | string / int64 / float64 | DataTypeNumber +NS (Number Set)| NumberSet() | []string | DataTypeNumberSet +NULL (Null) | IsNull() | bool | DataTypeNull +S (String) | String() | string | DataTypeString +SS (String Set)| StringSet() | []string | DataTypeStringSet + +Calling the accessor method for the incorrect type will result in a panic. If the type needs to +be discovered in runtime, the method DataType() can be used in order to determine the correct accessor. + +More information about DynamoDB data types can be seen [in this documentation](http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html). + +The following example reads values of attributes name and age, for which types are known to be String and Number: + +```go +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" +) + +func handleRequest(ctx context.Context, e events.DynamoDBEvent) { + + for _, record := range e.Records { + fmt.Printf("Processing request data for event ID %s, type %s.\n", record.EventID, record.EventName) + + // Print new values for attributes name and age + name := record.Change.NewImage["name"].String() + age, _ := record.Change.NewImage["age"].Integer() + + fmt.Printf("Name: %s, age: %d\n", name, age) + } +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_Kinesis.md b/vendor/github.com/aws/aws-lambda-go/events/README_Kinesis.md new file mode 100644 index 000000000000..4dd23b20b243 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_Kinesis.md @@ -0,0 +1,33 @@ +# Sample Function + +The following is a sample class and Lambda function that receives Amazon Kinesis event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, kinesisEvent events.KinesisEvent) error { + for _, record := range kinesisEvent.Records { + kinesisRecord := record.Kinesis + dataBytes := kinesisRecord.Data + dataText := string(dataBytes) + + fmt.Printf("%s Data = %s \n", record.EventName, dataText) + } + + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_KinesisFirehose.md b/vendor/github.com/aws/aws-lambda-go/events/README_KinesisFirehose.md new file mode 100644 index 000000000000..ac7d85c491c2 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_KinesisFirehose.md @@ -0,0 +1,45 @@ +# Sample Function + +The following is a sample Lambda function that transforms Kinesis Firehose records by doing a ToUpper on the data. + +```go + +package main + +import ( + "fmt" + "strings" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handleRequest(evnt events.KinesisFirehoseEvent) (events.KinesisFirehoseResponse, error) { + + fmt.Printf("InvocationID: %s\n", evnt.InvocationID) + fmt.Printf("DeliveryStreamArn: %s\n", evnt.DeliveryStreamArn) + fmt.Printf("Region: %s\n", evnt.Region) + + var response events.KinesisFirehoseResponse + + for _, record := range evnt.Records { + fmt.Printf("RecordID: %s\n", record.RecordID) + fmt.Printf("ApproximateArrivalTimestamp: %s\n", record.ApproximateArrivalTimestamp) + + // Transform data: ToUpper the data + var transformedRecord events.KinesisFirehoseResponseRecord + transformedRecord.RecordID = record.RecordID + transformedRecord.Result = events.KinesisFirehoseTransformedStateOk + transformedRecord.Data = []byte(strings.ToUpper(string(record.Data))) + + response.Records = append(response.Records, transformedRecord) + } + + return response, nil +} + +func main() { + lambda.Start(handleRequest) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_S3.md b/vendor/github.com/aws/aws-lambda-go/events/README_S3.md new file mode 100644 index 000000000000..a8f746f7aec0 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_S3.md @@ -0,0 +1,20 @@ +# Sample Function + +The following is a sample class and Lambda function that receives Amazon S3 event record data as an input and writes some of the record data to CloudWatch Logs. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go + +import ( + "fmt" + "context" + "github.com/aws/aws-lambda-go/events" +) + +func handler(ctx context.Context, s3Event events.S3Event) { + for _, record := range s3Event.Records { + s3 := record.S3 + fmt.Printf("[%s - %s] Bucket = %s, Key = %s \n", record.EventSource, record.EventTime, s3.Bucket.Name, s3.Object.Key) + } +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_SNS.md b/vendor/github.com/aws/aws-lambda-go/events/README_SNS.md new file mode 100644 index 000000000000..f198793d434c --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_SNS.md @@ -0,0 +1,21 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon SNS event record data as input, writes some of the record data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" +) + +func handler(ctx context.Context, snsEvent events.SNSEvent) { + for _, record := range snsEvent.Records { + snsRecord := record.SNS + + fmt.Printf("[%s %s] Message = %s \n", record.EventSource, snsRecord.Timestamp, snsRecord.Message) + } +} +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md b/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md new file mode 100644 index 000000000000..e5340f3a4335 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/README_SQS.md @@ -0,0 +1,29 @@ + +# Sample Function + +The following is a sample class and Lambda function that receives Amazon SQS event message data as input, writes some of the message data to CloudWatch Logs, and responds with a 200 status and the same body as the request. (Note that by default anything written to Console will be logged as CloudWatch Logs events.) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" +) + +func handler(ctx context.Context, sqsEvent events.SQSEvent) error { + for _, message := range sqsEvent.Records { + fmt.Printf("The message %s for event source %s = %s \n", message.MessageId, message.EventSource, message.Body) + } + + return nil +} + +func main() { + lambda.Start(handler) +} + +``` diff --git a/vendor/github.com/aws/aws-lambda-go/events/apigw.go b/vendor/github.com/aws/aws-lambda-go/events/apigw.go new file mode 100644 index 000000000000..e77753ddd5d1 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/apigw.go @@ -0,0 +1,123 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// APIGatewayProxyRequest contains data coming from the API Gateway proxy +type APIGatewayProxyRequest struct { + Resource string `json:"resource"` // The resource path defined in API Gateway + Path string `json:"path"` // The url path for the caller + HTTPMethod string `json:"httpMethod"` + Headers map[string]string `json:"headers"` + QueryStringParameters map[string]string `json:"queryStringParameters"` + PathParameters map[string]string `json:"pathParameters"` + StageVariables map[string]string `json:"stageVariables"` + RequestContext APIGatewayProxyRequestContext `json:"requestContext"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` +} + +// APIGatewayProxyResponse configures the response to be returned by API Gateway for the request +type APIGatewayProxyResponse struct { + StatusCode int `json:"statusCode"` + Headers map[string]string `json:"headers"` + Body string `json:"body"` + IsBase64Encoded bool `json:"isBase64Encoded,omitempty"` +} + +// APIGatewayProxyRequestContext contains the information to identify the AWS account and resources invoking the +// Lambda function. It also includes Cognito identity information for the caller. +type APIGatewayProxyRequestContext struct { + AccountID string `json:"accountId"` + ResourceID string `json:"resourceId"` + Stage string `json:"stage"` + RequestID string `json:"requestId"` + Identity APIGatewayRequestIdentity `json:"identity"` + ResourcePath string `json:"resourcePath"` + Authorizer map[string]interface{} `json:"authorizer"` + HTTPMethod string `json:"httpMethod"` + APIID string `json:"apiId"` // The API Gateway rest API Id +} + +// APIGatewayRequestIdentity contains identity information for the request caller. +type APIGatewayRequestIdentity struct { + CognitoIdentityPoolID string `json:"cognitoIdentityPoolId"` + AccountID string `json:"accountId"` + CognitoIdentityID string `json:"cognitoIdentityId"` + Caller string `json:"caller"` + APIKey string `json:"apiKey"` + SourceIP string `json:"sourceIp"` + CognitoAuthenticationType string `json:"cognitoAuthenticationType"` + CognitoAuthenticationProvider string `json:"cognitoAuthenticationProvider"` + UserArn string `json:"userArn"` + UserAgent string `json:"userAgent"` + User string `json:"user"` +} + +// APIGatewayCustomAuthorizerRequestTypeRequestIdentity contains identity information for the request caller. +type APIGatewayCustomAuthorizerRequestTypeRequestIdentity struct { + APIKey string `json:"apiKey"` + SourceIP string `json:"sourceIp"` +} + +// APIGatewayCustomAuthorizerContext represents the expected format of an API Gateway custom authorizer response. +// Deprecated. Code should be updated to use the Authorizer map from APIGatewayRequestIdentity. Ex: Authorizer["principalId"] +type APIGatewayCustomAuthorizerContext struct { + PrincipalID *string `json:"principalId"` + StringKey *string `json:"stringKey,omitempty"` + NumKey *int `json:"numKey,omitempty"` + BoolKey *bool `json:"boolKey,omitempty"` +} + +// APIGatewayCustomAuthorizerRequestTypeRequestContext represents the expected format of an API Gateway custom authorizer response. +type APIGatewayCustomAuthorizerRequestTypeRequestContext struct { + Path string `json:"path"` + AccountID string `json:"accountId"` + ResourceID string `json:"resourceId"` + Stage string `json:"stage"` + RequestID string `json:"requestId"` + Identity APIGatewayCustomAuthorizerRequestTypeRequestIdentity `json:"identity"` + ResourcePath string `json:"resourcePath"` + HTTPMethod string `json:"httpMethod"` + APIID string `json:"apiId"` +} + +// APIGatewayCustomAuthorizerRequest contains data coming in to a custom API Gateway authorizer function. +type APIGatewayCustomAuthorizerRequest struct { + Type string `json:"type"` + AuthorizationToken string `json:"authorizationToken"` + MethodArn string `json:"methodArn"` +} + +// APIGatewayCustomAuthorizerRequestTypeRequest contains data coming in to a custom API Gateway authorizer function. +type APIGatewayCustomAuthorizerRequestTypeRequest struct { + Type string `json:"type"` + MethodArn string `json:"methodArn"` + Resource string `json:"resource"` + Path string `json:"path"` + HTTPMethod string `json:"httpMethod"` + Headers map[string]string `json:"headers"` + QueryStringParameters map[string]string `json:"queryStringParameters"` + PathParameters map[string]string `json:"pathParameters"` + StageVariables map[string]string `json:"stageVariables"` + RequestContext APIGatewayCustomAuthorizerRequestTypeRequestContext `json:"requestContext"` +} + +// APIGatewayCustomAuthorizerResponse represents the expected format of an API Gateway authorization response. +type APIGatewayCustomAuthorizerResponse struct { + PrincipalID string `json:"principalId"` + PolicyDocument APIGatewayCustomAuthorizerPolicy `json:"policyDocument"` + Context map[string]interface{} `json:"context,omitempty"` + UsageIdentifierKey string `json:"usageIdentifierKey,omitempty"` +} + +// APIGatewayCustomAuthorizerPolicy represents an IAM policy +type APIGatewayCustomAuthorizerPolicy struct { + Version string + Statement []IAMPolicyStatement +} + +type IAMPolicyStatement struct { + Action []string + Effect string + Resource []string +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/appsync.go b/vendor/github.com/aws/aws-lambda-go/events/appsync.go new file mode 100644 index 000000000000..d6ba49ecfd2f --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/appsync.go @@ -0,0 +1,20 @@ +package events + +import "encoding/json" + +// AppSyncResolverTemplate represents the requests from AppSync to Lambda +type AppSyncResolverTemplate struct { + Version string `json:"version"` + Operation AppSyncOperation `json:"operation"` + Payload json.RawMessage `json:"payload"` +} + +// AppSyncOperation specifies the operation type supported by Lambda operations +type AppSyncOperation string + +const ( + // OperationInvoke lets AWS AppSync know to call your Lambda function for every GraphQL field resolver + OperationInvoke AppSyncOperation = "Invoke" + // OperationBatchInvoke instructs AWS AppSync to batch requests for the current GraphQL field + OperationBatchInvoke AppSyncOperation = "BatchInvoke" +) diff --git a/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go b/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go new file mode 100644 index 000000000000..530f54db09fc --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/attributevalue.go @@ -0,0 +1,520 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "strconv" +) + +// DynamoDBAttributeValue provides convenient access for a value stored in DynamoDB. +// For more information, please see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html +type DynamoDBAttributeValue struct { + value anyValue + dataType DynamoDBDataType +} + +// Binary provides access to an attribute of type Binary. +// Method panics if the attribute is not of type Binary. +func (av DynamoDBAttributeValue) Binary() []byte { + av.ensureType(DataTypeBinary) + return av.value.([]byte) +} + +// Boolean provides access to an attribute of type Boolean. +// Method panics if the attribute is not of type Boolean. +func (av DynamoDBAttributeValue) Boolean() bool { + av.ensureType(DataTypeBoolean) + return av.value.(bool) +} + +// BinarySet provides access to an attribute of type Binary Set. +// Method panics if the attribute is not of type BinarySet. +func (av DynamoDBAttributeValue) BinarySet() [][]byte { + av.ensureType(DataTypeBinarySet) + return av.value.([][]byte) +} + +// List provides access to an attribute of type List. Each element +// of the list is an DynamoDBAttributeValue itself. +// Method panics if the attribute is not of type List. +func (av DynamoDBAttributeValue) List() []DynamoDBAttributeValue { + av.ensureType(DataTypeList) + return av.value.([]DynamoDBAttributeValue) +} + +// Map provides access to an attribute of type Map. They Keys are strings +// and the values are DynamoDBAttributeValue instances. +// Method panics if the attribute is not of type Map. +func (av DynamoDBAttributeValue) Map() map[string]DynamoDBAttributeValue { + av.ensureType(DataTypeMap) + return av.value.(map[string]DynamoDBAttributeValue) +} + +// Number provides access to an attribute of type Number. +// DynamoDB sends the values as strings. For convenience please see also +// the methods Integer() and Float(). +// Method panics if the attribute is not of type Number. +func (av DynamoDBAttributeValue) Number() string { + av.ensureType(DataTypeNumber) + return av.value.(string) +} + +// Integer provides access to an attribute of type Number. +// DynamoDB sends the values as strings. For convenience this method +// provides conversion to int. If the value cannot be represented by +// a signed integer, err.Err = ErrRange and the returned value is the maximum magnitude integer +// of an int64 of the appropriate sign. +// Method panics if the attribute is not of type Number. +func (av DynamoDBAttributeValue) Integer() (int64, error) { + s, err := strconv.ParseFloat(av.Number(), 64) + return int64(s), err +} + +// Float provides access to an attribute of type Number. +// DynamoDB sends the values as strings. For convenience this method +// provides conversion to float64. +// The returned value is the nearest floating point number rounded using IEEE754 unbiased rounding. +// If the number is more than 1/2 ULP away from the largest floating point number of the given size, +// the value returned is ±Inf, err.Err = ErrRange. +// Method panics if the attribute is not of type Number. +func (av DynamoDBAttributeValue) Float() (float64, error) { + s, err := strconv.ParseFloat(av.Number(), 64) + return s, err +} + +// NumberSet provides access to an attribute of type Number Set. +// DynamoDB sends the numbers as strings. +// Method panics if the attribute is not of type Number. +func (av DynamoDBAttributeValue) NumberSet() []string { + av.ensureType(DataTypeNumberSet) + return av.value.([]string) +} + +// String provides access to an attribute of type String. +// Method panics if the attribute is not of type String. +func (av DynamoDBAttributeValue) String() string { + av.ensureType(DataTypeString) + return av.value.(string) +} + +// StringSet provides access to an attribute of type String Set. +// Method panics if the attribute is not of type String Set. +func (av DynamoDBAttributeValue) StringSet() []string { + av.ensureType(DataTypeStringSet) + return av.value.([]string) +} + +// IsNull returns true if the attribute is of type Null. +func (av DynamoDBAttributeValue) IsNull() bool { + return av.value == nil +} + +// DataType provides access to the DynamoDB type of the attribute +func (av DynamoDBAttributeValue) DataType() DynamoDBDataType { + return av.dataType +} + +// NewBinaryAttribute creates an DynamoDBAttributeValue containing a Binary +func NewBinaryAttribute(value []byte) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBinary + return av +} + +// NewBooleanAttribute creates an DynamoDBAttributeValue containing a Boolean +func NewBooleanAttribute(value bool) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBoolean + return av +} + +// NewBinarySetAttribute creates an DynamoDBAttributeValue containing a BinarySet +func NewBinarySetAttribute(value [][]byte) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeBinarySet + return av +} + +// NewListAttribute creates an DynamoDBAttributeValue containing a List +func NewListAttribute(value []DynamoDBAttributeValue) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeList + return av +} + +// NewMapAttribute creates an DynamoDBAttributeValue containing a Map +func NewMapAttribute(value map[string]DynamoDBAttributeValue) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeMap + return av +} + +// NewNumberAttribute creates an DynamoDBAttributeValue containing a Number +func NewNumberAttribute(value string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeNumber + return av +} + +// NewNullAttribute creates an DynamoDBAttributeValue containing a Null +func NewNullAttribute() DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.dataType = DataTypeNull + return av +} + +// NewStringAttribute creates an DynamoDBAttributeValue containing a String +func NewStringAttribute(value string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeString + return av +} + +// NewStringSetAttribute creates an DynamoDBAttributeValue containing a StringSet +func NewStringSetAttribute(value []string) DynamoDBAttributeValue { + var av DynamoDBAttributeValue + av.value = value + av.dataType = DataTypeStringSet + return av +} + +// DynamoDBDataType specifies the type supported natively by DynamoDB for an attribute +type DynamoDBDataType int + +const ( + DataTypeBinary DynamoDBDataType = iota + DataTypeBoolean + DataTypeBinarySet + DataTypeList + DataTypeMap + DataTypeNumber + DataTypeNumberSet + DataTypeNull + DataTypeString + DataTypeStringSet +) + +type anyValue interface{} + +// UnsupportedDynamoDBTypeError is the error returned when trying to unmarshal a DynamoDB Attribute type not recognized by this library +type UnsupportedDynamoDBTypeError struct { + Type string +} + +func (e UnsupportedDynamoDBTypeError) Error() string { + return fmt.Sprintf("unsupported DynamoDB attribute type, %v", e.Type) +} + +// IncompatibleDynamoDBTypeError is the error passed in a panic when calling an accessor for an incompatible type +type IncompatibleDynamoDBTypeError struct { + Requested DynamoDBDataType + Actual DynamoDBDataType +} + +func (e IncompatibleDynamoDBTypeError) Error() string { + return fmt.Sprintf("accessor called for incompatible type, requested type %v but actual type was %v", e.Requested, e.Actual) +} + +func (av *DynamoDBAttributeValue) ensureType(expectedType DynamoDBDataType) { + if av.dataType != expectedType { + panic(IncompatibleDynamoDBTypeError{Requested: expectedType, Actual: av.dataType}) + } +} + +// MarshalJSON implements custom marshaling to be used by the standard json/encoding package +func (av DynamoDBAttributeValue) MarshalJSON() ([]byte, error) { + + var buff bytes.Buffer + var err error + var b []byte + + switch av.dataType { + case DataTypeBinary: + buff.WriteString(`{ "B":`) + b, err = json.Marshal(av.value.([]byte)) + buff.Write(b) + + case DataTypeBoolean: + buff.WriteString(`{ "BOOL":`) + b, err = json.Marshal(av.value.(bool)) + buff.Write(b) + + case DataTypeBinarySet: + buff.WriteString(`{ "BS":`) + b, err = json.Marshal(av.value.([][]byte)) + buff.Write(b) + + case DataTypeList: + buff.WriteString(`{ "L":`) + b, err = json.Marshal(av.value.([]DynamoDBAttributeValue)) + buff.Write(b) + + case DataTypeMap: + buff.WriteString(`{ "M":`) + b, err = json.Marshal(av.value.(map[string]DynamoDBAttributeValue)) + buff.Write(b) + + case DataTypeNumber: + buff.WriteString(`{ "N":`) + b, err = json.Marshal(av.value.(string)) + buff.Write(b) + + case DataTypeNumberSet: + buff.WriteString(`{ "NS":`) + b, err = json.Marshal(av.value.([]string)) + buff.Write(b) + + case DataTypeNull: + buff.WriteString(`{ "NULL": true `) + + case DataTypeString: + buff.WriteString(`{ "S":`) + b, err = json.Marshal(av.value.(string)) + buff.Write(b) + + case DataTypeStringSet: + buff.WriteString(`{ "SS":`) + b, err = json.Marshal(av.value.([]string)) + buff.Write(b) + } + + buff.WriteString(`}`) + return buff.Bytes(), err +} + +func unmarshalNull(target *DynamoDBAttributeValue) error { + target.value = nil + target.dataType = DataTypeNull + return nil +} + +func unmarshalString(target *DynamoDBAttributeValue, value interface{}) error { + var ok bool + target.value, ok = value.(string) + target.dataType = DataTypeString + if !ok { + return errors.New("DynamoDBAttributeValue: S type should contain a string") + } + return nil +} + +func unmarshalBinary(target *DynamoDBAttributeValue, value interface{}) error { + stringValue, ok := value.(string) + if !ok { + return errors.New("DynamoDBAttributeValue: B type should contain a base64 string") + } + + binaryValue, err := base64.StdEncoding.DecodeString(stringValue) + if err != nil { + return err + } + + target.value = binaryValue + target.dataType = DataTypeBinary + return nil +} + +func unmarshalBoolean(target *DynamoDBAttributeValue, value interface{}) error { + booleanValue, ok := value.(bool) + if !ok { + return errors.New("DynamoDBAttributeValue: BOOL type should contain a boolean") + } + + target.value = booleanValue + target.dataType = DataTypeBoolean + return nil +} + +func unmarshalBinarySet(target *DynamoDBAttributeValue, value interface{}) error { + list, ok := value.([]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: BS type should contain a list of base64 strings") + } + + binarySet := make([][]byte, len(list)) + + for index, element := range list { + var err error + elementString := element.(string) + binarySet[index], err = base64.StdEncoding.DecodeString(elementString) + if err != nil { + return err + } + } + + target.value = binarySet + target.dataType = DataTypeBinarySet + return nil +} + +func unmarshalList(target *DynamoDBAttributeValue, value interface{}) error { + list, ok := value.([]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: L type should contain a list") + } + + DynamoDBAttributeValues := make([]DynamoDBAttributeValue, len(list)) + for index, element := range list { + + elementMap, ok := element.(map[string]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: element of a list is not an DynamoDBAttributeValue") + } + + var elementDynamoDBAttributeValue DynamoDBAttributeValue + err := unmarshalDynamoDBAttributeValueMap(&elementDynamoDBAttributeValue, elementMap) + if err != nil { + return errors.New("DynamoDBAttributeValue: unmarshal of child DynamoDBAttributeValue failed") + } + DynamoDBAttributeValues[index] = elementDynamoDBAttributeValue + } + target.value = DynamoDBAttributeValues + target.dataType = DataTypeList + return nil +} + +func unmarshalMap(target *DynamoDBAttributeValue, value interface{}) error { + m, ok := value.(map[string]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: M type should contain a map") + } + + DynamoDBAttributeValues := make(map[string]DynamoDBAttributeValue) + for k, v := range m { + + elementMap, ok := v.(map[string]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: element of a map is not an DynamoDBAttributeValue") + } + + var elementDynamoDBAttributeValue DynamoDBAttributeValue + err := unmarshalDynamoDBAttributeValueMap(&elementDynamoDBAttributeValue, elementMap) + if err != nil { + return errors.New("DynamoDBAttributeValue: unmarshal of child DynamoDBAttributeValue failed") + } + DynamoDBAttributeValues[k] = elementDynamoDBAttributeValue + } + target.value = DynamoDBAttributeValues + target.dataType = DataTypeMap + return nil +} + +func unmarshalNumber(target *DynamoDBAttributeValue, value interface{}) error { + var ok bool + target.value, ok = value.(string) + target.dataType = DataTypeNumber + if !ok { + return errors.New("DynamoDBAttributeValue: N type should contain a string") + } + return nil +} + +func unmarshalNumberSet(target *DynamoDBAttributeValue, value interface{}) error { + list, ok := value.([]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: NS type should contain a list of strings") + } + + numberSet := make([]string, len(list)) + + for index, element := range list { + numberSet[index], ok = element.(string) + if !ok { + return errors.New("DynamoDBAttributeValue: NS type should contain a list of strings") + } + } + + target.value = numberSet + target.dataType = DataTypeNumberSet + return nil +} + +func unmarshalStringSet(target *DynamoDBAttributeValue, value interface{}) error { + list, ok := value.([]interface{}) + if !ok { + return errors.New("DynamoDBAttributeValue: SS type should contain a list of strings") + } + + stringSet := make([]string, len(list)) + + for index, element := range list { + stringSet[index], ok = element.(string) + if !ok { + return errors.New("DynamoDBAttributeValue: SS type should contain a list of strings") + } + } + + target.value = stringSet + target.dataType = DataTypeStringSet + return nil +} + +func unmarshalDynamoDBAttributeValue(target *DynamoDBAttributeValue, typeLabel string, jsonValue interface{}) error { + + switch typeLabel { + case "NULL": + return unmarshalNull(target) + case "B": + return unmarshalBinary(target, jsonValue) + case "BOOL": + return unmarshalBoolean(target, jsonValue) + case "BS": + return unmarshalBinarySet(target, jsonValue) + case "L": + return unmarshalList(target, jsonValue) + case "M": + return unmarshalMap(target, jsonValue) + case "N": + return unmarshalNumber(target, jsonValue) + case "NS": + return unmarshalNumberSet(target, jsonValue) + case "S": + return unmarshalString(target, jsonValue) + case "SS": + return unmarshalStringSet(target, jsonValue) + default: + target.value = nil + target.dataType = DataTypeNull + return UnsupportedDynamoDBTypeError{typeLabel} + } +} + +// UnmarshalJSON unmarshals a JSON description of this DynamoDBAttributeValue +func (av *DynamoDBAttributeValue) UnmarshalJSON(b []byte) error { + var m map[string]interface{} + + err := json.Unmarshal(b, &m) + if err != nil { + return err + } + + return unmarshalDynamoDBAttributeValueMap(av, m) +} + +func unmarshalDynamoDBAttributeValueMap(target *DynamoDBAttributeValue, m map[string]interface{}) error { + if m == nil { + return errors.New("DynamoDBAttributeValue: does not contain a map") + } + + if len(m) != 1 { + return errors.New("DynamoDBAttributeValue: map must contain a single type") + } + + for k, v := range m { + return unmarshalDynamoDBAttributeValue(target, k, v) + } + + return nil +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/autoscaling.go b/vendor/github.com/aws/aws-lambda-go/events/autoscaling.go new file mode 100644 index 000000000000..a50d9cc1cb06 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/autoscaling.go @@ -0,0 +1,18 @@ +package events + +import ( + "time" +) + +// AutoScalingEvent struct is used to parse the json for auto scaling event types // +type AutoScalingEvent struct { + Version string `json:"version"` // The version of event data + ID string `json:"id"` // The unique ID of the event + DetailType string `json:"detail-type"` //Details about event type + Source string `json:"source"` //Source of the event + AccountID string `json:"account"` //AccountId + Time time.Time `json:"time"` //Event timestamp + Region string `json:"region"` //Region of event + Resources []string `json:"resources"` //Information about resources impacted by event + Detail map[string]interface{} `json:"detail"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_events.go b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_events.go new file mode 100644 index 000000000000..e3201fdb32d5 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_events.go @@ -0,0 +1,20 @@ +package events + +import ( + "encoding/json" + "time" +) + +// CloudWatchEvent is the outer structure of an event sent via CloudWatch Events. +// For examples of events that come via CloudWatch Events, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html +type CloudWatchEvent struct { + Version string `json:"version"` + ID string `json:"id"` + DetailType string `json:"detail-type"` + Source string `json:"source"` + AccountID string `json:"account"` + Time time.Time `json:"time"` + Region string `json:"region"` + Resources []string `json:"resources"` + Detail json.RawMessage `json:"detail"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go new file mode 100644 index 000000000000..447cbd5fd4a2 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/cloudwatch_logs.go @@ -0,0 +1,55 @@ +package events + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "encoding/json" +) + +// CloudwatchLogsEvent represents raw data from a cloudwatch logs event +type CloudwatchLogsEvent struct { + AWSLogs CloudwatchLogsRawData `json:"awslogs"` +} + +// CloudwatchLogsRawData contains gzipped base64 json representing the bulk +// of a cloudwatch logs event +type CloudwatchLogsRawData struct { + Data string `json:"data"` +} + +// Parse returns a struct representing a usable CloudwatchLogs event +func (c CloudwatchLogsRawData) Parse() (d CloudwatchLogsData, err error) { + data, err := base64.StdEncoding.DecodeString(c.Data) + if err != nil { + return + } + + zr, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return + } + + buf := &bytes.Buffer{} + buf.ReadFrom(zr) + + err = json.Unmarshal(buf.Bytes(), &d) + return +} + +// CloudwatchLogsData is an unmarshal'd, ungzip'd, cloudwatch logs event +type CloudwatchLogsData struct { + Owner string `json:"owner"` + LogGroup string `json:"logGroup"` + LogStream string `json:"logStream"` + SubscriptionFilters []string `json:"subscriptionFilters"` + MessageType string `json:"messageType"` + LogEvents []CloudwatchLogsLogEvent `json:"logEvents"` +} + +// LogEvent represents a log entry from cloudwatch logs +type CloudwatchLogsLogEvent struct { + ID string `json:"id"` + Timestamp int64 `json:"timestamp"` + Message string `json:"message"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/code_commit.go b/vendor/github.com/aws/aws-lambda-go/events/code_commit.go new file mode 100644 index 000000000000..47eefa666ee3 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/code_commit.go @@ -0,0 +1,100 @@ +package events + +import ( + "errors" + "fmt" + "time" +) + +// CodeCommitEvent represents a CodeCommit event +type CodeCommitEvent struct { + Records []CodeCommitRecord `json:"Records"` +} + +// String returns a string representation of this object. +// Useful for testing and debugging. +func (e CodeCommitEvent) String() string { + return fmt.Sprintf("{Records: %v}", e.Records) +} + +type CodeCommitEventTime time.Time + +// https://golang.org/pkg/time/#Parse +const codeCommitEventTimeReference = "\"2006-01-2T15:04:05.000-0700\"" + +func (t *CodeCommitEventTime) MarshalJSON() ([]byte, error) { + if t == nil { + return nil, errors.New("CodeCommitEventTime cannot be nil") + } + + gt := time.Time(*t) + return []byte(gt.Format(codeCommitEventTimeReference)), nil +} + +func (t *CodeCommitEventTime) UnmarshalJSON(data []byte) error { + if t == nil { + return errors.New("CodeCommitEventTime cannot be nil") + } + + pt, err := time.Parse(codeCommitEventTimeReference, string(data)) + if err == nil { + *t = CodeCommitEventTime(pt) + } + return err +} + +// represents a CodeCommit record +type CodeCommitRecord struct { + EventID string `json:"eventId"` + EventVersion string `json:"eventVersion"` + EventTime CodeCommitEventTime `json:"eventTime"` + EventTriggerName string `json:"eventTriggerName"` + EventPartNumber uint64 `json:"eventPartNumber"` + CodeCommit CodeCommitCodeCommit `json:"codecommit"` + EventName string `json:"eventName"` + EventTriggerConfigId string `json:"eventTriggerConfigId"` + EventSourceARN string `json:"eventSourceARN"` + UserIdentityARN string `json:"userIdentityARN"` + EventSource string `json:"eventSource"` + AWSRegion string `json:"awsRegion"` + EventTotalParts uint64 `json:"eventTotalParts"` +} + +// String returns a string representation of this object. +// Useful for testing and debugging. +func (r CodeCommitRecord) String() string { + return fmt.Sprintf( + "{eventId: %v, eventVersion: %v, eventTime: %v, eventTriggerName: %v, "+ + "eventPartNumber: %v, codeCommit: %v, eventName: %v, "+ + "eventTriggerConfigId: %v, eventSourceARN: %v, userIdentityARN: %v, "+ + "eventSource: %v, awsRegion: %v, eventTotalParts: %v}", + r.EventID, r.EventVersion, r.EventTime, r.EventTriggerName, + r.EventPartNumber, r.CodeCommit, r.EventName, + r.EventTriggerConfigId, r.EventSourceARN, r.UserIdentityARN, + r.EventSource, r.AWSRegion, r.EventTotalParts) +} + +// CodeCommitCodeCommit represents a CodeCommit object in a record +type CodeCommitCodeCommit struct { + References []CodeCommitReference `json:"references"` +} + +// String returns a string representation of this object. +// Useful for testing and debugging. +func (c CodeCommitCodeCommit) String() string { + return fmt.Sprintf("{references: %v}", c.References) +} + +// CodeCommitReference represents a Reference object in a CodeCommit object +type CodeCommitReference struct { + Commit string `json:"commit"` + Ref string `json:"ref"` + Created bool `json:"created,omitempty"` +} + +// String returns a string representation of this object. +// Useful for testing and debugging. +func (r CodeCommitReference) String() string { + return fmt.Sprintf( + "{commit: %v, ref: %v, created: %v}", r.Commit, r.Ref, r.Created) +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/codepipeline_job.go b/vendor/github.com/aws/aws-lambda-go/events/codepipeline_job.go new file mode 100644 index 000000000000..68f96344ea07 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/codepipeline_job.go @@ -0,0 +1,74 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// CodePipelineEvent contains data from an event sent from AWS Codepipeline +type CodePipelineEvent struct { + CodePipelineJob CodePipelineJob `json:"CodePipeline.job"` +} + +// CodePipelineJob represents a job from an AWS CodePipeline event +type CodePipelineJob struct { + ID string `json:"id"` + AccountID string `json:"accountId"` + Data CodePipelineData `json:"data"` +} + +// CodePipelineData represents a job from an AWS CodePipeline event +type CodePipelineData struct { + ActionConfiguration CodePipelineActionConfiguration `json:"actionConfiguration"` + InputArtifacts []CodePipelineInputArtifact `json:"inputArtifacts"` + OutPutArtifacts []CodePipelineOutputArtifact `json:"outputArtifacts"` + ArtifactCredentials CodePipelineArtifactCredentials `json:"artifactCredentials"` + ContinuationToken string `json:"continuationToken"` +} + +// CodePipelineActionConfiguration represents an Action Configuration +type CodePipelineActionConfiguration struct { + Configuration CodePipelineConfiguration `json:"configuration"` +} + +// CodePipelineConfiguration represents a configuration for an Action Configuration +type CodePipelineConfiguration struct { + FunctionName string `json:"FunctionName"` + UserParameters string `json:"UserParameters"` +} + +// CodePipelineInputArtifact represents an input artifact +type CodePipelineInputArtifact struct { + Location CodePipelineInputLocation `json:"location"` + Revision *string `json:"revision"` + Name string `json:"name"` +} + +// CodePipelineInputLocation represents a input location +type CodePipelineInputLocation struct { + S3Location CodePipelineS3Location `json:"s3Location"` + LocationType string `json:"type"` +} + +// CodePipelineS3Location represents an s3 input location +type CodePipelineS3Location struct { + BucketName string `json:"bucketName"` + ObjectKey string `json:"objectKey"` +} + +// CodePipelineOutputArtifact represents an output artifact +type CodePipelineOutputArtifact struct { + Location CodePipelineInputLocation `json:"location"` + Revision *string `json:"revision"` + Name string `json:"name"` +} + +// CodePipelineOutputLocation represents a output location +type CodePipelineOutputLocation struct { + S3Location CodePipelineS3Location `json:"s3Location"` + LocationType string `json:"type"` +} + +// CodePipelineArtifactCredentials represents CodePipeline artifact credentials +type CodePipelineArtifactCredentials struct { + SecretAccessKey string `json:"secretAccessKey"` + SessionToken string `json:"sessionToken"` + AccessKeyID string `json:"accessKeyId"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/cognito.go b/vendor/github.com/aws/aws-lambda-go/events/cognito.go new file mode 100644 index 000000000000..8190348271cb --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/cognito.go @@ -0,0 +1,75 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// CognitoEvent contains data from an event sent from AWS Cognito Sync +type CognitoEvent struct { + DatasetName string `json:"datasetName"` + DatasetRecords map[string]CognitoDatasetRecord `json:"datasetRecords"` + EventType string `json:"eventType"` + IdentityID string `json:"identityId"` + IdentityPoolID string `json:"identityPoolId"` + Region string `json:"region"` + Version int `json:"version"` +} + +// CognitoDatasetRecord represents a record from an AWS Cognito Sync event +type CognitoDatasetRecord struct { + NewValue string `json:"newValue"` + OldValue string `json:"oldValue"` + Op string `json:"op"` +} + +// CognitoEventUserPoolsPreSignup is sent by AWS Cognito User Pools when a user attempts to register +// (sign up), allowing a Lambda to perform custom validation to accept or deny the registration request +type CognitoEventUserPoolsPreSignup struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPreSignupRequest `json:"request"` + Response CognitoEventUserPoolsPreSignupResponse `json:"response"` +} + +// CognitoEventUserPoolsPostConfirmation is sent by AWS Cognito User Pools after a user is confirmed, +// allowing the Lambda to send custom messages or add custom logic. +type CognitoEventUserPoolsPostConfirmation struct { + CognitoEventUserPoolsHeader + Request CognitoEventUserPoolsPostConfirmationRequest `json:"request"` + Response CognitoEventUserPoolsPostConfirmationResponse `json:"response"` +} + +// CognitoEventUserPoolsCallerContext contains information about the caller +type CognitoEventUserPoolsCallerContext struct { + AWSSDKVersion string `json:"awsSdkVersion"` + ClientID string `json:"clientId"` +} + +// CognitoEventUserPoolsHeader contains common data from events sent by AWS Cognito User Pools +type CognitoEventUserPoolsHeader struct { + Version string `json:"version"` + TriggerSource string `json:"triggerSource"` + Region string `json:"region"` + UserPoolID string `json:"userPoolId"` + CallerContext CognitoEventUserPoolsCallerContext `json:"callerContext"` + UserName string `json:"userName"` +} + +// CognitoEventUserPoolsPreSignupRequest contains the request portion of a PreSignup event +type CognitoEventUserPoolsPreSignupRequest struct { + UserAttributes map[string]string `json:"userAttributes"` + ValidationData map[string]string `json:"validationData"` +} + +// CognitoEventUserPoolsPreSignupResponse contains the response portion of a PreSignup event +type CognitoEventUserPoolsPreSignupResponse struct { + AutoConfirmUser bool `json:"autoConfirmUser"` + AutoVerifyEmail bool `json:"autoVerifyEmail"` + AutoVerifyPhone bool `json:"autoVerifyPhone"` +} + +// CognitoEventUserPoolsPostConfirmationRequest contains the request portion of a PostConfirmation event +type CognitoEventUserPoolsPostConfirmationRequest struct { + UserAttributes map[string]string `json:"userAttributes"` +} + +// CognitoEventUserPoolsPostConfirmationResponse contains the response portion of a PostConfirmation event +type CognitoEventUserPoolsPostConfirmationResponse struct { +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/config.go b/vendor/github.com/aws/aws-lambda-go/events/config.go new file mode 100644 index 000000000000..951809c786b6 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/config.go @@ -0,0 +1,17 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// ConfigEvent contains data from an event sent from AWS Config +type ConfigEvent struct { + AccountID string `json:"accountId"` // The ID of the AWS account that owns the rule + ConfigRuleArn string `json:"configRuleArn"` // The ARN that AWS Config assigned to the rule + ConfigRuleID string `json:"configRuleId"` + ConfigRuleName string `json:"configRuleName"` // The name that you assigned to the rule that caused AWS Config to publish the event + EventLeftScope bool `json:"eventLeftScope"` // A boolean value that indicates whether the AWS resource to be evaluated has been removed from the rule's scope + ExecutionRoleArn string `json:"executionRoleArn"` + InvokingEvent string `json:"invokingEvent"` // If the event is published in response to a resource configuration change, this value contains a JSON configuration item + ResultToken string `json:"resultToken"` // A token that the function must pass to AWS Config with the PutEvaluations call + RuleParameters string `json:"ruleParameters"` // Key/value pairs that the function processes as part of its evaluation logic + Version string `json:"version"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/connect.go b/vendor/github.com/aws/aws-lambda-go/events/connect.go new file mode 100644 index 000000000000..d957392d9691 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/connect.go @@ -0,0 +1,50 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// ConnectEvent contains the data structure for a Connect event. +type ConnectEvent struct { + Details ConnectDetails `json:"Details"` + Name string `json:"Name"` // The name of the event. +} + +// ConnectDetails holds the details of a Connect event +type ConnectDetails struct { + ContactData ConnectContactData `json:"ContactData"` + + // The parameters that have been set in the Connect instance at the time of the Lambda invocation. + Parameters map[string]string `json:"Parameters"` +} + +// ConnectContactData holds all of the contact information for the user that invoked the Connect event. +type ConnectContactData struct { + // The custom attributes from Connect that the Lambda function was invoked with. + Attributes map[string]string `json:"Attributes"` + Channel string `json:"Channel"` + ContactID string `json:"ContactId"` + CustomerEndpoint ConnectEndpoint `json:"CustomerEndpoint"` + InitialContactID string `json:"InitialContactId"` + + // Either: INBOUND/OUTBOUND/TRANSFER/CALLBACK + InitiationMethod string `json:"InitiationMethod"` + PreviousContactID string `json:"PreviousContactId"` + Queue ConnectQueue `json:"Queue"` + SystemEndpoint ConnectEndpoint `json:"SystemEndpoint"` + InstanceARN string `json:"InstanceARN"` +} + +// ConnectEndpoint represents routing information. +type ConnectEndpoint struct { + Address string `json:"Address"` + Type string `json:"Type"` +} + +// ConnectQueue represents a queue object. +type ConnectQueue struct { + Name string `json:"Name"` + ARN string `json:"ARN"` +} + +// ConnectResponse is the structure that Connect expects to get back from Lambda. +// These return values can be used in Connect to perform further routing decisions. +type ConnectResponse map[string]string diff --git a/vendor/github.com/aws/aws-lambda-go/events/dynamodb.go b/vendor/github.com/aws/aws-lambda-go/events/dynamodb.go new file mode 100644 index 000000000000..09fcd34cde4e --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/dynamodb.go @@ -0,0 +1,134 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// The DynamoDBEvent stream event handled to Lambda +// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update +type DynamoDBEvent struct { + Records []DynamoDBEventRecord `json:"Records"` +} + +// DynamoDbEventRecord stores information about each record of a DynamoDb stream event +type DynamoDBEventRecord struct { + // The region in which the GetRecords request was received. + AWSRegion string `json:"awsRegion"` + + // The main body of the stream record, containing all of the DynamoDB-specific + // fields. + Change DynamoDBStreamRecord `json:"dynamodb"` + + // A globally unique identifier for the event that was recorded in this stream + // record. + EventID string `json:"eventID"` + + // The type of data modification that was performed on the DynamoDB table: + // + // * INSERT - a new item was added to the table. + // + // * MODIFY - one or more of an existing item's attributes were modified. + // + // * REMOVE - the item was deleted from the table + EventName string `json:"eventName"` + + // The AWS service from which the stream record originated. For DynamoDB Streams, + // this is aws:dynamodb. + EventSource string `json:"eventSource"` + + // The version number of the stream record format. This number is updated whenever + // the structure of Record is modified. + // + // Client applications must not assume that eventVersion will remain at a particular + // value, as this number is subject to change at any time. In general, eventVersion + // will only increase as the low-level DynamoDB Streams API evolves. + EventVersion string `json:"eventVersion"` + + // The event source ARN of DynamoDB + EventSourceArn string `json:"eventSourceARN"` + + // Items that are deleted by the Time to Live process after expiration have + // the following fields: + // + // * Records[].userIdentity.type + // + // "Service" + // + // * Records[].userIdentity.principalId + // + // "dynamodb.amazonaws.com" + UserIdentity *DynamoDBUserIdentity `json:"userIdentity,omitempty"` +} + +type DynamoDBUserIdentity struct { + Type string `json:"type"` + PrincipalID string `json:"principalId"` +} + +// A description of a single data modification that was performed on an item +// in a DynamoDB table. +type DynamoDBStreamRecord struct { + + // The approximate date and time when the stream record was created, in UNIX + // epoch time (http://www.epochconverter.com/) format. + ApproximateCreationDateTime SecondsEpochTime `json:"ApproximateCreationDateTime,omitempty"` + + // The primary key attribute(s) for the DynamoDB item that was modified. + Keys map[string]DynamoDBAttributeValue `json:"Keys,omitempty"` + + // The item in the DynamoDB table as it appeared after it was modified. + NewImage map[string]DynamoDBAttributeValue `json:"NewImage,omitempty"` + + // The item in the DynamoDB table as it appeared before it was modified. + OldImage map[string]DynamoDBAttributeValue `json:"OldImage,omitempty"` + + // The sequence number of the stream record. + SequenceNumber string `json:"SequenceNumber"` + + // The size of the stream record, in bytes. + SizeBytes int64 `json:"SizeBytes"` + + // The type of data from the modified DynamoDB item that was captured in this + // stream record. + StreamViewType string `json:"StreamViewType"` +} + +type DynamoDBKeyType string + +const ( + DynamoDBKeyTypeHash DynamoDBKeyType = "HASH" + DynamoDBKeyTypeRange DynamoDBKeyType = "RANGE" +) + +type DynamoDBOperationType string + +const ( + DynamoDBOperationTypeInsert DynamoDBOperationType = "INSERT" + DynamoDBOperationTypeModify DynamoDBOperationType = "MODIFY" + DynamoDBOperationTypeRemove DynamoDBOperationType = "REMOVE" +) + +type DynamoDBSharedIteratorType string + +const ( + DynamoDBShardIteratorTypeTrimHorizon DynamoDBSharedIteratorType = "TRIM_HORIZON" + DynamoDBShardIteratorTypeLatest DynamoDBSharedIteratorType = "LATEST" + DynamoDBShardIteratorTypeAtSequenceNumber DynamoDBSharedIteratorType = "AT_SEQUENCE_NUMBER" + DynamoDBShardIteratorTypeAfterSequenceNumber DynamoDBSharedIteratorType = "AFTER_SEQUENCE_NUMBER" +) + +type DynamoDBStreamStatus string + +const ( + DynamoDBStreamStatusEnabling DynamoDBStreamStatus = "ENABLING" + DynamoDBStreamStatusEnabled DynamoDBStreamStatus = "ENABLED" + DynamoDBStreamStatusDisabling DynamoDBStreamStatus = "DISABLING" + DynamoDBStreamStatusDisabled DynamoDBStreamStatus = "DISABLED" +) + +type DynamoDBStreamViewType string + +const ( + DynamoDBStreamViewTypeNewImage DynamoDBStreamViewType = "NEW_IMAGE" // the entire item, as it appeared after it was modified. + DynamoDBStreamViewTypeOldImage DynamoDBStreamViewType = "OLD_IMAGE" // the entire item, as it appeared before it was modified. + DynamoDBStreamViewTypeNewAndOldImages DynamoDBStreamViewType = "NEW_AND_OLD_IMAGES" // both the new and the old item images of the item. + DynamoDBStreamViewTypeKeysOnly DynamoDBStreamViewType = "KEYS_ONLY" // only the key attributes of the modified item. +) diff --git a/vendor/github.com/aws/aws-lambda-go/events/epoch_time.go b/vendor/github.com/aws/aws-lambda-go/events/epoch_time.go new file mode 100644 index 000000000000..b0e48a0e7178 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/epoch_time.go @@ -0,0 +1,59 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +import ( + "encoding/json" + "time" +) + +// SecondsEpochTime serializes a time.Time in JSON as a UNIX epoch time in seconds +type SecondsEpochTime struct { + time.Time +} + +// MilliSecondsEpochTime serializes a time.Time in JSON as a UNIX epoch time in milliseconds. +type MilliSecondsEpochTime struct { + time.Time +} + +const secondsToNanoSecondsFactor = 1000000000 +const milliSecondsToNanoSecondsFactor = 1000000 + +func (e SecondsEpochTime) MarshalJSON() ([]byte, error) { + // UnixNano() returns the epoch in nanoseconds + unixTime := float64(e.UnixNano()) / float64(secondsToNanoSecondsFactor) + return json.Marshal(unixTime) +} + +func (e *SecondsEpochTime) UnmarshalJSON(b []byte) error { + var epoch float64 + err := json.Unmarshal(b, &epoch) + if err != nil { + return err + } + + epochSec := int64(epoch) + epochNano := int64((epoch - float64(epochSec)) * float64(secondsToNanoSecondsFactor)) + + // time.Unix(sec, nsec) expects the epoch integral seconds in the first parameter + // and remaining nanoseconds in the second parameter + *e = SecondsEpochTime{time.Unix(epochSec, epochNano)} + return nil +} + +func (e MilliSecondsEpochTime) MarshalJSON() ([]byte, error) { + // UnixNano() returns the epoch in nanoseconds + unixTimeMs := e.UnixNano() / milliSecondsToNanoSecondsFactor + return json.Marshal(unixTimeMs) +} + +func (e *MilliSecondsEpochTime) UnmarshalJSON(b []byte) error { + var epoch int64 + err := json.Unmarshal(b, &epoch) + if err != nil { + return err + } + *e = MilliSecondsEpochTime{time.Unix(epoch/1000, (epoch%1000)*1000000)} + return nil +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/firehose.go b/vendor/github.com/aws/aws-lambda-go/events/firehose.go new file mode 100644 index 000000000000..293974e7c4c5 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/firehose.go @@ -0,0 +1,34 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +// KinesisFirehoseEvent represents the input event from Amazon Kinesis Firehose. It is used as the input parameter. +type KinesisFirehoseEvent struct { + InvocationID string `json:"invocationId"` + DeliveryStreamArn string `json:"deliveryStreamArn"` + Region string `json:"region"` + Records []KinesisFirehoseEventRecord `json:"records"` +} + +type KinesisFirehoseEventRecord struct { + RecordID string `json:"recordId"` + ApproximateArrivalTimestamp MilliSecondsEpochTime `json:"approximateArrivalTimestamp"` + Data []byte `json:"data"` +} + +// Constants used for describing the transformation result +const ( + KinesisFirehoseTransformedStateOk = "Ok" + KinesisFirehoseTransformedStateDropped = "Dropped" + KinesisFirehoseTransformedStateProcessingFailed = "ProcessingFailed" +) + +type KinesisFirehoseResponse struct { + Records []KinesisFirehoseResponseRecord `json:"records"` +} + +type KinesisFirehoseResponseRecord struct { + RecordID string `json:"recordId"` + Result string `json:"result"` // The status of the transformation. May be TransformedStateOk, TransformedStateDropped or TransformedStateProcessingFailed + Data []byte `json:"data"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/kinesis.go b/vendor/github.com/aws/aws-lambda-go/events/kinesis.go new file mode 100644 index 000000000000..2b65d76cb9e2 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/kinesis.go @@ -0,0 +1,27 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type KinesisEvent struct { + Records []KinesisEventRecord `json:"Records"` +} + +type KinesisEventRecord struct { + AwsRegion string `json:"awsRegion"` + EventID string `json:"eventID"` + EventName string `json:"eventName"` + EventSource string `json:"eventSource"` + EventSourceArn string `json:"eventSourceARN"` + EventVersion string `json:"eventVersion"` + InvokeIdentityArn string `json:"invokeIdentityArn"` + Kinesis KinesisRecord `json:"kinesis"` +} + +type KinesisRecord struct { + ApproximateArrivalTimestamp SecondsEpochTime `json:"approximateArrivalTimestamp"` + Data []byte `json:"data"` + EncryptionType string `json:"encryptionType,omitempty"` + PartitionKey string `json:"partitionKey"` + SequenceNumber string `json:"sequenceNumber"` + KinesisSchemaVersion string `json:"kinesisSchemaVersion"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/lex.go b/vendor/github.com/aws/aws-lambda-go/events/lex.go new file mode 100644 index 000000000000..b0f9fd5a7fc1 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/lex.go @@ -0,0 +1,64 @@ +package events + +type LexEvent struct { + MessageVersion string `json:"messageVersion,omitempty"` + InvocationSource string `json:"invocationSource,omitempty"` + UserID string `json:"userId,omitempty"` + InputTranscript string `json:"inputTranscript,omitempty"` + SessionAttributes map[string]string `json:"sessionAttributes,omitempty"` + RequestAttributes map[string]string `json:"requestAttributes,omitempty"` + Bot *LexBot `json:"bot,omitempty"` + OutputDialogMode string `json:"outputDialogMode,omitempty"` + CurrentIntent *LexCurrentIntent `json:"currentIntent,omitempty"` + DialogAction *LexDialogAction `json:"dialogAction,omitempty"` +} + +type LexBot struct { + Name string `json:"name,omitempty"` + Alias string `json:"alias,omitempty"` + Version string `json:"version,omitempty"` +} + +type LexCurrentIntent struct { + Name string `json:"name,omitempty"` + Slots Slots `json:"slots,omitempty"` + SlotDetails map[string]SlotDetail `json:"slotDetails,omitempty"` + ConfirmationStatus string `json:"confirmationStatus,omitempty"` +} + +type SlotDetail struct { + Resolutions []map[string]string `json:"resolutions,omitempty"` + OriginalValue string `json:"originalValue,omitempty"` +} + +type LexDialogAction struct { + Type string `json:"type,omitempty"` + FulfillmentState string `json:"fulfillmentState,omitempty"` + Message map[string]string `json:"message,omitempty"` + IntentName string `json:"intentName,omitempty"` + Slots Slots `json:"slots,omitempty"` + SlotToElicit string `json:"slotToElicit,omitempty"` + ResponseCard *LexResponseCard `json:"responseCard,omitempty"` +} + +type Slots map[string]string + +type LexResponseCard struct { + Version int64 `json:"version,omitempty"` + ContentType string `json:"contentType,omitempty"` + GenericAttachments []Attachment `json:"genericAttachments,omitempty"` +} + +type Attachment struct { + Title string `json:"title,omitempty"` + SubTitle string `json:"subTitle,omitempty"` + ImageURL string `json:"imageUrl,omitempty"` + AttachmentLinkURL string `json:"attachmentLinkUrl,omitempty"` + Buttons []map[string]string `json:"buttons,omitempty"` +} + +func (h *LexEvent) Clear() { + h.Bot = nil + h.CurrentIntent = nil + h.DialogAction = nil +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/s3.go b/vendor/github.com/aws/aws-lambda-go/events/s3.go new file mode 100644 index 000000000000..a0641a3f8cd4 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/s3.go @@ -0,0 +1,53 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +import ( + "time" +) + +type S3Event struct { + Records []S3EventRecord `json:"Records"` +} + +type S3EventRecord struct { + EventVersion string `json:"eventVersion"` + EventSource string `json:"eventSource"` + AWSRegion string `json:"awsRegion"` + EventTime time.Time `json:"eventTime"` + EventName string `json:"eventName"` + PrincipalID S3UserIdentity `json:"userIdentity"` + RequestParameters S3RequestParameters `json:"requestParameters"` + ResponseElements map[string]string `json:"responseElements"` + S3 S3Entity `json:"s3"` +} + +type S3UserIdentity struct { + PrincipalID string `json:"principalId"` +} + +type S3RequestParameters struct { + SourceIPAddress string `json:"sourceIPAddress"` +} + +type S3Entity struct { + SchemaVersion string `json:"s3SchemaVersion"` + ConfigurationID string `json:"configurationId"` + Bucket S3Bucket `json:"bucket"` + Object S3Object `json:"object"` +} + +type S3Bucket struct { + Name string `json:"name"` + OwnerIdentity S3UserIdentity `json:"ownerIdentity"` + Arn string `json:"arn"` +} + +type S3Object struct { + Key string `json:"key"` + Size int64 `json:"size"` + URLDecodedKey string `json:"urlDecodedKey"` + VersionID string `json:"versionId"` + ETag string `json:"eTag"` + Sequencer string `json:"sequencer"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/ses.go b/vendor/github.com/aws/aws-lambda-go/events/ses.go new file mode 100644 index 000000000000..b665ce1e2ac2 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/ses.go @@ -0,0 +1,83 @@ +package events + +import "time" + +// SimpleEmailEvent is the outer structure of an event sent via SES. +type SimpleEmailEvent struct { + Records []SimpleEmailRecord `json:"Records"` +} + +type SimpleEmailRecord struct { + EventVersion string `json:"eventVersion"` + EventSource string `json:"eventSource"` + SES SimpleEmailService `json:"ses"` +} + +type SimpleEmailService struct { + Mail SimpleEmailMessage `json:"mail"` + Receipt SimpleEmailReceipt `json:"receipt"` +} + +type SimpleEmailMessage struct { + CommonHeaders SimpleEmailCommonHeaders `json:"commonHeaders"` + Source string `json:"source"` + Timestamp time.Time `json:"timestamp"` + Destination []string `json:"destination"` + Headers []SimpleEmailHeader `json:"headers"` + HeadersTruncated bool `json:"headersTruncated"` + MessageID string `json:"messageId"` +} + +type SimpleEmailReceipt struct { + Recipients []string `json:"recipients"` + Timestamp time.Time `json:"timestamp"` + SpamVerdict SimpleEmailVerdict `json:"spamVerdict"` + DKIMVerdict SimpleEmailVerdict `json:"dkimVerdict"` + DMARCVerdict SimpleEmailVerdict `json:"dmarcVerdict"` + DMARCPolicy SimpleEmailVerdict `json:"dmarcPolicy"` + SPFVerdict SimpleEmailVerdict `json:"spfVerdict"` + VirusVerdict SimpleEmailVerdict `json:"virusVerdict"` + Action SimpleEmailReceiptAction `json:"action"` + ProcessingTimeMillis int64 `json:"processingTimeMillis"` +} + +type SimpleEmailHeader struct { + Name string `json:"name"` + Value string `json:"value"` +} + +type SimpleEmailCommonHeaders struct { + From []string `json:"from"` + To []string `json:"to"` + ReturnPath string `json:"returnPath"` + MessageID string `json:"messageId"` + Date string `json:"date"` + Subject string `json:"subject"` +} + +type SimpleEmailReceiptAction struct { + Type string `json:"type"` + InvocationType string `json:"invocationType"` + FunctionArn string `json:"functionArn"` +} + +type SimpleEmailVerdict struct { + Status string `json:"status"` +} + +// SimpleEmailDispositionValue enumeration representing the dispostition value for SES +type SimpleEmailDispositionValue string + +const ( + // SimpleEmailContinue represents the CONTINUE disposition which tells the SES Rule Set to continue to the next rule + SimpleEmailContinue SimpleEmailDispositionValue = "CONTINUE" + // SimpleEmailStopRule represents the STOP_RULE disposition which tells the SES Rule Set to stop processing this rule and continue to the next + SimpleEmailStopRule SimpleEmailDispositionValue = "STOP_RULE" + // SimpleEmailStopRuleSet represents the STOP_RULE_SET disposition which tells the SES Rule SEt to stop processing all rules + SimpleEmailStopRuleSet SimpleEmailDispositionValue = "STOP_RULE_SET" +) + +// SimpleEmailDisposition disposition return for SES to control rule functions +type SimpleEmailDisposition struct { + Disposition SimpleEmailDispositionValue `json:"disposition"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/sns.go b/vendor/github.com/aws/aws-lambda-go/events/sns.go new file mode 100644 index 000000000000..9b00bd2e9d31 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/sns.go @@ -0,0 +1,32 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +import ( + "time" +) + +type SNSEvent struct { + Records []SNSEventRecord `json:"Records"` +} + +type SNSEventRecord struct { + EventVersion string `json:"EventVersion"` + EventSubscriptionArn string `json:"EventSubscriptionArn"` + EventSource string `json:"EventSource"` + SNS SNSEntity `json:"Sns"` +} + +type SNSEntity struct { + Signature string `json:"Signature"` + MessageID string `json:"MessageId"` + Type string `json:"Type"` + TopicArn string `json:"TopicArn"` + MessageAttributes map[string]interface{} `json:"MessageAttributes"` + SignatureVersion string `json:"SignatureVersion"` + Timestamp time.Time `json:"Timestamp"` + SigningCertURL string `json:"SigningCertUrl"` + Message string `json:"Message"` + UnsubscribeURL string `json:"UnsubscribeUrl"` + Subject string `json:"Subject"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/events/sqs.go b/vendor/github.com/aws/aws-lambda-go/events/sqs.go new file mode 100644 index 000000000000..ea1bf7bef918 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/events/sqs.go @@ -0,0 +1,28 @@ +// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package events + +type SQSEvent struct { + Records []SQSMessage `json:"Records"` +} + +type SQSMessage struct { + MessageId string `json:"messageId"` + ReceiptHandle string `json:"receiptHandle"` + Body string `json:"body"` + Md5OfBody string `json:"md5OfBody"` + Md5OfMessageAttributes string `json:"md5OfMessageAttributes"` + Attributes map[string]string `json:"attributes"` + MessageAttributes map[string]SQSMessageAttribute `json:"messageAttributes"` + EventSourceARN string `json:"eventSourceARN"` + EventSource string `json:"eventSource"` + AWSRegion string `json:"awsRegion"` +} + +type SQSMessageAttribute struct { + StringValue *string `json:"stringValue,omitempty"` + BinaryValue []byte `json:"binaryValue,omitempty"` + StringListValues []string `json:"stringListValues"` + BinaryListValues [][]byte `json:"binaryListValues"` + DataType string `json:"dataType"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/README.md b/vendor/github.com/aws/aws-lambda-go/lambda/README.md new file mode 100644 index 000000000000..76f8679b995f --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/README.md @@ -0,0 +1,3 @@ +# Overview + +[![GoDoc](https://godoc.org/github.com/aws/aws-lambda-go/lambda?status.svg)](https://godoc.org/github.com/aws/aws-lambda-go/lambda) diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/entry.go b/vendor/github.com/aws/aws-lambda-go/lambda/entry.go new file mode 100644 index 000000000000..9db9883e2482 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/entry.go @@ -0,0 +1,64 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package lambda + +import ( + "log" + "net" + "net/rpc" + "os" +) + +// Start takes a handler and talks to an internal Lambda endpoint to pass requests to the handler. If the +// handler does not match one of the supported types an appropriate error message will be returned to the caller. +// Start blocks, and does not return after being called. +// +// Rules: +// +// * handler must be a function +// * handler may take between 0 and two arguments. +// * if there are two arguments, the first argument must satisfy the "context.Context" interface. +// * handler may return between 0 and two arguments. +// * if there are two return values, the second argument must be an error. +// * if there is one return value it must be an error. +// +// Valid function signatures: +// +// func () +// func () error +// func (TIn) error +// func () (TOut, error) +// func (TIn) (TOut, error) +// func (context.Context) error +// func (context.Context, TIn) error +// func (context.Context) (TOut, error) +// func (context.Context, TIn) (TOut, error) +// +// Where "TIn" and "TOut" are types compatible with the "encoding/json" standard library. +// See https://golang.org/pkg/encoding/json/#Unmarshal for how deserialization behaves +func Start(handler interface{}) { + wrappedHandler := newHandler(handler) + StartHandler(wrappedHandler) +} + +// StartHandler takes in a Handler wrapper interface which can be implemented either by a +// custom function or a struct. +// +// Handler implementation requires a single "Invoke()" function: +// +// func Invoke(context.Context, []byte) ([]byte, error) +func StartHandler(handler Handler) { + port := os.Getenv("_LAMBDA_SERVER_PORT") + lis, err := net.Listen("tcp", "localhost:"+port) + if err != nil { + log.Fatal(err) + } + function := new(Function) + function.handler = handler + err = rpc.Register(function) + if err != nil { + log.Fatal("failed to register handler function") + } + rpc.Accept(lis) + log.Fatal("accept should not have returned") +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/function.go b/vendor/github.com/aws/aws-lambda-go/lambda/function.go new file mode 100644 index 000000000000..6a2e33732081 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/function.go @@ -0,0 +1,87 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package lambda + +import ( + "context" + "encoding/json" + "reflect" + "time" + + "github.com/aws/aws-lambda-go/lambda/messages" + "github.com/aws/aws-lambda-go/lambdacontext" +) + +type Function struct { + handler Handler +} + +func (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error { + *response = messages.PingResponse{} + return nil +} + +func (fn *Function) Invoke(req *messages.InvokeRequest, response *messages.InvokeResponse) error { + defer func() { + if err := recover(); err != nil { + panicInfo := getPanicInfo(err) + response.Error = &messages.InvokeResponse_Error{ + Message: panicInfo.Message, + Type: getErrorType(err), + StackTrace: panicInfo.StackTrace, + ShouldExit: true, + } + } + }() + + deadline := time.Unix(req.Deadline.Seconds, req.Deadline.Nanos).UTC() + invokeContext, cancel := context.WithDeadline(context.Background(), deadline) + defer cancel() + + lc := &lambdacontext.LambdaContext{ + AwsRequestID: req.RequestId, + InvokedFunctionArn: req.InvokedFunctionArn, + Identity: lambdacontext.CognitoIdentity{ + CognitoIdentityID: req.CognitoIdentityId, + CognitoIdentityPoolID: req.CognitoIdentityPoolId, + }, + } + if len(req.ClientContext) > 0 { + if err := json.Unmarshal(req.ClientContext, &lc.ClientContext); err != nil { + response.Error = lambdaErrorResponse(err) + return nil + } + } + invokeContext = lambdacontext.NewContext(invokeContext, lc) + + invokeContext = context.WithValue(invokeContext, "x-amzn-trace-id", req.XAmznTraceId) + + payload, err := fn.handler.Invoke(invokeContext, req.Payload) + if err != nil { + response.Error = lambdaErrorResponse(err) + return nil + } + response.Payload = payload + return nil +} + +func getErrorType(err interface{}) string { + errorType := reflect.TypeOf(err) + if errorType.Kind() == reflect.Ptr { + return errorType.Elem().Name() + } + return errorType.Name() +} + +func lambdaErrorResponse(invokeError error) *messages.InvokeResponse_Error { + var errorName string + if errorType := reflect.TypeOf(invokeError); errorType.Kind() == reflect.Ptr { + errorName = errorType.Elem().Name() + } else { + errorName = errorType.Name() + } + return &messages.InvokeResponse_Error{ + Message: invokeError.Error(), + Type: errorName, + } +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/handler.go b/vendor/github.com/aws/aws-lambda-go/lambda/handler.go new file mode 100644 index 000000000000..bb487f02337b --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/handler.go @@ -0,0 +1,127 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package lambda + +import ( + "context" + "encoding/json" + "fmt" + "reflect" +) + +type Handler interface { + Invoke(ctx context.Context, payload []byte) ([]byte, error) +} + +// lambdaHandler is the generic function type +type lambdaHandler func(context.Context, []byte) (interface{}, error) + +// Invoke calls the handler, and serializes the response. +// If the underlying handler returned an error, or an error occurs during serialization, error is returned. +func (handler lambdaHandler) Invoke(ctx context.Context, payload []byte) ([]byte, error) { + response, err := handler(ctx, payload) + if err != nil { + return nil, err + } + + responseBytes, err := json.Marshal(response) + if err != nil { + return nil, err + } + + return responseBytes, nil +} + +func errorHandler(e error) lambdaHandler { + return func(ctx context.Context, event []byte) (interface{}, error) { + return nil, e + } +} + +func validateArguments(handler reflect.Type) (bool, error) { + handlerTakesContext := false + if handler.NumIn() > 2 { + return false, fmt.Errorf("handlers may not take more than two arguments, but handler takes %d", handler.NumIn()) + } else if handler.NumIn() > 0 { + contextType := reflect.TypeOf((*context.Context)(nil)).Elem() + argumentType := handler.In(0) + handlerTakesContext = argumentType.Implements(contextType) + if handler.NumIn() > 1 && !handlerTakesContext { + return false, fmt.Errorf("handler takes two arguments, but the first is not Context. got %s", argumentType.Kind()) + } + } + + return handlerTakesContext, nil +} + +func validateReturns(handler reflect.Type) error { + errorType := reflect.TypeOf((*error)(nil)).Elem() + if handler.NumOut() > 2 { + return fmt.Errorf("handler may not return more than two values") + } else if handler.NumOut() > 1 { + if !handler.Out(1).Implements(errorType) { + return fmt.Errorf("handler returns two values, but the second does not implement error") + } + } else if handler.NumOut() == 1 { + if !handler.Out(0).Implements(errorType) { + return fmt.Errorf("handler returns a single value, but it does not implement error") + } + } + return nil +} + +// newHandler Creates the base lambda handler, which will do basic payload unmarshaling before defering to handlerSymbol. +// If handlerSymbol is not a valid handler, the returned function will be a handler that just reports the validation error. +func newHandler(handlerSymbol interface{}) lambdaHandler { + if handlerSymbol == nil { + return errorHandler(fmt.Errorf("handler is nil")) + } + handler := reflect.ValueOf(handlerSymbol) + handlerType := reflect.TypeOf(handlerSymbol) + if handlerType.Kind() != reflect.Func { + return errorHandler(fmt.Errorf("handler kind %s is not %s", handlerType.Kind(), reflect.Func)) + } + + takesContext, err := validateArguments(handlerType) + if err != nil { + return errorHandler(err) + } + + if err := validateReturns(handlerType); err != nil { + return errorHandler(err) + } + + return func(ctx context.Context, payload []byte) (interface{}, error) { + // construct arguments + var args []reflect.Value + if takesContext { + args = append(args, reflect.ValueOf(ctx)) + } + if (handlerType.NumIn() == 1 && !takesContext) || handlerType.NumIn() == 2 { + eventType := handlerType.In(handlerType.NumIn() - 1) + event := reflect.New(eventType) + + if err := json.Unmarshal(payload, event.Interface()); err != nil { + return nil, err + } + + args = append(args, event.Elem()) + } + + response := handler.Call(args) + + // convert return values into (interface{}, error) + var err error + if len(response) > 0 { + if errVal, ok := response[len(response)-1].Interface().(error); ok { + err = errVal + } + } + var val interface{} + if len(response) > 1 { + val = response[0].Interface() + } + + return val, err + } +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/messages/README.md b/vendor/github.com/aws/aws-lambda-go/lambda/messages/README.md new file mode 100644 index 000000000000..8bf6ef4b8590 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/messages/README.md @@ -0,0 +1,3 @@ +# Overview + +[![GoDoc](https://godoc.org/github.com/aws/aws-lambda-go/lambda/messages?status.svg)](https://godoc.org/github.com/aws/aws-lambda-go/lambda/messages) diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/messages/messages.go b/vendor/github.com/aws/aws-lambda-go/lambda/messages/messages.go new file mode 100644 index 000000000000..d2ac65b76a68 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/messages/messages.go @@ -0,0 +1,43 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package messages + +type PingRequest struct { +} + +type PingResponse struct { +} + +type InvokeRequest_Timestamp struct { + Seconds int64 + Nanos int64 +} + +type InvokeRequest struct { + Payload []byte + RequestId string + XAmznTraceId string + Deadline InvokeRequest_Timestamp + InvokedFunctionArn string + CognitoIdentityId string + CognitoIdentityPoolId string + ClientContext []byte +} + +type InvokeResponse struct { + Payload []byte + Error *InvokeResponse_Error +} + +type InvokeResponse_Error struct { + Message string + Type string + StackTrace []*InvokeResponse_Error_StackFrame + ShouldExit bool +} + +type InvokeResponse_Error_StackFrame struct { + Path string `json:"path"` + Line int32 `json:"line"` + Label string `json:"label"` +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambda/panic.go b/vendor/github.com/aws/aws-lambda-go/lambda/panic.go new file mode 100644 index 000000000000..013d3abde5cd --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambda/panic.go @@ -0,0 +1,99 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package lambda + +import ( + "fmt" + "runtime" + "strings" + + "github.com/aws/aws-lambda-go/lambda/messages" +) + +type panicInfo struct { + Message string // Value passed to panic call, converted to string + StackTrace []*messages.InvokeResponse_Error_StackFrame // Stack trace of the panic +} + +func getPanicInfo(value interface{}) panicInfo { + message := getPanicMessage(value) + stack := getPanicStack() + + return panicInfo{Message: message, StackTrace: stack} +} + +func getPanicMessage(value interface{}) string { + return fmt.Sprintf("%v", value) +} + +var defaultErrorFrameCount = 32 + +func getPanicStack() []*messages.InvokeResponse_Error_StackFrame { + s := make([]uintptr, defaultErrorFrameCount) + const framesToHide = 3 // this (getPanicStack) -> getPanicInfo -> handler defer func + n := runtime.Callers(framesToHide, s) + if n == 0 { + return make([]*messages.InvokeResponse_Error_StackFrame, 0) + } + + s = s[:n] + + return convertStack(s) +} + +func convertStack(s []uintptr) []*messages.InvokeResponse_Error_StackFrame { + var converted []*messages.InvokeResponse_Error_StackFrame + frames := runtime.CallersFrames(s) + + for { + frame, more := frames.Next() + + formattedFrame := formatFrame(frame) + converted = append(converted, formattedFrame) + + if !more { + break + } + } + return converted +} + +func formatFrame(inputFrame runtime.Frame) *messages.InvokeResponse_Error_StackFrame { + path := inputFrame.File + line := int32(inputFrame.Line) + label := inputFrame.Function + + // Strip GOPATH from path by counting the number of seperators in label & path + // + // For example given this: + // GOPATH = /home/user + // path = /home/user/src/pkg/sub/file.go + // label = pkg/sub.Type.Method + // + // We want to set: + // path = pkg/sub/file.go + // label = Type.Method + + i := len(path) + for n, g := 0, strings.Count(label, "/")+2; n < g; n++ { + i = strings.LastIndex(path[:i], "/") + if i == -1 { + // Something went wrong and path has less seperators than we expected + // Abort and leave i as -1 to counteract the +1 below + break + } + } + + path = path[i+1:] // Trim the initial / + + // Strip the path from the function name as it's already in the path + label = label[strings.LastIndex(label, "/")+1:] + // Likewise strip the package name + label = label[strings.Index(label, ".")+1:] + + return &messages.InvokeResponse_Error_StackFrame{ + Path: path, + Line: line, + Label: label, + } +} diff --git a/vendor/github.com/aws/aws-lambda-go/lambdacontext/README.md b/vendor/github.com/aws/aws-lambda-go/lambdacontext/README.md new file mode 100644 index 000000000000..44d648a5e589 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambdacontext/README.md @@ -0,0 +1,3 @@ +# Overview + +[![GoDoc](https://godoc.org/github.com/aws/aws-lambda-go/lambdacontext?status.svg)](https://godoc.org/github.com/aws/aws-lambda-go/lambdacontext) diff --git a/vendor/github.com/aws/aws-lambda-go/lambdacontext/context.go b/vendor/github.com/aws/aws-lambda-go/lambdacontext/context.go new file mode 100644 index 000000000000..3593c4409b62 --- /dev/null +++ b/vendor/github.com/aws/aws-lambda-go/lambdacontext/context.go @@ -0,0 +1,89 @@ +// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// +// Helpers for accessing context information from an Invoke request. Context information +// is stored in a https://golang.org/pkg/context/#Context. The functions FromContext and NewContext +// are used to retrieving and inserting an isntance of LambdaContext. + +package lambdacontext + +import ( + "context" + "os" + "strconv" +) + +// LogGroupName is the name of the log group that contains the log streams of the current Lambda Function +var LogGroupName string + +// LogStreamName name of the log stream that the current Lambda Function's logs will be sent to +var LogStreamName string + +// FunctionName the name of the current Lambda Function +var FunctionName string + +// MemoryLimitInMB is the configured memory limit for the current instance of the Lambda Function +var MemoryLimitInMB int + +// FunctionVersion is the published version of the current instance of the Lambda Function +var FunctionVersion string + +func init() { + LogGroupName = os.Getenv("AWS_LAMBDA_LOG_GROUP_NAME") + LogStreamName = os.Getenv("AWS_LAMBDA_LOG_STREAM_NAME") + FunctionName = os.Getenv("AWS_LAMBDA_FUNCTION_NAME") + if limit, err := strconv.Atoi(os.Getenv("AWS_LAMBDA_FUNCTION_MEMORY_SIZE")); err != nil { + MemoryLimitInMB = 0 + } else { + MemoryLimitInMB = limit + } + FunctionVersion = os.Getenv("AWS_LAMBDA_FUNCTION_VERSION") +} + +// ClientApplication is metadata about the calling application. +type ClientApplication struct { + InstallationID string `json:"installation_id"` + AppTitle string `json:"app_title"` + AppVersionCode string `json:"app_version_code"` + AppPackageName string `json:"app_package_name"` +} + +// ClientContext is information about the client application passed by the calling application. +type ClientContext struct { + Client ClientApplication + Env map[string]string `json:"env"` + Custom map[string]string `json:"custom"` +} + +// CognitoIdentity is the cognito identity used by the calling application. +type CognitoIdentity struct { + CognitoIdentityID string + CognitoIdentityPoolID string +} + +// LambdaContext is the set of metadata that is passed for every Invoke. +type LambdaContext struct { + AwsRequestID string + InvokedFunctionArn string + Identity CognitoIdentity + ClientContext ClientContext +} + +// An unexported type to be used as the key for types in this package. +// This prevents collisions with keys defined in other packages. +type key struct{} + +// The key for a LambdaContext in Contexts. +// Users of this package must use lambdacontext.NewContext and lambdacontext.FromContext +// instead of using this key directly. +var contextKey = &key{} + +// NewContext returns a new Context that carries value lc. +func NewContext(parent context.Context, lc *LambdaContext) context.Context { + return context.WithValue(parent, contextKey, lc) +} + +// FromContext returns the LambdaContext value stored in ctx, if any. +func FromContext(ctx context.Context) (*LambdaContext, bool) { + lc, ok := ctx.Value(contextKey).(*LambdaContext) + return lc, ok +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md new file mode 100644 index 000000000000..95658724237e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG.md @@ -0,0 +1,211 @@ +Release v2.0.0-preview.5 (2018-09-19) +=== + +### Services +* Synced the V2 SDK with latests AWS service API definitions. + +### SDK Bugs +* Fix SDK Go 1.11 connection reset handling (#207) + * Fixes how the SDK checks for connection reset errors when making API calls to be compatiable with Go 1.11. +* `aws/signer/v4`: Fix X-Amz-Content-Sha256 being in to query for presign (#188) + * Fixes the bug which would allow the X-Amz-Content-Sha256 header to be promoted to the query string when presigning a S3 request. This bug also was preventing users from setting their own sha256 value for a presigned URL. Presigned requests generated with the custom sha256 would of always failed with invalid signature. + * Related to aws/aws-sdk-go#1974 + +### SDK Enhancements +* Cleanup SDK README and example documenation. +* `service/s3/s3manager`: Add doc for sequential download (#201) + Adds documentation for downloading object sequentially with the S3 download manager. +* `aws/credentials`: Update Credentials cache to have less overhead (#184) + * Updates the Credentials type's cache of the CredentialsValue to be synchronized with an atomic value in addition to the Mutex. This reduces the overhead applications will encounter when many concurrent API requests are being made. + * Related to: aws/aws-sdk-go#1973 +* `service/dynamodb/dynamodbattribute`: Add support for custom struct tag keys (#203) + * Adds support for (un)marshaling Go types using custom struct tag keys. The new `MarshalOptions.TagKey` allows the user to specify the tag key to use when (un)marshaling struct fields. Adds support for struct tags such as `yaml`, `toml`, etc. Support for these keys are in name only, and require the tag value format and values to be supported by the package's Marshalers. +* `internal/ini`: Add custom INI parser for shared config/credentials file (#209) + * Related to: aws/aws-sdk-go#2024 + +Release v2.0.0-preview.4 (2018-05-25) +=== + +### Services +* Synced the V2 SDK with latests AWS service API definitions. + +### SDK Bugs +* `private/protocol/xml/xmlutil`: Fix XML unmarshaler not correctly unmarshaling list of timestamp values ([#166](https://github.com/aws/aws-sdk-go-v2/pull/166)) + * Fixes a bug in the XML unmarshaler that would incorrectly try to unmarshal "time.Time" parameters that did not have the struct tag type on them. + * Related to [aws/aws-sdk-go#1894](https://github.com/aws/aws-sdk-go/pull/1894) +* `service/s3`: Fix typos for migrated S3 specific config options ([#173](https://github.com/aws/aws-sdk-go-v2/pull/173)) + * Updates the S3 specific config error messages to the correct fields. +* `aws/endpoints`: Fix SDK endpoint signing name resolution ([#181](https://github.com/aws/aws-sdk-go-v2/pull/181)) + * Fixes how the SDK derives service signing names. If the signing name is not modeled in the endpoints package the service will fallback to the signing name modeled in the service model. + * Fix [#163](https://github.com/aws/aws-sdk-go-v2/pull/163) + * Fix [#153](https://github.com/aws/aws-sdk-go-v2/pull/153) + * Related to [aws/aws-sdk-go#1854](https://github.com/aws/aws-sdk-go/pull/1854) +* `service/s3`: remove SelectContent until EventStream supported ([#175](https://github.com/aws/aws-sdk-go-v2/pull/175]) + * S3's SelectContent API is not functional in the SDK yet, and was not supposed to be generated until EventStream support is available. + * Related to [aws/aws-sdk-go#1941](https://github.com/aws/aws-sdk-go/pull/1941) + +### SDK Enhancements +* `service/s3/s3manager/s3manageriface`: Add WithIterator to mock interface ([#156](https://github.com/aws/aws-sdk-go-v2/pull/156)) + * Updates the `DownloaderAPI` and `UploaderAPI` mocking interfaces to have parity with the concrete types. + * Fixes [#155](https://github.com/aws/aws-sdk-go-v2/issues/155) + + +Release v2.0.0-preview.3 (2018-03-08) +=== + +### Services +* Synced the V2 SDK with latests AWS service API definitions. + +### Breaking Changes +* `private/mode/api`: Refactor service paginator helpers to iterator pattern ([#119](https://github.com/aws/aws-sdk-go-v2/pull/119)) + * Refactors the generated service client paginators to be an iterator pattern. This pattern improves usability while removing the need for callbacks. + * See the linked PR for an example. +* `private/model/api`: Removes setter helpers from service API types ([#101](https://github.com/aws/aws-sdk-go-v2/pull/101)) + * Removes the setter helper methods from service API types. Removing clutter and noise from the API type's signature. + * Based on feedback [#81][https://github.com/aws/aws-sdk-go-v2/issues/81] +* `aws`: Rename CanceledErrorCode to ErrCodeRequestCanceled ([#131](https://github.com/aws/aws-sdk-go-v2/pull/131)) + * Renames CanceledErrorCode to correct naming scheme. + +### SDK Bugs +* `internal/awsutil`: Fix DeepEqual to consider string alias type equal to string ([#102](https://github.com/aws/aws-sdk-go-v2/pull/102)) + * Fixes SDK waiters not detecting the correct condition is met. [#92](https://github.com/aws/aws-sdk-go-v2/issues/92) +* `aws/external`: Fix EnvConfig misspelled container endpoint path getter ([#106](https://github.com/aws/aws-sdk-go-v2/pull/106)) + * This caused the type to not satisfy the ContainerCredentialsEndpointPathProvider interface. + * Fixes [#105](https://github.com/aws/aws-sdk-go-v2/issues/105) +* `service/s3/s3crypto`: Fix S3Crypto's handling of TagLen ([#107](https://github.com/aws/aws-sdk-go-v2/pull/107)) + * Fixes the S3Crypto's handling of TagLen to only be set if present. + * V2 Fix for [aws/aws-sdk-go#1742](https://github.com/aws/aws-sdk-go/issues/1742) +* `private/model/api`: Update SDK service client initialization documentation ([#141](https://github.com/aws/aws-sdk-go-v2/pull/141)) + * Updates the SDK's service initialization doc template to reflect the v2 SDK's configuration update change from v1. + * Related to [#136](https://github.com/aws/aws-sdk-go-v2/issues/136) + +### SDK Enhancements +* `aws`: Improve pagination unit tests ([#97](https://github.com/aws/aws-sdk-go-v2/pull/97)) + * V2 port of [aws/aws-sdk-go#1733](https://github.com/aws/aws-sdk-go/pull/1733) +* `aws/external`: Add example for shared config and static credential helper ([#109](https://github.com/aws/aws-sdk-go-v2/pull/109)) + * Adds examples for the config helpers; WithSharedConfigProfile, WithCredentialsValue, WithMFATokenFunc. +* `private/model/api`: Add validation to prevent collision of api defintions ([#112](https://github.com/aws/aws-sdk-go-v2/pull/112)) + * V2 port of [aws/aws-sdk-go#1758](https://github.com/aws/aws-sdk-go/pull/1758) +* `aws/ec2metadata`: Add support for AWS_EC2_METADATA_DISABLED env var ([#128](https://github.com/aws/aws-sdk-go-v2/pull/128)) + * When this environment variable is set. The SDK's EC2 Metadata Client will not attempt to make requests. All requests made with the EC2 Metadata Client will fail. + * V2 port of [aws/aws-sdk-go#1799](https://github.com/aws/aws-sdk-go/pull/1799) +* Add code of conduct ([#138](https://github.com/aws/aws-sdk-go-v2/pull/138)) +* Update SDK README dep usage ([#140](https://github.com/aws/aws-sdk-go-v2/pull/140)) + +Release v2.0.0-preview.2 (2018-01-15) +=== + +### Services +* Synced the V2 SDK with latests AWS service API definitions. + +### SDK Bugs +* `service/s3/s3manager`: Fix Upload Manger's UploadInput fields ([#89](https://github.com/aws/aws-sdk-go-v2/pull/89)) + * Fixes [#88](https://github.com/aws/aws-sdk-go-v2/issues/88) +* `aws`: Fix Pagination handling of empty string NextToken ([#94](https://github.com/aws/aws-sdk-go-v2/pull/94)) + * Fixes [#84](https://github.com/aws/aws-sdk-go-v2/issues/84) + + +Release v2.0.0-preview.1 (2017-12-21) +=== + +## What has changed? + +Our focus for the 2.0 SDK is to improve the SDK’s development experience and performance, make the SDK easy to extend, and add new features. The changes made in the Developer Preview target the major pain points of configuring the SDK and using AWS service API calls. Check out the SDK for details on pending changes that are in development and designs we’re discussing. + +The following are some of the larger changes included in the AWS SDK for Go 2.0 Developer Preview. + +### SDK configuration + +The 2.0 SDK simplifies how you configure the SDK's service clients by using a single `Config` type. This simplifies the `Session` and `Config` type interaction from the 1.x SDK. In addition, we’ve moved the service-specific configuration flags to the individual service client types. This reduces confusion about where service clients will use configuration members. + +We added the external package to provide the utilities for you to use external configuration sources to populate the SDK's `Config` type. External sources include environmental variables, shared credentials file (`~/.aws/credentials`), and shared config file (`~/.aws/config`). By default, the 2.0 SDK will now automatically load configuration values from the shared config file. The external package also provides you with the tools to customize how the external sources are loaded and used to populate the `Config` type. + +You can even customize external configuration sources to include your own custom sources, for example, JSON files or a custom file format. + +Use `LoadDefaultAWSConfig` in the external package to create the default `Config` value, and load configuration values from the external configuration sources. + +```go +cfg, err := external.LoadDefaultAWSConfig() +``` + +To specify the shared configuration profile load used in code, use the `WithSharedConfigProfile` helper passed into `LoadDefaultAWSConfig` with the profile name to use. + +```go +cfg, err := external.LoadDefaultAWSConfig( + external.WithSharedConfigProfile("gopher") +) +``` + +Once a `Config` value is returned by `LoadDefaultAWSConfig`, you can set or override configuration values by setting the fields on the `Config` struct, such as `Region`. + +```go +cfg.Region = endpoints.UsWest2RegionID +``` + +Use the `cfg` value to provide the loaded configuration to new AWS service clients. + +```go +svc := dynamodb.New(cfg) +``` + +### API request methods + +The 2.0 SDK consolidates several ways to make an API call, providing a single request constructor for each API call. This means that your application will create an API request from input parameters, then send it. This enables you to optionally modify and configure how the request will be sent. This includes, but isn’t limited to, modifications such as setting the `Context` per request, adding request handlers, and enabling logging. + +Each API request method is suffixed with `Request` and returns a typed value for the specific API request. + +As an example, to use the Amazon Simple Storage Service GetObject API, the signature of the method is: + +```go +func (c *S3) GetObjectRequest(*s3.GetObjectInput) *s3.GetObjectRequest +``` + +To use the GetObject API, we pass in the input parameters to the method, just like we would with the 1.x SDK. The 2.0 SDK's method will initialize a `GetObjectRequest` value that we can then use to send our request to Amazon S3. + +```go +req := svc.GetObjectRequest(params) + +// Optionally, set the context or other configuration for the request to use +req.SetContext(ctx) + +// Send the request and get the response +resp, err := req.Send() +``` + +### API enumerations + +The 2.0 SDK uses typed enumeration values for all API enumeration fields. This change provides you with the type safety that you and your IDE can leverage to discover which enumeration values are valid for particular fields. Typed enumeration values also provide a stronger type safety story for your application than using string literals directly. The 2.0 SDK uses string aliases for each enumeration type. The SDK also generates typed constants for each enumeration value. This change removes the need for enumeration API fields to be pointers, as a zero-value enumeration always means the field isn’t set. + +For example, the Amazon Simple Storage Service PutObject API has a field, `ACL ObjectCannedACL`. An `ObjectCannedACL` string alias is defined within the s3 package, and each enumeration value is also defined as a typed constant. In this example, we want to use the typed enumeration values to set an uploaded object to have an ACL of `public-read`. The constant that the SDK provides for this enumeration value is `ObjectCannedACLPublicRead`. + +```go +svc.PutObjectRequest(&s3.PutObjectInput{ + Bucket: aws.String("myBucket"), + Key: aws.String("myKey"), + ACL: s3.ObjectCannedACLPublicRead, + Body: body, +}) +``` + +### API slice and map elements + +The 2.0 SDK removes the need to convert slice and map elements from values to pointers for API calls. This will reduce the overhead of needing to use fields with a type, such as `[]string`, in API calls. The 1.x SDK's pattern of using pointer types for all slice and map elements was a significant pain point for users, requiring them to convert between the types. The 2.0 SDK does away with the pointer types for slices and maps, using value types instead. + +The following example shows how value types for the Amazon Simple Queue Service AddPermission API's `AWSAccountIds` and `Actions` member slices are set. + +```go +svc := sqs.New(cfg) + +svc.AddPermission(&sqs.AddPermissionInput{ + AWSAcountIds: []string{ + "123456789", + }, + Actions: []string{ + "SendMessage", + }, + + Label: aws.String("MessageSender"), + QueueUrl: aws.String(queueURL) +}) +``` + diff --git a/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG_PENDING.md b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG_PENDING.md new file mode 100644 index 000000000000..8a1927a39ca5 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/CHANGELOG_PENDING.md @@ -0,0 +1,5 @@ +### SDK Features + +### SDK Enhancements + +### SDK Bugs diff --git a/vendor/github.com/aws/aws-sdk-go-v2/CODE_OF_CONDUCT.md b/vendor/github.com/aws/aws-sdk-go-v2/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..3b64466870c9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/CODE_OF_CONDUCT.md @@ -0,0 +1,4 @@ +## Code of Conduct +This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). +For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact +opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/CONTRIBUTING.md b/vendor/github.com/aws/aws-sdk-go-v2/CONTRIBUTING.md new file mode 100644 index 000000000000..6f422a95edbb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/CONTRIBUTING.md @@ -0,0 +1,127 @@ +Contributing to the AWS SDK for Go + +We work hard to provide a high-quality and useful SDK, and we greatly value +feedback and contributions from our community. Whether it's a bug report, +new feature, correction, or additional documentation, we welcome your issues +and pull requests. Please read through this document before submitting any +issues or pull requests to ensure we have all the necessary information to +effectively respond to your bug report or contribution. + + +## Filing Bug Reports + +You can file bug reports against the SDK on the [GitHub issues][issues] page. + +If you are filing a report for a bug or regression in the SDK, it's extremely +helpful to provide as much information as possible when opening the original +issue. This helps us reproduce and investigate the possible bug without having +to wait for this extra information to be provided. Please read the following +guidelines prior to filing a bug report. + +1. Search through existing [issues][] to ensure that your specific issue has + not yet been reported. If it is a common issue, it is likely there is + already a bug report for your problem. + +2. Ensure that you have tested the latest version of the SDK. Although you + may have an issue against an older version of the SDK, we cannot provide + bug fixes for old versions. It's also possible that the bug may have been + fixed in the latest release. + +3. Provide as much information about your environment, SDK version, and + relevant dependencies as possible. For example, let us know what version + of Go you are using, which and version of the operating system, and the + the environment your code is running in. e.g Container. + +4. Provide a minimal test case that reproduces your issue or any error + information you related to your problem. We can provide feedback much + more quickly if we know what operations you are calling in the SDK. If + you cannot provide a full test case, provide as much code as you can + to help us diagnose the problem. Any relevant information should be provided + as well, like whether this is a persistent issue, or if it only occurs + some of the time. + + +## Submitting Pull Requests + +We are always happy to receive code and documentation contributions to the SDK. +Please be aware of the following notes prior to opening a pull request: + +1. The SDK is released under the [Apache license][license]. Any code you submit + will be released under that license. For substantial contributions, we may + ask you to sign a [Contributor License Agreement (CLA)][cla]. + +2. If you would like to implement support for a significant feature that is not + yet available in the SDK, please talk to us beforehand to avoid any + duplication of effort. + +3. Wherever possible, pull requests should contain tests as appropriate. + Bugfixes should contain tests that exercise the corrected behavior (i.e., the + test should fail without the bugfix and pass with it), and new features + should be accompanied by tests exercising the feature. + +4. Pull requests that contain failing tests will not be merged until the test + failures are addressed. Pull requests that cause a significant drop in the + SDK's test coverage percentage are unlikely to be merged until tests have + been added. + +5. The JSON files under the SDK's `models` folder are sourced from outside the SDK. + Such as `models/apis/ec2/2016-11-15/api.json`. We will not accept pull requests + directly on these models. If you discover an issue with the models please + create a [GitHub issue][issues] describing the issue. + +### Testing + +To run the tests locally, running the `make unit` command will `go get` the +SDK's testing dependencies, and run vet, link and unit tests for the SDK. + +``` +make unit +``` + +Standard go testing functionality is supported as well. To test SDK code that +is tagged with `codegen` you'll need to set the build tag in the go test +command. The `make unit` command will do this automatically. + +``` +go test -tags codegen ./private/... +``` + +See the `Makefile` for additional testing tags that can be used in testing. + +To test on multiple platform the SDK includes several DockerFiles under the +`awstesting/sandbox` folder, and associated make recipes to to execute +unit testing within environments configured for specific Go versions. + +``` +make sandbox-test-go18 +``` + +To run all sandbox environments use the following make recipe + +``` +# Optionally update the Go tip that will be used during the batch testing +make update-aws-golang-tip + +# Run all SDK tests for supported Go versions in sandboxes +make sandbox-test +``` + +In addition the sandbox environment include make recipes for interactive modes +so you can run command within the Docker container and context of the SDK. + +``` +make sandbox-go18 +``` + +### Changelog + +You can see all release changes in the `CHANGELOG.md` file at the root of the +repository. The release notes added to this file will contain service client +updates, and major SDK changes. + +[issues]: https://github.com/aws/aws-sdk-go/issues +[pr]: https://github.com/aws/aws-sdk-go/pulls +[license]: http://aws.amazon.com/apache2.0/ +[cla]: http://en.wikipedia.org/wiki/Contributor_License_Agreement +[releasenotes]: https://github.com/aws/aws-sdk-go/releases + diff --git a/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.lock b/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.lock new file mode 100644 index 000000000000..854c94fdf049 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.lock @@ -0,0 +1,20 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/go-ini/ini" + packages = ["."] + revision = "300e940a926eb277d3901b20bdfcc54928ad3642" + version = "v1.25.4" + +[[projects]] + name = "github.com/jmespath/go-jmespath" + packages = ["."] + revision = "0b12d6b5" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "51a86a867df617990082dec6b868e4efe2fdb2ed0e02a3daa93cd30f962b5085" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.toml b/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.toml new file mode 100644 index 000000000000..3981e1694062 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/Gopkg.toml @@ -0,0 +1,44 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + +ignored = [ + # Testing/Example/Codegen dependencies + "github.com/stretchr/testify", + "github.com/stretchr/testify/assert", + "github.com/stretchr/testify/require", + "github.com/go-sql-driver/mysql", + "github.com/gucumber/gucumber", + "github.com/pkg/errors", + "golang.org/x/net", + "golang.org/x/net/html", + "golang.org/x/net/http2", + "golang.org/x/text", + "golang.org/x/text/html", + "golang.org/x/tools", + "golang.org/x/tools/go/loader", +] + + +[[constraint]] + name = "github.com/jmespath/go-jmespath" + revision = "0b12d6b5" + #version = "0.2.2" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go-v2/LICENSE.txt new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/Makefile b/vendor/github.com/aws/aws-sdk-go-v2/Makefile new file mode 100644 index 000000000000..ce4ed511cbd2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/Makefile @@ -0,0 +1,197 @@ +LINTIGNOREDOT='internal/awstesting/integration.+should not use dot imports' +LINTIGNOREDOC='service/[^/]+/(api|service|waiters)\.go:.+(comment on exported|should have comment or be unexported)' +LINTIGNORECONST='service/[^/]+/(api|service|waiters)\.go:.+(type|struct field|const|func) ([^ ]+) should be ([^ ]+)' +LINTIGNORESTUTTER='service/[^/]+/(api|service)\.go:.+(and that stutters)' +LINTIGNOREINFLECT='service/[^/]+/(api|errors|service)\.go:.+(method|const) .+ should be ' +LINTIGNOREINFLECTS3UPLOAD='service/s3/s3manager/upload\.go:.+struct field SSEKMSKeyId should be ' +LINTIGNOREDEPS='vendor/.+\.go' +LINTIGNOREPKGCOMMENT='service/[^/]+/doc_custom.go:.+package comment should be of the form' +LINTIGNOREENDPOINTS='aws/endpoints/defaults.go:.+(method|const) .+ should be ' +UNIT_TEST_TAGS="example codegen awsinclude" + +SDK_WITH_VENDOR_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/src") +SDK_ONLY_PKGS=$(shell go list ./... | grep -v "/vendor/") +SDK_UNIT_TEST_ONLY_PKGS=$(shell go list -tags ${UNIT_TEST_TAGS} ./... | grep -v "/vendor/") +SDK_GO_1_4=$(shell go version | grep "go1.4") +SDK_GO_1_5=$(shell go version | grep "go1.5") +SDK_GO_VERSION=$(shell go version | awk '''{print $$3}''' | tr -d '''\n''') +SDK_V1_USAGE=$(shell go list -f '''{{ if not .Standard }}{{ range $$_, $$name := .Imports }} * {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ end }}''' ./... | sort -u | grep '''/aws-sdk-go/''') + +all: get-deps generate unit + +help: + @echo "Please use \`make ' where is one of" + @echo " api_info to print a list of services and versions" + @echo " docs to build SDK documentation" + @echo " build to go build the SDK" + @echo " unit to run unit tests" + @echo " integration to run integration tests" + @echo " performance to run performance tests" + @echo " verify to verify tests" + @echo " lint to lint the SDK" + @echo " vet to vet the SDK" + @echo " generate to go generate and make services" + @echo " gen-test to generate protocol tests" + @echo " gen-services to generate services" + @echo " get-deps to go get the SDK dependencies" + @echo " get-deps-tests to get the SDK's test dependencies" + @echo " get-deps-verify to get the SDK's verification dependencies" + +generate: cleanup-models gen-test gen-endpoints gen-services gen-tools + +gen-test: gen-protocol-test + +gen-services: + go generate ./service + +gen-protocol-test: + go generate ./private/protocol/... + +gen-endpoints: + go generate ./models/endpoints/ + +gen-tools: + go generate ./internal/awstesting/cmd/op_crawler/ + +cleanup-models: + @echo "Cleaning up stale model versions" + @./cleanup_models.sh + +build: + @echo "go build SDK and vendor packages" + @if [ ! -z "${SDK_V1_USAGE}" ]; then echo "Using of V1 SDK packages"; echo "${SDK_V1_USAGE}"; exit 1; fi + @go build ${SDK_ONLY_PKGS} + +unit: get-deps-tests build verify + @echo "go test SDK and vendor packages" + @go test -tags ${UNIT_TEST_TAGS} $(SDK_UNIT_TEST_ONLY_PKGS) + +unit-with-race-cover: get-deps-tests build verify + @echo "go test SDK and vendor packages" + @go test -tags ${UNIT_TEST_TAGS} -race -cpu=1,2,4 $(SDK_UNIT_TEST_ONLY_PKGS) + +integration: get-deps-tests integ-custom smoke-tests performance + +integ-custom: + go test -tags "integration" ./internal/awstesting/integration/customizations/... + +cleanup-integ: + go run -tags "integration" ./internal/awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration" + +smoke-tests: get-deps-tests + gucumber -go-tags "integration" ./internal/awstesting/integration/smoke + +performance: get-deps-tests + AWS_TESTING_LOG_RESULTS=${log-detailed} AWS_TESTING_REGION=$(region) AWS_TESTING_DB_TABLE=$(table) gucumber -go-tags "integration" ./internal/awstesting/performance + +sandbox-tests: sandbox-test-go15 sandbox-test-go15-novendorexp sandbox-test-go16 sandbox-test-go17 sandbox-test-go18 sandbox-test-go19 sandbox-test-gotip + +sandbox-build-go15: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.5 -t "aws-sdk-go-1.5" . +sandbox-go15: sandbox-build-go15 + docker run -i -t aws-sdk-go-1.5 bash +sandbox-test-go15: sandbox-build-go15 + docker run -t aws-sdk-go-1.5 + +sandbox-build-go15-novendorexp: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.5-novendorexp -t "aws-sdk-go-1.5-novendorexp" . +sandbox-go15-novendorexp: sandbox-build-go15-novendorexp + docker run -i -t aws-sdk-go-1.5-novendorexp bash +sandbox-test-go15-novendorexp: sandbox-build-go15-novendorexp + docker run -t aws-sdk-go-1.5-novendorexp + +sandbox-build-go16: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.6 -t "aws-sdk-go-1.6" . +sandbox-go16: sandbox-build-go16 + docker run -i -t aws-sdk-go-1.6 bash +sandbox-test-go16: sandbox-build-go16 + docker run -t aws-sdk-go-1.6 + +sandbox-build-go17: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.7 -t "aws-sdk-go-1.7" . +sandbox-go17: sandbox-build-go17 + docker run -i -t aws-sdk-go-1.7 bash +sandbox-test-go17: sandbox-build-go17 + docker run -t aws-sdk-go-1.7 + +sandbox-build-go18: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.8" . +sandbox-go18: sandbox-build-go18 + docker run -i -t aws-sdk-go-1.8 bash +sandbox-test-go18: sandbox-build-go18 + docker run -t aws-sdk-go-1.8 + +sandbox-build-go19: + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.go1.9 -t "aws-sdk-go-1.9" . +sandbox-go19: sandbox-build-go19 + docker run -i -t aws-sdk-go-1.9 bash +sandbox-test-go19: sandbox-build-go19 + docker run -t aws-sdk-go-1.9 + +sandbox-build-gotip: + @echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container" + docker build -f ./internal/awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" . +sandbox-gotip: sandbox-build-gotip + docker run -i -t aws-sdk-go-tip bash +sandbox-test-gotip: sandbox-build-gotip + docker run -t aws-sdk-go-tip + +update-aws-golang-tip: + docker build --no-cache=true -f ./internal/awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" . + +verify: get-deps-verify lint vet + +lint: + @echo "go lint SDK and vendor packages" + @lint=`if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then golint ./...; else echo "skipping golint"; fi`; \ + lint=`echo "$$lint" | grep -E -v -e ${LINTIGNOREDOT} -e ${LINTIGNOREDOC} -e ${LINTIGNORECONST} -e ${LINTIGNORESTUTTER} -e ${LINTIGNOREINFLECT} -e ${LINTIGNOREDEPS} -e ${LINTIGNOREINFLECTS3UPLOAD} -e ${LINTIGNOREPKGCOMMENT} -e ${LINTIGNOREENDPOINTS}`; \ + echo "$$lint"; \ + if [ "$$lint" != "" ] && [ "$$lint" != "skipping golint" ]; then exit 1; fi + +SDK_BASE_FOLDERS=$(shell ls -d */ | grep -v vendor | grep -v awsmigrate) +ifneq (,$(findstring go1.4, ${SDK_GO_VERSION})) + GO_VET_CMD=echo skipping go vet, ${SDK_GO_VERSION} +else ifneq (,$(findstring go1.6, ${SDK_GO_VERSION})) + GO_VET_CMD=go tool vet --all -shadow -example=false +else + GO_VET_CMD=go tool vet --all -shadow +endif + +vet: + ${GO_VET_CMD} ${SDK_BASE_FOLDERS} + +get-deps: get-deps-tests get-deps-verify + @echo "go get SDK dependencies" + @go get -v $(SDK_ONLY_PKGS) + +get-deps-tests: + @echo "go get SDK testing dependencies" + go get github.com/gucumber/gucumber/cmd/gucumber + go get github.com/stretchr/testify + go get github.com/smartystreets/goconvey + go get golang.org/x/net/html + go get golang.org/x/net/http2 + +get-deps-verify: + @echo "go get SDK verification utilities" + @if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi + +bench: + @echo "go bench SDK packages" + @go test -run NONE -bench . -benchmem -tags 'bench' $(SDK_ONLY_PKGS) + +bench-protocol: + @echo "go bench SDK protocol marshallers" + @go test -run NONE -bench . -benchmem -tags 'bench' ./private/protocol/... + +docs: + @echo "generate SDK docs" + @# This env variable, DOCS, is for internal use + @if [ -z ${AWS_DOC_GEN_TOOL} ]; then\ + rm -rf doc && bundle install && bundle exec yard;\ + else\ + $(AWS_DOC_GEN_TOOL) `pwd`;\ + fi + +api_info: + @go run private/model/cli/api-info/api-info.go diff --git a/vendor/github.com/aws/aws-sdk-go-v2/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go-v2/NOTICE.txt new file mode 100644 index 000000000000..5f14d1162ed4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/NOTICE.txt @@ -0,0 +1,3 @@ +AWS SDK for Go +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2014-2015 Stripe, Inc. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/README.md b/vendor/github.com/aws/aws-sdk-go-v2/README.md new file mode 100644 index 000000000000..a2d9fb9a9a1e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/README.md @@ -0,0 +1,90 @@ +![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiNmlHN1RaaXBIc3RmZzFCYjgydENqSENIaTZJazF0QTBWUkxhR2JoWnZLdG9BdU9nblpXbDk5S2xoYUhRcWl5dERFVklaMDRrUy9rY3l4cmJTRzJnNHJZPSIsIml2UGFyYW1ldGVyU3BlYyI6Inc4bW5GZzZNN1MreGl1Y3giLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) [![Documentation](https://godoc.org/github.com/aws/aws-sdk-go-v2?status.svg)](https://godoc.org/github.com/aws/aws-sdk-go-v2) + +# AWS SDK for Go v2 + +aws-sdk-go-v2 is the Developer Preview for the v2 of the AWS SDK for the Go programming language. + +Check out the [Issues] and [Projects] for design and updates being made to the SDK. The v2 SDK requires a minimum version of Go 1.9. + +We'll be expanding out the [Issues] and [Projects] sections with additional changes to the SDK based on your feedback, and SDK's core's improvements. Check the the SDK's [CHANGE_LOG] for information about the latest updates to the SDK. + +## Getting started + +The best way to get started working with the SDK is to use `go get` to add the SDK to your Go Workspace manually. + +```sh +go get -u github.com/aws/aws-sdk-go-v2 +``` + +You could also use [Dep] to add the SDK to your application's dependencies. Using [Dep] will simplify your update story and help your application keep pinned to specific version of the SDK + +```sh +dep ensure -add github.com/aws/aws-sdk-go-v2 +``` + +### Hello AWS + +This example shows how you can use the v2 SDK to make an API request using the SDK's [Amazon DynamoDB] client. + +```go +package main + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/endpoints" + "github.com/aws/aws-sdk-go-v2/aws/external" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" +) + +func main() { + // Using the SDK's default configuration, loading additional config + // and credentials values from the environment variables, shared + // credentials, and shared configuration files + cfg, err := external.LoadDefaultAWSConfig() + if err != nil { + panic("unable to load SDK config, " + err.Error()) + } + + // Set the AWS Region that the service clients should use + cfg.Region = endpoints.UsWest2RegionID + + // Using the Config value, create the DynamoDB client + svc := dynamodb.New(cfg) + + // Build the request with its input parameters + req := svc.DescribeTableRequest(&dynamodb.DescribeTableInput{ + TableName: aws.String("myTable"), + }) + + // Send the request, and get the response or error back + resp, err := req.Send() + if err != nil { + panic("failed to describe table, "+err.Error()) + } + + fmt.Println("Response", resp) +} +``` + +## Feedback and contributing + +The v2 SDK will use GitHub [Issues] to track feature requests and issues with the SDK. In addition, we'll use GitHub [Projects] to track large tasks spanning multiple pull requests, such as refactoring the SDK's internal request lifecycle. You can provide feedback to us in several ways. + +**GitHub issues**. To provide feedback or report bugs, file GitHub [Issues] on the SDK. This is the preferred mechanism to give feedback so that other users can engage in the conversation, +1 issues, etc. Issues you open will be evaluated, and included in our roadmap for the GA launch. + +**Gitter channel**. For more informal discussions or general feedback, check out our [Gitter channel] for the SDK. The [Gitter channel] is also a great place to ask general questions, and find help to get started with the 2.0 SDK Developer Preview. + +**Contributing**. You can open pull requests for fixes or additions to the AWS SDK for Go 2.0 Developer Preview release. All pull requests must be submitted under the Apache 2.0 license and will be reviewed by an SDK team member before being merged in. Accompanying unit tests, where possible, are appreciated. + +## License + +This SDK is distributed under the +[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0), +see LICENSE.txt and NOTICE.txt for more information. + +[Dep]: https://github.com/golang/dep +[Issues]: https://github.com/aws/aws-sdk-go-v2/issues +[Projects]: https://github.com/aws/aws-sdk-go-v2/projects +[CHANGE_LOG]: https://github.com/aws/aws-sdk-go-v2/blob/master/CHANGELOG.md +[Amazon DynamoDB]: https://aws.amazon.com/dynamodb/ +[Gitter channel]: https://gitter.im/aws/aws-sdk-go-v2 diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/error.go new file mode 100644 index 000000000000..56fdfc2bfc76 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/error.go @@ -0,0 +1,145 @@ +// Package awserr represents API error interface accessors for the SDK. +package awserr + +// An Error wraps lower level errors with code, message and an original error. +// The underlying concrete error type may also satisfy other interfaces which +// can be to used to obtain more specific information about the error. +// +// Calling Error() or String() will always include the full information about +// an error based on its underlying type. +// +// Example: +// +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if awsErr, ok := err.(awserr.Error); ok { +// // Get error details +// log.Println("Error:", awsErr.Code(), awsErr.Message()) +// +// // Prints out full error message, including original error if there was one. +// log.Println("Error:", awsErr.Error()) +// +// // Get original error +// if origErr := awsErr.OrigErr(); origErr != nil { +// // operate on original error. +// } +// } else { +// fmt.Println(err.Error()) +// } +// } +// +type Error interface { + // Satisfy the generic error interface. + error + + // Returns the short phrase depicting the classification of the error. + Code() string + + // Returns the error details message. + Message() string + + // Returns the original error if one was set. Nil is returned if not set. + OrigErr() error +} + +// BatchError is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occurred in the batch. +// +// Deprecated: Replaced with BatchedErrors. Only defined for backwards +// compatibility. +type BatchError interface { + // Satisfy the generic error interface. + error + + // Returns the short phrase depicting the classification of the error. + Code() string + + // Returns the error details message. + Message() string + + // Returns the original error if one was set. Nil is returned if not set. + OrigErrs() []error +} + +// BatchedErrors is a batch of errors which also wraps lower level errors with +// code, message, and original errors. Calling Error() will include all errors +// that occurred in the batch. +// +// Replaces BatchError +type BatchedErrors interface { + // Satisfy the base Error interface. + Error + + // Returns the original error if one was set. Nil is returned if not set. + OrigErrs() []error +} + +// New returns an Error object described by the code, message, and origErr. +// +// If origErr satisfies the Error interface it will not be wrapped within a new +// Error object and will instead be returned. +func New(code, message string, origErr error) Error { + var errs []error + if origErr != nil { + errs = append(errs, origErr) + } + return newBaseError(code, message, errs) +} + +// NewBatchError returns an BatchedErrors with a collection of errors as an +// array of errors. +func NewBatchError(code, message string, errs []error) BatchedErrors { + return newBaseError(code, message, errs) +} + +// A RequestFailure is an interface to extract request failure information from +// an Error such as the request ID of the failed request returned by a service. +// RequestFailures may not always have a requestID value if the request failed +// prior to reaching the service such as a connection error. +// +// Example: +// +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if reqerr, ok := err.(RequestFailure); ok { +// log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) +// } else { +// log.Println("Error:", err.Error()) +// } +// } +// +// Combined with awserr.Error: +// +// output, err := s3manage.Upload(svc, input, opts) +// if err != nil { +// if awsErr, ok := err.(awserr.Error); ok { +// // Generic AWS Error with Code, Message, and original error (if any) +// fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) +// +// if reqErr, ok := err.(awserr.RequestFailure); ok { +// // A service error occurred +// fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) +// } +// } else { +// fmt.Println(err.Error()) +// } +// } +// +type RequestFailure interface { + Error + + // The status code of the HTTP response. + StatusCode() int + + // The request ID returned by the service for a request failure. This will + // be empty if no request ID is available such as the request failed due + // to a connection error. + RequestID() string +} + +// NewRequestFailure returns a new request error wrapper for the given Error +// provided. +func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { + return newRequestError(err, statusCode, reqID) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/types.go new file mode 100644 index 000000000000..0202a008f5d7 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/awserr/types.go @@ -0,0 +1,194 @@ +package awserr + +import "fmt" + +// SprintError returns a string of the formatted error code. +// +// Both extra and origErr are optional. If they are included their lines +// will be added, but if they are not included their lines will be ignored. +func SprintError(code, message, extra string, origErr error) string { + msg := fmt.Sprintf("%s: %s", code, message) + if extra != "" { + msg = fmt.Sprintf("%s\n\t%s", msg, extra) + } + if origErr != nil { + msg = fmt.Sprintf("%s\ncaused by: %s", msg, origErr.Error()) + } + return msg +} + +// A baseError wraps the code and message which defines an error. It also +// can be used to wrap an original error object. +// +// Should be used as the root for errors satisfying the awserr.Error. Also +// for any error which does not fit into a specific error wrapper type. +type baseError struct { + // Classification of error + code string + + // Detailed information about error + message string + + // Optional original error this error is based off of. Allows building + // chained errors. + errs []error +} + +// newBaseError returns an error object for the code, message, and errors. +// +// code is a short no whitespace phrase depicting the classification of +// the error that is being created. +// +// message is the free flow string containing detailed information about the +// error. +// +// origErrs is the error objects which will be nested under the new errors to +// be returned. +func newBaseError(code, message string, origErrs []error) *baseError { + b := &baseError{ + code: code, + message: message, + errs: origErrs, + } + + return b +} + +// Error returns the string representation of the error. +// +// See ErrorWithExtra for formatting. +// +// Satisfies the error interface. +func (b baseError) Error() string { + size := len(b.errs) + if size > 0 { + return SprintError(b.code, b.message, "", errorList(b.errs)) + } + + return SprintError(b.code, b.message, "", nil) +} + +// String returns the string representation of the error. +// Alias for Error to satisfy the stringer interface. +func (b baseError) String() string { + return b.Error() +} + +// Code returns the short phrase depicting the classification of the error. +func (b baseError) Code() string { + return b.code +} + +// Message returns the error details message. +func (b baseError) Message() string { + return b.message +} + +// OrigErr returns the original error if one was set. Nil is returned if no +// error was set. This only returns the first element in the list. If the full +// list is needed, use BatchedErrors. +func (b baseError) OrigErr() error { + switch len(b.errs) { + case 0: + return nil + case 1: + return b.errs[0] + default: + if err, ok := b.errs[0].(Error); ok { + return NewBatchError(err.Code(), err.Message(), b.errs[1:]) + } + return NewBatchError("BatchedErrors", + "multiple errors occurred", b.errs) + } +} + +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. +func (b baseError) OrigErrs() []error { + return b.errs +} + +// So that the Error interface type can be included as an anonymous field +// in the requestError struct and not conflict with the error.Error() method. +type awsError Error + +// A requestError wraps a request or service error. +// +// Composed of baseError for code, message, and original error. +type requestError struct { + awsError + statusCode int + requestID string +} + +// newRequestError returns a wrapped error with additional information for +// request status code, and service requestID. +// +// Should be used to wrap all request which involve service requests. Even if +// the request failed without a service response, but had an HTTP status code +// that may be meaningful. +// +// Also wraps original errors via the baseError. +func newRequestError(err Error, statusCode int, requestID string) *requestError { + return &requestError{ + awsError: err, + statusCode: statusCode, + requestID: requestID, + } +} + +// Error returns the string representation of the error. +// Satisfies the error interface. +func (r requestError) Error() string { + extra := fmt.Sprintf("status code: %d, request id: %s", + r.statusCode, r.requestID) + return SprintError(r.Code(), r.Message(), extra, r.OrigErr()) +} + +// String returns the string representation of the error. +// Alias for Error to satisfy the stringer interface. +func (r requestError) String() string { + return r.Error() +} + +// StatusCode returns the wrapped status code for the error +func (r requestError) StatusCode() int { + return r.statusCode +} + +// RequestID returns the wrapped requestID +func (r requestError) RequestID() string { + return r.requestID +} + +// OrigErrs returns the original errors if one was set. An empty slice is +// returned if no error was set. +func (r requestError) OrigErrs() []error { + if b, ok := r.awsError.(BatchedErrors); ok { + return b.OrigErrs() + } + return []error{r.OrigErr()} +} + +// An error list that satisfies the golang interface +type errorList []error + +// Error returns the string representation of the error. +// +// Satisfies the error interface. +func (e errorList) Error() string { + msg := "" + // How do we want to handle the array size being zero + if size := len(e); size > 0 { + for i := 0; i < size; i++ { + msg += fmt.Sprintf("%s", e[i].Error()) + // We check the next index to see if it is within the slice. + // If it is, then we append a newline. We do this, because unit tests + // could be broken with the additional '\n' + if i+1 < size { + msg += "\n" + } + } + } + return msg +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/chain_provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/chain_provider.go new file mode 100644 index 000000000000..c78dfac684a9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/chain_provider.go @@ -0,0 +1,75 @@ +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// A ChainProvider will search for a provider which returns credentials +// and cache that provider until Retrieve is called again. +// +// The ChainProvider provides a way of chaining multiple providers together +// which will pick the first available using priority order of the Providers +// in the list. +// +// If none of the Providers retrieve valid credentials Credentials, ChainProvider's +// Retrieve() will return the error ErrNoValidProvidersFoundInChain. +// +// If a CredentialsProvider is found which returns valid credentials Credentials ChainProvider +// will cache that CredentialsProvider for all calls to IsExpired(), until Retrieve is +// called again. +// +// Example of ChainProvider to be used with an EnvProvider and EC2RoleProvider. +// In this example EnvProvider will first check if any credentials are available +// via the environment variables. If there are none ChainProvider will check +// the next CredentialsProvider in the list, EC2RoleProvider in this case. If EC2RoleProvider +// does not return any credentials ChainProvider will return the error +// ErrNoValidProvidersFoundInChain +// +// creds := aws.NewChainCredentials( +// []aws.CredentialsProvider{ +// &credentials.EnvProvider{}, +// &ec2rolecreds.EC2RoleProvider{ +// Client: ec2metadata.New(cfg), +// }, +// }) +// +// // Usage of ChainCredentials with aws.Config +// cfg := cfg.Copy() +// cfg.Credentials = creds +// svc := ec2.New(cfg) +// +type ChainProvider struct { + SafeCredentialsProvider + + Providers []CredentialsProvider +} + +// NewChainProvider returns a pointer to a new ChainProvider value wrapping +// a chain of credentials providers. +func NewChainProvider(providers []CredentialsProvider) *ChainProvider { + p := &ChainProvider{ + Providers: append([]CredentialsProvider{}, providers...), + } + p.RetrieveFn = p.retrieveFn + + return p +} + +// Retrieve returns the credentials value or error if no provider returned +// without error. +// +// If a provider is found it will be cached and any calls to IsExpired() +// will return the expired state of the cached provider. +func (c *ChainProvider) retrieveFn() (Credentials, error) { + var errs []error + for _, p := range c.Providers { + creds, err := p.Retrieve() + if err == nil { + return creds, nil + } + errs = append(errs, err) + } + + return Credentials{}, + awserr.NewBatchError("NoCredentialProviders", "no valid providers in chain", errs) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/client.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/client.go new file mode 100644 index 000000000000..f5b63bdeb1fa --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/client.go @@ -0,0 +1,85 @@ +package aws + +import ( + "net/http" +) + +// Metadata wraps immutable data from the Client structure. +type Metadata struct { + ServiceName string + APIVersion string + + Endpoint string + SigningName string + SigningRegion string + + JSONVersion string + TargetPrefix string +} + +// A Client implements the base client request and response handling +// used by all service clients. +type Client struct { + Metadata Metadata + + Config Config + + Region string + Credentials CredentialsProvider + EndpointResolver EndpointResolver + Handlers Handlers + Retryer Retryer + + // TODO replace with value not pointer + LogLevel LogLevel + Logger Logger + + HTTPClient *http.Client +} + +// NewClient will return a pointer to a new initialized service client. +func NewClient(cfg Config, metadata Metadata) *Client { + svc := &Client{ + Metadata: metadata, + + // TODO remove config when request reqfactored + Config: cfg, + + Region: cfg.Region, + Credentials: cfg.Credentials, + EndpointResolver: cfg.EndpointResolver, + Handlers: cfg.Handlers.Copy(), + Retryer: cfg.Retryer, + + LogLevel: cfg.LogLevel, + Logger: cfg.Logger, + } + + retryer := cfg.Retryer + if retryer == nil { + // TODO need better way of specifing default num retries + retryer = DefaultRetryer{NumMaxRetries: 3} + } + svc.Retryer = retryer + + svc.AddDebugHandlers() + + return svc +} + +// NewRequest returns a new Request pointer for the service API +// operation and parameters. +func (c *Client) NewRequest(operation *Operation, params interface{}, data interface{}) *Request { + return New(c.Config, c.Metadata, c.Handlers, c.Retryer, operation, params, data) +} + +// AddDebugHandlers injects debug logging handlers into the service to log request +// debug information. +func (c *Client) AddDebugHandlers() { + if !c.Config.LogLevel.AtLeast(LogDebug) { + return + } + + c.Handlers.Send.PushFrontNamed(NamedHandler{Name: "awssdk.client.LogRequest", Fn: logRequest}) + c.Handlers.Send.PushBackNamed(NamedHandler{Name: "awssdk.client.LogResponse", Fn: logResponse}) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/client_logger.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/client_logger.go new file mode 100644 index 000000000000..f3e2e86a016f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/client_logger.go @@ -0,0 +1,105 @@ +package aws + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http/httputil" +) + +const logReqMsg = `DEBUG: Request %s/%s Details: +---[ REQUEST POST-SIGN ]----------------------------- +%s +-----------------------------------------------------` + +const logReqErrMsg = `DEBUG ERROR: Request %s/%s: +---[ REQUEST DUMP ERROR ]----------------------------- +%s +------------------------------------------------------` + +type logWriter struct { + // Logger is what we will use to log the payload of a response. + Logger Logger + // buf stores the contents of what has been read + buf *bytes.Buffer +} + +func (logger *logWriter) Write(b []byte) (int, error) { + return logger.buf.Write(b) +} + +type teeReaderCloser struct { + // io.Reader will be a tee reader that is used during logging. + // This structure will read from a body and write the contents to a logger. + io.Reader + // Source is used just to close when we are done reading. + Source io.ReadCloser +} + +func (reader *teeReaderCloser) Close() error { + return reader.Source.Close() +} + +func logRequest(r *Request) { + logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody) + dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) + if err != nil { + r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.Metadata.ServiceName, r.Operation.Name, err)) + return + } + + if logBody { + // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's + // Body as a NoOpCloser and will not be reset after read by the HTTP + // client reader. + r.ResetBody() + } + + r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.Metadata.ServiceName, r.Operation.Name, string(dumpedBody))) +} + +const logRespMsg = `DEBUG: Response %s/%s Details: +---[ RESPONSE ]-------------------------------------- +%s +-----------------------------------------------------` + +const logRespErrMsg = `DEBUG ERROR: Response %s/%s: +---[ RESPONSE DUMP ERROR ]----------------------------- +%s +-----------------------------------------------------` + +func logResponse(r *Request) { + lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} + r.HTTPResponse.Body = &teeReaderCloser{ + Reader: io.TeeReader(r.HTTPResponse.Body, lw), + Source: r.HTTPResponse.Body, + } + + handlerFn := func(req *Request) { + body, err := httputil.DumpResponse(req.HTTPResponse, false) + if err != nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.Metadata.ServiceName, req.Operation.Name, err)) + return + } + + b, err := ioutil.ReadAll(lw.buf) + if err != nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, req.Metadata.ServiceName, req.Operation.Name, err)) + return + } + lw.Logger.Log(fmt.Sprintf(logRespMsg, req.Metadata.ServiceName, req.Operation.Name, string(body))) + if req.Config.LogLevel.Matches(LogDebugWithHTTPBody) { + lw.Logger.Log(string(b)) + } + } + + const handlerName = "awsdk.client.LogResponse.ResponseBody" + + r.Handlers.Unmarshal.SetBackNamed(NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) + r.Handlers.UnmarshalError.SetBackNamed(NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/config.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/config.go new file mode 100644 index 000000000000..4605415007c4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/config.go @@ -0,0 +1,98 @@ +package aws + +import ( + "net/http" +) + +// A Config provides service configuration for service clients. +type Config struct { + // The region to send requests to. This parameter is required and must + // be configured globally or on a per-client basis unless otherwise + // noted. A full list of regions is found in the "Regions and Endpoints" + // document. + // + // See http://docs.aws.amazon.com/general/latest/gr/rande.html for + // information on AWS regions. + Region string + + // The credentials object to use when signing requests. Defaults to a + // chain of credential providers to search for credentials in environment + // variables, shared credential file, and EC2 Instance Roles. + Credentials CredentialsProvider + + // The resolver to use for looking up endpoints for AWS service clients + // to use based on region. + EndpointResolver EndpointResolver + + // The HTTP client to use when sending requests. Defaults to + // `http.DefaultClient`. + HTTPClient *http.Client + + // TODO document + Handlers Handlers + + // Retryer guides how HTTP requests should be retried in case of + // recoverable failures. + // + // When nil or the value does not implement the request.Retryer interface, + // the client.DefaultRetryer will be used. + // + // When both Retryer and MaxRetries are non-nil, the former is used and + // the latter ignored. + // + // To set the Retryer field in a type-safe manner and with chaining, use + // the request.WithRetryer helper function: + // + // cfg := request.WithRetryer(aws.NewConfig(), myRetryer) + Retryer Retryer + + // An integer value representing the logging level. The default log level + // is zero (LogOff), which represents no logging. To enable logging set + // to a LogLevel Value. + LogLevel LogLevel + + // The logger writer interface to write logging messages to. Defaults to + // standard out. + Logger Logger + + // EnforceShouldRetryCheck is used in the AfterRetryHandler to always call + // ShouldRetry regardless of whether or not if request.Retryable is set. + // This will utilize ShouldRetry method of custom retryers. If EnforceShouldRetryCheck + // is not set, then ShouldRetry will only be called if request.Retryable is nil. + // Proper handling of the request.Retryable field is important when setting this field. + // + // TODO this config field is depercated and needs removed. + EnforceShouldRetryCheck bool + + // DisableRestProtocolURICleaning will not clean the URL path when making + // rest protocol requests. Will default to false. This would only be used + // for empty directory names in s3 requests. + // + // Example: + // cfg, err := external.LoadDefaultAWSConfig() + // cfg.DisableRestProtocolURICleaning = true + // + // svc := s3.New(cfg) + // out, err := svc.GetObject(&s3.GetObjectInput { + // Bucket: aws.String("bucketname"), + // Key: aws.String("//foo//bar//moo"), + // }) + // + // TODO need better way of representing support for this concept. Not on Config. + DisableRestProtocolURICleaning bool +} + +// NewConfig returns a new Config pointer that can be chained with builder +// methods to set multiple configuration values inline without using pointers. +func NewConfig() *Config { + return &Config{} +} + +// Copy will return a shallow copy of the Config object. If any additional +// configurations are provided they will be merged into the new config returned. +func (c Config) Copy() Config { + cp := c + cp.Handlers = cp.Handlers.Copy() + + return cp +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error.go new file mode 100644 index 000000000000..5fe8be630a94 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error.go @@ -0,0 +1,19 @@ +// +build !appengine,!plan9 + +package aws + +import ( + "net" + "os" + "syscall" +) + +func isErrConnectionReset(err error) bool { + if opErr, ok := err.(*net.OpError); ok { + if sysErr, ok := opErr.Err.(*os.SyscallError); ok { + return sysErr.Err == syscall.ECONNRESET + } + } + + return false +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error_other.go new file mode 100644 index 000000000000..ca8422eff283 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/connection_reset_error_other.go @@ -0,0 +1,11 @@ +// +build appengine plan9 + +package aws + +import ( + "strings" +) + +func isErrConnectionReset(err error) bool { + return strings.Contains(err.Error(), "connection reset") +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/context.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/context.go new file mode 100644 index 000000000000..79f426853b5d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/context.go @@ -0,0 +1,71 @@ +package aws + +import ( + "time" +) + +// Context is an copy of the Go v1.7 stdlib's context.Context interface. +// It is represented as a SDK interface to enable you to use the "WithContext" +// API methods with Go v1.6 and a Context type such as golang.org/x/net/context. +// +// See https://golang.org/pkg/context on how to use contexts. +type Context interface { + // Deadline returns the time when work done on behalf of this context + // should be canceled. Deadline returns ok==false when no deadline is + // set. Successive calls to Deadline return the same results. + Deadline() (deadline time.Time, ok bool) + + // Done returns a channel that's closed when work done on behalf of this + // context should be canceled. Done may return nil if this context can + // never be canceled. Successive calls to Done return the same value. + Done() <-chan struct{} + + // Err returns a non-nil error value after Done is closed. Err returns + // Canceled if the context was canceled or DeadlineExceeded if the + // context's deadline passed. No other values for Err are defined. + // After Done is closed, successive calls to Err return the same value. + Err() error + + // Value returns the value associated with this context for key, or nil + // if no value is associated with key. Successive calls to Value with + // the same key returns the same result. + // + // Use context values only for request-scoped data that transits + // processes and API boundaries, not for passing optional parameters to + // functions. + Value(key interface{}) interface{} +} + +// BackgroundContext returns a context that will never be canceled, has no +// values, and no deadline. This context is used by the SDK to provide +// backwards compatibility with non-context API operations and functionality. +// +// Go 1.6 and before: +// This context function is equivalent to context.Background in the Go stdlib. +// +// Go 1.7 and later: +// The context returned will be the value returned by context.Background() +// +// See https://golang.org/pkg/context for more information on Contexts. +func BackgroundContext() Context { + return backgroundCtx +} + +// SleepWithContext will wait for the timer duration to expire, or the context +// is canceled. Which ever happens first. If the context is canceled the Context's +// error will be returned. +// +// Expects Context to always return a non-nil error if the Done channel is closed. +func SleepWithContext(ctx Context, dur time.Duration) error { + t := time.NewTimer(dur) + defer t.Stop() + + select { + case <-t.C: + break + case <-ctx.Done(): + return ctx.Err() + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_6.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_6.go new file mode 100644 index 000000000000..8fdda5303380 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_6.go @@ -0,0 +1,41 @@ +// +build !go1.7 + +package aws + +import "time" + +// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to +// provide a 1.6 and 1.5 safe version of context that is compatible with Go +// 1.7's Context. +// +// An emptyCtx is never canceled, has no values, and has no deadline. It is not +// struct{}, since vars of this type must have distinct addresses. +type emptyCtx int + +func (*emptyCtx) Deadline() (deadline time.Time, ok bool) { + return +} + +func (*emptyCtx) Done() <-chan struct{} { + return nil +} + +func (*emptyCtx) Err() error { + return nil +} + +func (*emptyCtx) Value(key interface{}) interface{} { + return nil +} + +func (e *emptyCtx) String() string { + switch e { + case backgroundCtx: + return "aws.BackgroundContext" + } + return "unknown empty Context" +} + +var ( + backgroundCtx = new(emptyCtx) +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_7.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_7.go new file mode 100644 index 000000000000..064f75c925cc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/context_1_7.go @@ -0,0 +1,9 @@ +// +build go1.7 + +package aws + +import "context" + +var ( + backgroundCtx = context.Background() +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/convert_types.go new file mode 100644 index 000000000000..ff5d58e06831 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/convert_types.go @@ -0,0 +1,387 @@ +package aws + +import "time" + +// String returns a pointer to the string value passed in. +func String(v string) *string { + return &v +} + +// StringValue returns the value of the string pointer passed in or +// "" if the pointer is nil. +func StringValue(v *string) string { + if v != nil { + return *v + } + return "" +} + +// StringSlice converts a slice of string values into a slice of +// string pointers +func StringSlice(src []string) []*string { + dst := make([]*string, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// StringValueSlice converts a slice of string pointers into a slice of +// string values +func StringValueSlice(src []*string) []string { + dst := make([]string, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// StringMap converts a string map of string values into a string +// map of string pointers +func StringMap(src map[string]string) map[string]*string { + dst := make(map[string]*string) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// StringValueMap converts a string map of string pointers into a string +// map of string values +func StringValueMap(src map[string]*string) map[string]string { + dst := make(map[string]string) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} + +// Bool returns a pointer to the bool value passed in. +func Bool(v bool) *bool { + return &v +} + +// BoolValue returns the value of the bool pointer passed in or +// false if the pointer is nil. +func BoolValue(v *bool) bool { + if v != nil { + return *v + } + return false +} + +// BoolSlice converts a slice of bool values into a slice of +// bool pointers +func BoolSlice(src []bool) []*bool { + dst := make([]*bool, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// BoolValueSlice converts a slice of bool pointers into a slice of +// bool values +func BoolValueSlice(src []*bool) []bool { + dst := make([]bool, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// BoolMap converts a string map of bool values into a string +// map of bool pointers +func BoolMap(src map[string]bool) map[string]*bool { + dst := make(map[string]*bool) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// BoolValueMap converts a string map of bool pointers into a string +// map of bool values +func BoolValueMap(src map[string]*bool) map[string]bool { + dst := make(map[string]bool) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} + +// Int returns a pointer to the int value passed in. +func Int(v int) *int { + return &v +} + +// IntValue returns the value of the int pointer passed in or +// 0 if the pointer is nil. +func IntValue(v *int) int { + if v != nil { + return *v + } + return 0 +} + +// IntSlice converts a slice of int values into a slice of +// int pointers +func IntSlice(src []int) []*int { + dst := make([]*int, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// IntValueSlice converts a slice of int pointers into a slice of +// int values +func IntValueSlice(src []*int) []int { + dst := make([]int, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// IntMap converts a string map of int values into a string +// map of int pointers +func IntMap(src map[string]int) map[string]*int { + dst := make(map[string]*int) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// IntValueMap converts a string map of int pointers into a string +// map of int values +func IntValueMap(src map[string]*int) map[string]int { + dst := make(map[string]int) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} + +// Int64 returns a pointer to the int64 value passed in. +func Int64(v int64) *int64 { + return &v +} + +// Int64Value returns the value of the int64 pointer passed in or +// 0 if the pointer is nil. +func Int64Value(v *int64) int64 { + if v != nil { + return *v + } + return 0 +} + +// Int64Slice converts a slice of int64 values into a slice of +// int64 pointers +func Int64Slice(src []int64) []*int64 { + dst := make([]*int64, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// Int64ValueSlice converts a slice of int64 pointers into a slice of +// int64 values +func Int64ValueSlice(src []*int64) []int64 { + dst := make([]int64, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// Int64Map converts a string map of int64 values into a string +// map of int64 pointers +func Int64Map(src map[string]int64) map[string]*int64 { + dst := make(map[string]*int64) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// Int64ValueMap converts a string map of int64 pointers into a string +// map of int64 values +func Int64ValueMap(src map[string]*int64) map[string]int64 { + dst := make(map[string]int64) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} + +// Float64 returns a pointer to the float64 value passed in. +func Float64(v float64) *float64 { + return &v +} + +// Float64Value returns the value of the float64 pointer passed in or +// 0 if the pointer is nil. +func Float64Value(v *float64) float64 { + if v != nil { + return *v + } + return 0 +} + +// Float64Slice converts a slice of float64 values into a slice of +// float64 pointers +func Float64Slice(src []float64) []*float64 { + dst := make([]*float64, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// Float64ValueSlice converts a slice of float64 pointers into a slice of +// float64 values +func Float64ValueSlice(src []*float64) []float64 { + dst := make([]float64, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// Float64Map converts a string map of float64 values into a string +// map of float64 pointers +func Float64Map(src map[string]float64) map[string]*float64 { + dst := make(map[string]*float64) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// Float64ValueMap converts a string map of float64 pointers into a string +// map of float64 values +func Float64ValueMap(src map[string]*float64) map[string]float64 { + dst := make(map[string]float64) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} + +// Time returns a pointer to the time.Time value passed in. +func Time(v time.Time) *time.Time { + return &v +} + +// TimeValue returns the value of the time.Time pointer passed in or +// time.Time{} if the pointer is nil. +func TimeValue(v *time.Time) time.Time { + if v != nil { + return *v + } + return time.Time{} +} + +// SecondsTimeValue converts an int64 pointer to a time.Time value +// representing seconds since Epoch or time.Time{} if the pointer is nil. +func SecondsTimeValue(v *int64) time.Time { + if v != nil { + return time.Unix((*v / 1000), 0) + } + return time.Time{} +} + +// MillisecondsTimeValue converts an int64 pointer to a time.Time value +// representing milliseconds sinch Epoch or time.Time{} if the pointer is nil. +func MillisecondsTimeValue(v *int64) time.Time { + if v != nil { + return time.Unix(0, (*v * 1000000)) + } + return time.Time{} +} + +// TimeUnixMilli returns a Unix timestamp in milliseconds from "January 1, 1970 UTC". +// The result is undefined if the Unix time cannot be represented by an int64. +// Which includes calling TimeUnixMilli on a zero Time is undefined. +// +// This utility is useful for service API's such as CloudWatch Logs which require +// their unix time values to be in milliseconds. +// +// See Go stdlib https://golang.org/pkg/time/#Time.UnixNano for more information. +func TimeUnixMilli(t time.Time) int64 { + return t.UnixNano() / int64(time.Millisecond/time.Nanosecond) +} + +// TimeSlice converts a slice of time.Time values into a slice of +// time.Time pointers +func TimeSlice(src []time.Time) []*time.Time { + dst := make([]*time.Time, len(src)) + for i := 0; i < len(src); i++ { + dst[i] = &(src[i]) + } + return dst +} + +// TimeValueSlice converts a slice of time.Time pointers into a slice of +// time.Time values +func TimeValueSlice(src []*time.Time) []time.Time { + dst := make([]time.Time, len(src)) + for i := 0; i < len(src); i++ { + if src[i] != nil { + dst[i] = *(src[i]) + } + } + return dst +} + +// TimeMap converts a string map of time.Time values into a string +// map of time.Time pointers +func TimeMap(src map[string]time.Time) map[string]*time.Time { + dst := make(map[string]*time.Time) + for k, val := range src { + v := val + dst[k] = &v + } + return dst +} + +// TimeValueMap converts a string map of time.Time pointers into a string +// map of time.Time values +func TimeValueMap(src map[string]*time.Time) map[string]time.Time { + dst := make(map[string]time.Time) + for k, val := range src { + if val != nil { + dst[k] = *val + } + } + return dst +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go new file mode 100644 index 000000000000..db93f59d02bf --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go @@ -0,0 +1,138 @@ +package aws + +import ( + "math" + "sync" + "sync/atomic" + "time" + + "github.com/aws/aws-sdk-go-v2/internal/sdk" +) + +// NeverExpire is the time identifier used when a credential provider's +// credentials will not expire. This is used in cases where a non-expiring +// provider type cannot be used. +var NeverExpire = time.Unix(math.MaxInt64, 0) + +// AnonymousCredentials is an empty CredentialProvider that can be used as +// dummy placeholder credentials for requests that do not need signed. +// +// This credentials can be used to configure a service to not sign requests +// when making service API calls. For example, when accessing public +// s3 buckets. +// +// s3Cfg := cfg.Copy() +// s3cfg.Credentials = AnonymousCredentials +// +// svc := s3.New(s3Cfg) +var AnonymousCredentials = StaticCredentialsProvider{ + Value: Credentials{Source: "AnonymousCredentials"}, +} + +// An Expiration provides wrapper around time with expiration related methods. +type Expiration time.Time + +// Expired returns if the time has expired. + +// A Credentials is the AWS credentials value for individual credential fields. +type Credentials struct { + // AWS Access key ID + AccessKeyID string + + // AWS Secret Access Key + SecretAccessKey string + + // AWS Session Token + SessionToken string + + // Source of the credentials + Source string + + // Time the credentials will expire. + CanExpire bool + Expires time.Time +} + +// Expired returns if the credetials have expired. +func (v Credentials) Expired() bool { + if v.CanExpire { + return !v.Expires.After(sdk.NowTime()) + } + + return false +} + +// HasKeys returns if the credentials keys are set. +func (v Credentials) HasKeys() bool { + return len(v.AccessKeyID) > 0 && len(v.SecretAccessKey) > 0 +} + +// A CredentialsProvider is the interface for any component which will provide credentials +// Credentials. A CredentialsProvider is required to manage its own Expired state, and what to +// be expired means. +// +// The CredentialsProvider should not need to implement its own mutexes, because +// that will be managed by CredentialsLoader. +type CredentialsProvider interface { + // Retrieve returns nil if it successfully retrieved the value. + // Error is returned if the value were not obtainable, or empty. + Retrieve() (Credentials, error) + + // TODO should Retrieve take a context? +} + +// SafeCredentialsProvider provides caching and concurrency safe credentials +// retrieval via the RetrieveFn. +type SafeCredentialsProvider struct { + RetrieveFn func() (Credentials, error) + + creds atomic.Value + m sync.Mutex +} + +// Retrieve returns the credentials. If the credentials have already been +// retrieved, and not expired the cached credentials will be returned. If the +// credentails have not been retrieved yet, or expired RetrieveFn will be called. +// +// Retruns and error if RetrieveFn returns an error. +func (p *SafeCredentialsProvider) Retrieve() (Credentials, error) { + if creds := p.getCreds(); creds != nil { + return *creds, nil + } + + p.m.Lock() + defer p.m.Unlock() + + // Make sure another goroutine didn't already update the credentials. + if creds := p.getCreds(); creds != nil { + return *creds, nil + } + + creds, err := p.RetrieveFn() + if err != nil { + return Credentials{}, err + } + p.creds.Store(&creds) + + return creds, nil +} + +func (p *SafeCredentialsProvider) getCreds() *Credentials { + v := p.creds.Load() + if v == nil { + return nil + } + + c := v.(*Credentials) + if c != nil && c.HasKeys() && !c.Expired() { + return c + } + + return nil +} + +// Invalidate will invalidate the cached credentials. The next call to Retrieve +// will cause RetrieveFn to be called. +func (p *SafeCredentialsProvider) Invalidate() { + p.creds.Store((*Credentials)(nil)) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/default_retryer.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/default_retryer.go new file mode 100644 index 000000000000..a08af806de60 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/default_retryer.go @@ -0,0 +1,136 @@ +package aws + +import ( + "math/rand" + "strconv" + "sync" + "time" +) + +// DefaultRetryer implements basic retry logic using exponential backoff for +// most services. If you want to implement custom retry logic, implement the +// Retryer interface or create a structure type that composes this +// struct and override the specific methods. For example, to override only +// the MaxRetries method: +// +// type retryer struct { +// client.DefaultRetryer +// } +// +// // This implementation always has 100 max retries +// func (d retryer) MaxRetries() int { return 100 } +type DefaultRetryer struct { + NumMaxRetries int +} + +// MaxRetries returns the number of maximum returns the service will use to make +// an individual API +func (d DefaultRetryer) MaxRetries() int { + return d.NumMaxRetries +} + +var seededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) + +// RetryRules returns the delay duration before retrying this request again +func (d DefaultRetryer) RetryRules(r *Request) time.Duration { + // Set the upper limit of delay in retrying at ~five minutes + minTime := 30 + throttle := d.shouldThrottle(r) + if throttle { + if delay, ok := getRetryDelay(r); ok { + return delay + } + + minTime = 500 + } + + retryCount := r.RetryCount + if retryCount > 13 { + retryCount = 13 + } else if throttle && retryCount > 8 { + retryCount = 8 + } + + delay := (1 << uint(retryCount)) * (seededRand.Intn(minTime) + minTime) + return time.Duration(delay) * time.Millisecond +} + +// ShouldRetry returns true if the request should be retried. +func (d DefaultRetryer) ShouldRetry(r *Request) bool { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if r.Retryable != nil { + return *r.Retryable + } + + if r.HTTPResponse.StatusCode >= 500 { + return true + } + return r.IsErrorRetryable() || d.shouldThrottle(r) +} + +// ShouldThrottle returns true if the request should be throttled. +func (d DefaultRetryer) shouldThrottle(r *Request) bool { + switch r.HTTPResponse.StatusCode { + case 429: + case 502: + case 503: + case 504: + default: + return r.IsErrorThrottle() + } + + return true +} + +// This will look in the Retry-After header, RFC 7231, for how long +// it will wait before attempting another request +func getRetryDelay(r *Request) (time.Duration, bool) { + if !canUseRetryAfterHeader(r) { + return 0, false + } + + delayStr := r.HTTPResponse.Header.Get("Retry-After") + if len(delayStr) == 0 { + return 0, false + } + + delay, err := strconv.Atoi(delayStr) + if err != nil { + return 0, false + } + + return time.Duration(delay) * time.Second, true +} + +// Will look at the status code to see if the retry header pertains to +// the status code. +func canUseRetryAfterHeader(r *Request) bool { + switch r.HTTPResponse.StatusCode { + case 429: + case 503: + default: + return false + } + + return true +} + +// lockedSource is a thread-safe implementation of rand.Source +type lockedSource struct { + lk sync.Mutex + src rand.Source +} + +func (r *lockedSource) Int63() (n int64) { + r.lk.Lock() + n = r.src.Int63() + r.lk.Unlock() + return +} + +func (r *lockedSource) Seed(seed int64) { + r.lk.Lock() + r.src.Seed(seed) + r.lk.Unlock() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/defaults.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/defaults.go new file mode 100644 index 000000000000..fb92d42a9c57 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/defaults.go @@ -0,0 +1,92 @@ +// Package defaults is a collection of helpers to retrieve the SDK's default +// configuration and handlers. +// +// Generally this package shouldn't be used directly, but external.Config +// instead. This package is useful when you need to reset the defaults +// of a service client to the SDK defaults before setting +// additional parameters. +package defaults + +import ( + "log" + "net/http" + "os" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/endpoints" +) + +// Logger returns a Logger which will write log messages to stdout, and +// use same formatting runes as the stdlib log.Logger +func Logger() aws.Logger { + return &defaultLogger{ + logger: log.New(os.Stdout, "", log.LstdFlags), + } +} + +// A defaultLogger provides a minimalistic logger satisfying the Logger interface. +type defaultLogger struct { + logger *log.Logger +} + +// Log logs the parameters to the stdlib logger. See log.Println. +func (l defaultLogger) Log(args ...interface{}) { + l.logger.Println(args...) +} + +// Config returns the default configuration without credentials. +// To retrieve a config with credentials also included use +// `defaults.Get().Config` instead. +// +// Generally you shouldn't need to use this method directly, but +// is available if you need to reset the configuration of an +// existing service client. +func Config() aws.Config { + return aws.Config{ + EndpointResolver: endpoints.NewDefaultResolver(), + Credentials: aws.AnonymousCredentials, + HTTPClient: HTTPClient(), + Logger: Logger(), + Handlers: Handlers(), + } +} + +// HTTPClient will return a new HTTP Client configured for the SDK. +// +// Does not use http.DefaultClient nor http.DefaultTransport. +func HTTPClient() *http.Client { + return &http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + MaxIdleConns: 100, + MaxIdleConnsPerHost: 10, + IdleConnTimeout: 30 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 5 * time.Second, + }, + } +} + +// Handlers returns the default request handlers. +// +// Generally you shouldn't need to use this method directly, but +// is available if you need to reset the request handlers of an +// existing service client. +func Handlers() aws.Handlers { + var handlers aws.Handlers + + handlers.Validate.PushBackNamed(ValidateEndpointHandler) + handlers.Validate.PushBackNamed(ValidateParametersHandler) + handlers.Validate.AfterEachFn = aws.HandlerListStopOnError + handlers.Build.PushBackNamed(SDKVersionUserAgentHandler) + handlers.Build.PushBackNamed(AddHostExecEnvUserAgentHander) + handlers.Build.AfterEachFn = aws.HandlerListStopOnError + handlers.Sign.PushBackNamed(BuildContentLengthHandler) + handlers.Send.PushBackNamed(ValidateReqSigHandler) + handlers.Send.PushBackNamed(SendHandler) + handlers.AfterRetry.PushBackNamed(AfterRetryHandler) + handlers.ValidateResponse.PushBackNamed(ValidateResponseHandler) + + return handlers +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/handlers.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/handlers.go new file mode 100644 index 000000000000..cebd006bac85 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/handlers.go @@ -0,0 +1,229 @@ +package defaults + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "regexp" + "strconv" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/internal/sdk" +) + +// Interface for matching types which also have a Len method. +type lener interface { + Len() int +} + +// BuildContentLengthHandler builds the content length of a request based on the body, +// or will use the HTTPRequest.Header's "Content-Length" if defined. If unable +// to determine request body length and no "Content-Length" was specified it will panic. +// +// The Content-Length will only be added to the request if the length of the body +// is greater than 0. If the body is empty or the current `Content-Length` +// header is <= 0, the header will also be stripped. +var BuildContentLengthHandler = aws.NamedHandler{Name: "core.BuildContentLengthHandler", Fn: func(r *aws.Request) { + var length int64 + + if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { + length, _ = strconv.ParseInt(slength, 10, 64) + } else { + switch body := r.Body.(type) { + case nil: + length = 0 + case lener: + length = int64(body.Len()) + case io.Seeker: + r.BodyStart, _ = body.Seek(0, 1) + end, _ := body.Seek(0, 2) + body.Seek(r.BodyStart, 0) // make sure to seek back to original location + length = end - r.BodyStart + default: + panic("Cannot get length of body, must provide `ContentLength`") + } + } + + if length > 0 { + r.HTTPRequest.ContentLength = length + r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) + } else { + r.HTTPRequest.ContentLength = 0 + r.HTTPRequest.Header.Del("Content-Length") + } +}} + +var reStatusCode = regexp.MustCompile(`^(\d{3})`) + +// ValidateReqSigHandler is a request handler to ensure that the request's +// signature doesn't expire before it is sent. This can happen when a request +// is built and signed significantly before it is sent. Or significant delays +// occur when retrying requests that would cause the signature to expire. +var ValidateReqSigHandler = aws.NamedHandler{ + Name: "core.ValidateReqSigHandler", + Fn: func(r *aws.Request) { + // Unsigned requests are not signed + if r.Config.Credentials == aws.AnonymousCredentials { + return + } + + signedTime := r.Time + if !r.LastSignedAt.IsZero() { + signedTime = r.LastSignedAt + } + + // 10 minutes to allow for some clock skew/delays in transmission. + // Would be improved with aws/aws-sdk-go#423 + if signedTime.Add(10 * time.Minute).After(time.Now()) { + return + } + + r.Sign() + }, +} + +// SendHandler is a request handler to send service request using HTTP client. +var SendHandler = aws.NamedHandler{ + Name: "core.SendHandler", + Fn: func(r *aws.Request) { + sender := sendFollowRedirects + if r.DisableFollowRedirects { + sender = sendWithoutFollowRedirects + } + + if aws.NoBody == r.HTTPRequest.Body { + // Strip off the request body if the NoBody reader was used as a + // place holder for a request body. This prevents the SDK from + // making requests with a request body when it would be invalid + // to do so. + // + // Use a shallow copy of the http.Request to ensure the race condition + // of transport on Body will not trigger + reqOrig, reqCopy := r.HTTPRequest, *r.HTTPRequest + reqCopy.Body = nil + r.HTTPRequest = &reqCopy + defer func() { + r.HTTPRequest = reqOrig + }() + } + + var err error + r.HTTPResponse, err = sender(r) + if err != nil { + handleSendError(r, err) + } + }, +} + +func sendFollowRedirects(r *aws.Request) (*http.Response, error) { + return r.Config.HTTPClient.Do(r.HTTPRequest) +} + +func sendWithoutFollowRedirects(r *aws.Request) (*http.Response, error) { + transport := r.Config.HTTPClient.Transport + if transport == nil { + transport = http.DefaultTransport + } + + return transport.RoundTrip(r.HTTPRequest) +} + +func handleSendError(r *aws.Request, err error) { + // Prevent leaking if an HTTPResponse was returned. Clean up + // the body. + if r.HTTPResponse != nil { + r.HTTPResponse.Body.Close() + } + // Capture the case where url.Error is returned for error processing + // response. e.g. 301 without location header comes back as string + // error and r.HTTPResponse is nil. Other URL redirect errors will + // comeback in a similar method. + if e, ok := err.(*url.Error); ok && e.Err != nil { + if s := reStatusCode.FindStringSubmatch(e.Err.Error()); s != nil { + code, _ := strconv.ParseInt(s[1], 10, 64) + r.HTTPResponse = &http.Response{ + StatusCode: int(code), + Status: http.StatusText(int(code)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + return + } + } + if r.HTTPResponse == nil { + // Add a dummy request response object to ensure the HTTPResponse + // value is consistent. + r.HTTPResponse = &http.Response{ + StatusCode: int(0), + Status: http.StatusText(int(0)), + Body: ioutil.NopCloser(bytes.NewReader([]byte{})), + } + } + // Catch all other request errors. + r.Error = awserr.New("RequestError", "send request failed", err) + r.Retryable = aws.Bool(true) // network errors are retryable + + // Override the error with a context canceled error, if that was canceled. + ctx := r.Context() + select { + case <-ctx.Done(): + r.Error = awserr.New(aws.ErrCodeRequestCanceled, + "request context canceled", ctx.Err()) + r.Retryable = aws.Bool(false) + default: + } +} + +// ValidateResponseHandler is a request handler to validate service response. +var ValidateResponseHandler = aws.NamedHandler{Name: "core.ValidateResponseHandler", Fn: func(r *aws.Request) { + if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 { + // this may be replaced by an UnmarshalError handler + r.Error = awserr.New("UnknownError", "unknown error", nil) + } +}} + +// AfterRetryHandler performs final checks to determine if the request should +// be retried and how long to delay. +var AfterRetryHandler = aws.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *aws.Request) { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if r.Retryable == nil || r.Config.EnforceShouldRetryCheck { + r.Retryable = aws.Bool(r.ShouldRetry(r)) + } + + if r.WillRetry() { + r.RetryDelay = r.RetryRules(r) + + if err := sdk.SleepWithContext(r.Context(), r.RetryDelay); err != nil { + r.Error = awserr.New(aws.ErrCodeRequestCanceled, + "request context canceled", err) + r.Retryable = aws.Bool(false) + return + } + + // when the expired token exception occurs the credentials + // need to be expired locally so that the next request to + // get credentials will trigger a credentials refresh. + if p, ok := r.Config.Credentials.(sdk.Invalidator); ok && r.IsErrorExpired() { + p.Invalidate() + } + + r.RetryCount++ + r.Error = nil + } +}} + +// ValidateEndpointHandler is a request handler to validate a request had the +// appropriate Region and Endpoint set. Will set r.Error if the endpoint or +// region is not valid. +var ValidateEndpointHandler = aws.NamedHandler{Name: "core.ValidateEndpointHandler", Fn: func(r *aws.Request) { + if r.Metadata.SigningRegion == "" && r.Config.Region == "" { + r.Error = aws.ErrMissingRegion + } else if r.Metadata.Endpoint == "" { + r.Error = aws.ErrMissingEndpoint + } +}} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/param_validator.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/param_validator.go new file mode 100644 index 000000000000..cbac627a53c4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/param_validator.go @@ -0,0 +1,19 @@ +package defaults + +import ( + "github.com/aws/aws-sdk-go-v2/aws" +) + +// ValidateParametersHandler is a request handler to validate the input parameters. +// Validating parameters only has meaning if done prior to the request being sent. +var ValidateParametersHandler = aws.NamedHandler{Name: "core.ValidateParametersHandler", Fn: func(r *aws.Request) { + if !r.ParamsFilled() { + return + } + + if v, ok := r.Params.(aws.Validator); ok { + if err := v.Validate(); err != nil { + r.Error = err + } + } +}} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/user_agent_handlers.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/user_agent_handlers.go new file mode 100644 index 000000000000..c911f06602f2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/defaults/user_agent_handlers.go @@ -0,0 +1,36 @@ +package defaults + +import ( + "os" + "runtime" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// SDKVersionUserAgentHandler is a request handler for adding the SDK Version +// to the user agent. +var SDKVersionUserAgentHandler = aws.NamedHandler{ + Name: "core.SDKVersionUserAgentHandler", + Fn: aws.MakeAddToUserAgentHandler(aws.SDKName, aws.SDKVersion, + runtime.Version(), runtime.GOOS, runtime.GOARCH), +} + +const execEnvVar = `AWS_EXECUTION_ENV` +const execEnvUAKey = `exec_env` + +// AddHostExecEnvUserAgentHander is a request handler appending the SDK's +// execution environment to the user agent. +// +// If the environment variable AWS_EXECUTION_ENV is set, its value will be +// appended to the user agent string. +var AddHostExecEnvUserAgentHander = aws.NamedHandler{ + Name: "core.AddHostExecEnvUserAgentHander", + Fn: func(r *aws.Request) { + v := os.Getenv(execEnvVar) + if len(v) == 0 { + return + } + + aws.AddToUserAgent(r, execEnvUAKey+"/"+v) + }, +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/doc.go new file mode 100644 index 000000000000..4fcb6161848e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/doc.go @@ -0,0 +1,56 @@ +// Package aws provides the core SDK's utilities and shared types. Use this package's +// utilities to simplify setting and reading API operations parameters. +// +// Value and Pointer Conversion Utilities +// +// This package includes a helper conversion utility for each scalar type the SDK's +// API use. These utilities make getting a pointer of the scalar, and dereferencing +// a pointer easier. +// +// Each conversion utility comes in two forms. Value to Pointer and Pointer to Value. +// The Pointer to value will safely dereference the pointer and return its value. +// If the pointer was nil, the scalar's zero value will be returned. +// +// The value to pointer functions will be named after the scalar type. So get a +// *string from a string value use the "String" function. This makes it easy to +// to get pointer of a literal string value, because getting the address of a +// literal requires assigning the value to a variable first. +// +// var strPtr *string +// +// // Without the SDK's conversion functions +// str := "my string" +// strPtr = &str +// +// // With the SDK's conversion functions +// strPtr = aws.String("my string") +// +// // Convert *string to string value +// str = aws.StringValue(strPtr) +// +// In addition to scalars the aws package also includes conversion utilities for +// map and slice for commonly types used in API parameters. The map and slice +// conversion functions use similar naming pattern as the scalar conversion +// functions. +// +// var strPtrs []*string +// var strs []string = []string{"Go", "Gophers", "Go"} +// +// // Convert []string to []*string +// strPtrs = aws.StringSlice(strs) +// +// // Convert []*string to []string +// strs = aws.StringValueSlice(strPtrs) +// +// SDK Default HTTP Client +// +// The SDK will use the http.DefaultClient if a HTTP client is not provided to +// the SDK's Session, or service client constructor. This means that if the +// http.DefaultClient is modified by other components of your application the +// modifications will be picked up by the SDK as well. +// +// In some cases this might be intended, but it is a better practice to create +// a custom HTTP Client to share explicitly through your application. You can +// configure the SDK to use the custom HTTP Client by setting the HTTPClient +// value of the SDK's Config type when creating a Session or service client. +package aws diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/api.go new file mode 100644 index 000000000000..3233acd0da95 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/api.go @@ -0,0 +1,162 @@ +package ec2metadata + +import ( + "encoding/json" + "fmt" + "net/http" + "path" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// GetMetadata uses the path provided to request information from the EC2 +// instance metdata service. The content will be returned as a string, or +// error if the request failed. +func (c *EC2Metadata) GetMetadata(p string) (string, error) { + op := &aws.Operation{ + Name: "GetMetadata", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "meta-data", p), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + + return output.Content, req.Send() +} + +// GetUserData returns the userdata that was configured for the service. If +// there is no user-data setup for the EC2 instance a "NotFoundError" error +// code will be returned. +func (c *EC2Metadata) GetUserData() (string, error) { + op := &aws.Operation{ + Name: "GetUserData", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "user-data"), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + req.Handlers.UnmarshalError.PushBack(func(r *aws.Request) { + if r.HTTPResponse.StatusCode == http.StatusNotFound { + r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) + } + }) + + return output.Content, req.Send() +} + +// GetDynamicData uses the path provided to request information from the EC2 +// instance metadata service for dynamic data. The content will be returned +// as a string, or error if the request failed. +func (c *EC2Metadata) GetDynamicData(p string) (string, error) { + op := &aws.Operation{ + Name: "GetDynamicData", + HTTPMethod: "GET", + HTTPPath: path.Join("/", "dynamic", p), + } + + output := &metadataOutput{} + req := c.NewRequest(op, nil, output) + + return output.Content, req.Send() +} + +// GetInstanceIdentityDocument retrieves an identity document describing an +// instance. Error is returned if the request fails or is unable to parse +// the response. +func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument, error) { + resp, err := c.GetDynamicData("instance-identity/document") + if err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 instance identity document", err) + } + + doc := EC2InstanceIdentityDocument{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { + return EC2InstanceIdentityDocument{}, + awserr.New("SerializationError", + "failed to decode EC2 instance identity document", err) + } + + return doc, nil +} + +// IAMInfo retrieves IAM info from the metadata API +func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { + resp, err := c.GetMetadata("iam/info") + if err != nil { + return EC2IAMInfo{}, + awserr.New("EC2MetadataRequestError", + "failed to get EC2 IAM info", err) + } + + info := EC2IAMInfo{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { + return EC2IAMInfo{}, + awserr.New("SerializationError", + "failed to decode EC2 IAM info", err) + } + + if info.Code != "Success" { + errMsg := fmt.Sprintf("failed to get EC2 IAM Info (%s)", info.Code) + return EC2IAMInfo{}, + awserr.New("EC2MetadataError", errMsg, nil) + } + + return info, nil +} + +// Region returns the region the instance is running in. +func (c *EC2Metadata) Region() (string, error) { + resp, err := c.GetMetadata("placement/availability-zone") + if err != nil { + return "", err + } + + // returns region without the suffix. Eg: us-west-2a becomes us-west-2 + return resp[:len(resp)-1], nil +} + +// Available returns if the application has access to the EC2 Metadata service. +// Can be used to determine if application is running within an EC2 Instance and +// the metadata service is available. +func (c *EC2Metadata) Available() bool { + if _, err := c.GetMetadata("instance-id"); err != nil { + return false + } + + return true +} + +// An EC2IAMInfo provides the shape for unmarshaling +// an IAM info from the metadata API +type EC2IAMInfo struct { + Code string + LastUpdated time.Time + InstanceProfileArn string + InstanceProfileID string +} + +// An EC2InstanceIdentityDocument provides the shape for unmarshaling +// an instance identity document +type EC2InstanceIdentityDocument struct { + DevpayProductCodes []string `json:"devpayProductCodes"` + AvailabilityZone string `json:"availabilityZone"` + PrivateIP string `json:"privateIp"` + Version string `json:"version"` + Region string `json:"region"` + InstanceID string `json:"instanceId"` + BillingProducts []string `json:"billingProducts"` + InstanceType string `json:"instanceType"` + AccountID string `json:"accountId"` + PendingTime time.Time `json:"pendingTime"` + ImageID string `json:"imageId"` + KernelID string `json:"kernelId"` + RamdiskID string `json:"ramdiskId"` + Architecture string `json:"architecture"` +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/service.go new file mode 100644 index 000000000000..5c0a7e69cde8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2metadata/service.go @@ -0,0 +1,110 @@ +// Package ec2metadata provides the client for making API calls to the +// EC2 Metadata service. +// +// This package's client can be disabled completely by setting the environment +// variable "AWS_EC2_METADATA_DISABLED=true". This environment variable set to +// true instructs the SDK to disable the EC2 Metadata client. The client cannot +// be used while the environemnt variable is set to true, (case insensitive). +package ec2metadata + +import ( + "bytes" + "errors" + "io" + "net/http" + "os" + "strings" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/aws/defaults" +) + +// ServiceName is the name of the service. +const ServiceName = "ec2metadata" +const disableServiceEnvVar = "AWS_EC2_METADATA_DISABLED" + +// A EC2Metadata is an EC2 Metadata service Client. +type EC2Metadata struct { + *aws.Client +} + +// New creates a new instance of the EC2Metadata client with a Config. +// This client is safe to use across multiple goroutines. +// +// Example: +// // Create a EC2Metadata client from just a config. +// svc := ec2metadata.New(cfg) +func New(config aws.Config) *EC2Metadata { + svc := &EC2Metadata{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + APIVersion: "latest", + }, + ), + } + + svc.Handlers.Unmarshal.PushBack(unmarshalHandler) + svc.Handlers.UnmarshalError.PushBack(unmarshalError) + svc.Handlers.Validate.Clear() + svc.Handlers.Validate.PushBack(validateEndpointHandler) + + // Disable the EC2 Metadata service if the environment variable is set. + // This shortcirctes the service's functionality to always fail to send + // requests. + if strings.ToLower(os.Getenv(disableServiceEnvVar)) == "true" { + svc.Handlers.Send.SwapNamed(aws.NamedHandler{ + Name: defaults.SendHandler.Name, + Fn: func(r *aws.Request) { + r.Error = awserr.New( + aws.ErrCodeRequestCanceled, + "EC2 IMDS access disabled via "+disableServiceEnvVar+" env var", + nil) + }, + }) + } + + return svc +} + +func httpClientZero(c *http.Client) bool { + return c == nil || (c.Transport == nil && c.CheckRedirect == nil && c.Jar == nil && c.Timeout == 0) +} + +type metadataOutput struct { + Content string +} + +func unmarshalHandler(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + b := &bytes.Buffer{} + if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { + r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata respose", err) + return + } + + if data, ok := r.Data.(*metadataOutput); ok { + data.Content = b.String() + } +} + +func unmarshalError(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + b := &bytes.Buffer{} + if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { + r.Error = awserr.New("SerializationError", "unable to unmarshal EC2 metadata error respose", err) + return + } + + // Response body format is not consistent between metadata endpoints. + // Grab the error message as a string and include that as the source error + r.Error = awserr.New("EC2MetadataError", "failed to make EC2Metadata request", errors.New(b.String())) +} + +func validateEndpointHandler(r *aws.Request) { + if r.Metadata.Endpoint == "" { + r.Error = aws.ErrMissingEndpoint + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2rolecreds/provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2rolecreds/provider.go new file mode 100644 index 000000000000..b8290bf29b65 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/ec2rolecreds/provider.go @@ -0,0 +1,155 @@ +package ec2rolecreds + +import ( + "bufio" + "encoding/json" + "fmt" + "path" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/aws/ec2metadata" +) + +// ProviderName provides a name of EC2Role provider +const ProviderName = "EC2RoleProvider" + +// A Provider retrieves credentials from the EC2 service, and keeps track if +// those credentials are expired. +// +// The NewProvider function must be used to create the Provider. +// +// p := &ec2rolecreds.NewProvider(ec2metadata.New(cfg)) +// +// // Expire the credentials 10 minutes before IAM states they should. Proactivily +// // refreshing the credentials. +// p.ExpiryWindow = 10 * time.Minute +type Provider struct { + aws.SafeCredentialsProvider + + // Required EC2Metadata client to use when connecting to EC2 metadata service. + Client *ec2metadata.EC2Metadata + + // ExpiryWindow will allow the credentials to trigger refreshing prior to + // the credentials actually expiring. This is beneficial so race conditions + // with expiring credentials do not cause request to fail unexpectedly + // due to ExpiredTokenException exceptions. + // + // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true + // 10 seconds before the credentials are actually expired. + // + // If ExpiryWindow is 0 or less it will be ignored. + ExpiryWindow time.Duration +} + +// NewProvider returns an initialized Provider value configured to retrieve +// credentials from EC2 Instance Metadata service. +func NewProvider(client *ec2metadata.EC2Metadata) *Provider { + p := &Provider{ + Client: client, + } + p.RetrieveFn = p.retrieveFn + + return p +} + +// Retrieve retrieves credentials from the EC2 service. +// Error will be returned if the request fails, or unable to extract +// the desired credentials. +func (p *Provider) retrieveFn() (aws.Credentials, error) { + credsList, err := requestCredList(p.Client) + if err != nil { + return aws.Credentials{}, err + } + + if len(credsList) == 0 { + return aws.Credentials{}, + awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil) + } + credsName := credsList[0] + + roleCreds, err := requestCred(p.Client, credsName) + if err != nil { + return aws.Credentials{}, err + } + + creds := aws.Credentials{ + AccessKeyID: roleCreds.AccessKeyID, + SecretAccessKey: roleCreds.SecretAccessKey, + SessionToken: roleCreds.Token, + Source: ProviderName, + + CanExpire: true, + Expires: roleCreds.Expiration.Add(-p.ExpiryWindow), + } + + return creds, nil +} + +// A ec2RoleCredRespBody provides the shape for unmarshaling credential +// request responses. +type ec2RoleCredRespBody struct { + // Success State + Expiration time.Time + AccessKeyID string + SecretAccessKey string + Token string + + // Error state + Code string + Message string +} + +const iamSecurityCredsPath = "/iam/security-credentials" + +// requestCredList requests a list of credentials from the EC2 service. +// If there are no credentials, or there is an error making or receiving the request +func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { + resp, err := client.GetMetadata(iamSecurityCredsPath) + if err != nil { + return nil, awserr.New("EC2RoleRequestError", "no EC2 instance role found", err) + } + + credsList := []string{} + s := bufio.NewScanner(strings.NewReader(resp)) + for s.Scan() { + credsList = append(credsList, s.Text()) + } + + if err := s.Err(); err != nil { + return nil, awserr.New("SerializationError", "failed to read EC2 instance role from metadata service", err) + } + + return credsList, nil +} + +// requestCred requests the credentials for a specific credentials from the EC2 service. +// +// If the credentials cannot be found, or there is an error reading the response +// and error will be returned. +func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCredRespBody, error) { + resp, err := client.GetMetadata(path.Join(iamSecurityCredsPath, credsName)) + if err != nil { + return ec2RoleCredRespBody{}, + awserr.New("EC2RoleRequestError", + fmt.Sprintf("failed to get %s EC2 instance role credentials", credsName), + err) + } + + respCreds := ec2RoleCredRespBody{} + if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { + return ec2RoleCredRespBody{}, + awserr.New("SerializationError", + fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), + err) + } + + if respCreds.Code != "Success" { + // If an error code was returned something failed requesting the role. + return ec2RoleCredRespBody{}, awserr.New(respCreds.Code, respCreds.Message, nil) + } + + return respCreds, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpointcreds/provider.go new file mode 100644 index 000000000000..dac05347752e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpointcreds/provider.go @@ -0,0 +1,167 @@ +// Package endpointcreds provides support for retrieving credentials from an +// arbitrary HTTP endpoint. +// +// The credentials endpoint Provider can receive both static and refreshable +// credentials that will expire. Credentials are static when an "Expiration" +// value is not provided in the endpoint's response. +// +// Static credentials will never expire once they have been retrieved. The format +// of the static credentials response: +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// } +// +// Refreshable credentials will expire within the "ExpiryWindow" of the Expiration +// value in the response. The format of the refreshable credentials response: +// { +// "AccessKeyId" : "MUA...", +// "SecretAccessKey" : "/7PC5om....", +// "Token" : "AQoDY....=", +// "Expiration" : "2016-02-25T06:03:31Z" +// } +// +// Errors should be returned in the following format and only returned with 400 +// or 500 HTTP status codes. +// { +// "code": "ErrorCode", +// "message": "Helpful error message." +// } +package endpointcreds + +import ( + "encoding/json" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// ProviderName is the name of the credentials provider. +const ProviderName = `CredentialsEndpointProvider` + +// Provider satisfies the aws.CredentialsProvider interface, and is a client to +// retrieve credentials from an arbitrary endpoint. +type Provider struct { + aws.SafeCredentialsProvider + + // The AWS Client to make HTTP requests to the endpoint with. The endpoint + // the request will be made to is provided by the aws.Config's + // EndpointResolver. + Client *aws.Client + + // ExpiryWindow will allow the credentials to trigger refreshing prior to + // the credentials actually expiring. This is beneficial so race conditions + // with expiring credentials do not cause request to fail unexpectedly + // due to ExpiredTokenException exceptions. + // + // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true + // 10 seconds before the credentials are actually expired. + // + // If ExpiryWindow is 0 or less it will be ignored. + ExpiryWindow time.Duration +} + +// New returns a credentials Provider for retrieving AWS credentials +// from arbitrary endpoint. +func New(cfg aws.Config) *Provider { + p := &Provider{ + Client: aws.NewClient( + cfg, + aws.Metadata{ + ServiceName: ProviderName, + }, + ), + } + p.RetrieveFn = p.retrieveFn + + p.Client.Handlers.Unmarshal.PushBack(unmarshalHandler) + p.Client.Handlers.UnmarshalError.PushBack(unmarshalError) + p.Client.Handlers.Validate.Clear() + p.Client.Handlers.Validate.PushBack(validateEndpointHandler) + + return p +} + +// Retrieve will attempt to request the credentials from the endpoint the Provider +// was configured for. And error will be returned if the retrieval fails. +func (p *Provider) retrieveFn() (aws.Credentials, error) { + resp, err := p.getCredentials() + if err != nil { + return aws.Credentials{}, + awserr.New("CredentialsEndpointError", "failed to load credentials", err) + } + + creds := aws.Credentials{ + AccessKeyID: resp.AccessKeyID, + SecretAccessKey: resp.SecretAccessKey, + SessionToken: resp.Token, + Source: ProviderName, + } + + if resp.Expiration != nil { + creds.CanExpire = true + creds.Expires = resp.Expiration.Add(-p.ExpiryWindow) + } + + return creds, nil +} + +type getCredentialsOutput struct { + Expiration *time.Time + AccessKeyID string + SecretAccessKey string + Token string +} + +type errorOutput struct { + Code string `json:"code"` + Message string `json:"message"` +} + +func (p *Provider) getCredentials() (*getCredentialsOutput, error) { + op := &aws.Operation{ + Name: "GetCredentials", + HTTPMethod: "GET", + } + + out := &getCredentialsOutput{} + req := p.Client.NewRequest(op, nil, out) + req.HTTPRequest.Header.Set("Accept", "application/json") + + return out, req.Send() +} + +func validateEndpointHandler(r *aws.Request) { + if len(r.Metadata.Endpoint) == 0 { + r.Error = aws.ErrMissingEndpoint + } +} + +func unmarshalHandler(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + + out := r.Data.(*getCredentialsOutput) + if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { + r.Error = awserr.New("SerializationError", + "failed to decode endpoint credentials", + err, + ) + } +} + +func unmarshalError(r *aws.Request) { + defer r.HTTPResponse.Body.Close() + + var errOut errorOutput + if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&errOut); err != nil { + r.Error = awserr.New("SerializationError", + "failed to decode endpoint credentials", + err, + ) + } + + // Response body format is not consistent between metadata endpoints. + // Grab the error message as a string and include that as the source error + r.Error = awserr.New(errOut.Code, errOut.Message, nil) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints.go new file mode 100644 index 000000000000..3dad528d411c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints.go @@ -0,0 +1,52 @@ +package aws + +// EndpointResolver resolves an endpoint for a service endpoint id and region. +type EndpointResolver interface { + ResolveEndpoint(service, region string) (Endpoint, error) +} + +// EndpointResolverFunc is a helper utility that wraps a function so it satisfies the +// Resolver interface. This is useful when you want to add additional endpoint +// resolving logic, or stub out specific endpoints with custom values. +type EndpointResolverFunc func(service, region string) (Endpoint, error) + +// ResolveEndpoint calls EndpointResolverFunc returning the endpoint, or error. +func (fn EndpointResolverFunc) ResolveEndpoint(service, region string) (Endpoint, error) { + return fn(service, region) +} + +// ResolveWithEndpoint allows a static Resolved Endpoint to be used as an endpoint resolver +type ResolveWithEndpoint Endpoint + +// ResolveWithEndpointURL allows a static URL to be used as a endpoint resolver. +func ResolveWithEndpointURL(url string) ResolveWithEndpoint { + return ResolveWithEndpoint(Endpoint{URL: url}) +} + +// ResolveEndpoint returns the static endpoint. +func (v ResolveWithEndpoint) ResolveEndpoint(service, region string) (Endpoint, error) { + e := Endpoint(v) + e.SigningRegion = region + return e, nil +} + +// Endpoint represents the endpoint a service client should make requests to. +type Endpoint struct { + // The URL of the endpoint. + URL string + + // The service name that should be used for signing the requests to the + // endpoint. + SigningName string + + // The region that should be used for signing the request to the endpoint. + SigningRegion string + + // States that the signing name for this endpoint was derived from metadata + // passed in, but was not explicitly modeled. + SigningNameDerived bool + + // The signing method that should be used for signign the requests to the + // endpoint. + SigningMethod string +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/decode.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/decode.go new file mode 100644 index 000000000000..535f81bb25f0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/decode.go @@ -0,0 +1,143 @@ +package endpoints + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +type modelDefinition map[string]json.RawMessage + +// A DecodeModelOptions are the options for how the endpoints model definition +// are decoded. +type DecodeModelOptions struct { + SkipCustomizations bool +} + +// Set combines all of the option functions together. +func (d *DecodeModelOptions) Set(optFns ...func(*DecodeModelOptions)) { + for _, fn := range optFns { + fn(d) + } +} + +// DecodeModel unmarshals a Regions and Endpoint model definition file into +// a endpoint Resolver. If the file format is not supported, or an error occurs +// when unmarshaling the model an error will be returned. +// +// Casting the return value of this func to a EnumPartitions will +// allow you to get a list of the partitions in the order the endpoints +// will be resolved in. +// +// resolver, err := endpoints.DecodeModel(reader) +// +// partitions := resolver.Partitions() +// for _, p := range partitions { +// // ... inspect partitions +// } +func DecodeModel(r io.Reader, optFns ...func(*DecodeModelOptions)) (*Resolver, error) { + var opts DecodeModelOptions + opts.Set(optFns...) + + // Get the version of the partition file to determine what + // unmarshaling model to use. + modelDef := modelDefinition{} + if err := json.NewDecoder(r).Decode(&modelDef); err != nil { + return nil, newDecodeModelError("failed to decode endpoints model", err) + } + + var version string + if b, ok := modelDef["version"]; ok { + version = string(b) + } else { + return nil, newDecodeModelError("endpoints version not found in model", nil) + } + + if version == "3" { + return decodeV3Endpoints(modelDef, opts) + } + + return nil, newDecodeModelError( + fmt.Sprintf("endpoints version %s, not supported", version), nil) +} + +func decodeV3Endpoints(modelDef modelDefinition, opts DecodeModelOptions) (*Resolver, error) { + b, ok := modelDef["partitions"] + if !ok { + return nil, newDecodeModelError("endpoints model missing partitions", nil) + } + + ps := partitions{} + if err := json.Unmarshal(b, &ps); err != nil { + return nil, newDecodeModelError("failed to decode endpoints model", err) + } + + if opts.SkipCustomizations { + return &Resolver{partitions: ps}, nil + } + + // Customization + for i := 0; i < len(ps); i++ { + p := &ps[i] + custAddEC2Metadata(p) + custAddS3DualStack(p) + custSetUnresolveServices(p) + } + + return &Resolver{partitions: ps}, nil +} + +func custAddS3DualStack(p *partition) { + if p.ID != "aws" { + return + } + + s, ok := p.Services["s3"] + if !ok { + return + } + + s.Defaults.HasDualStack = boxedTrue + s.Defaults.DualStackHostname = "{service}.dualstack.{region}.{dnsSuffix}" + + p.Services["s3"] = s +} + +func custAddEC2Metadata(p *partition) { + p.Services["ec2metadata"] = service{ + IsRegionalized: boxedFalse, + PartitionEndpoint: "aws-global", + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "169.254.169.254/latest", + Protocols: []string{"http"}, + }, + }, + } +} + +func custSetUnresolveServices(p *partition) { + var ids = map[string]struct{}{ + "data.iot": {}, + "cloudsearchdomain": {}, + } + for id := range ids { + p.Services[id] = service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + } + } +} + +type decodeModelError struct { + awsError +} + +func newDecodeModelError(msg string, err error) decodeModelError { + return decodeModelError{ + awsError: awserr.New("DecodeEndpointsModelError", msg, err), + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/defaults.go new file mode 100644 index 000000000000..11e0f7d1c250 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/defaults.go @@ -0,0 +1,3362 @@ +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. + +package endpoints + +import ( + "regexp" +) + +// Partition identifiers +const ( + AwsPartitionID = "aws" // AWS Standard partition. + AwsCnPartitionID = "aws-cn" // AWS China partition. + AwsUsGovPartitionID = "aws-us-gov" // AWS GovCloud (US) partition. +) + +// AWS Standard partition's regions. +const ( + ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). + ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). + ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). + ApSoutheast1RegionID = "ap-southeast-1" // Asia Pacific (Singapore). + ApSoutheast2RegionID = "ap-southeast-2" // Asia Pacific (Sydney). + CaCentral1RegionID = "ca-central-1" // Canada (Central). + EuCentral1RegionID = "eu-central-1" // EU (Frankfurt). + EuWest1RegionID = "eu-west-1" // EU (Ireland). + EuWest2RegionID = "eu-west-2" // EU (London). + EuWest3RegionID = "eu-west-3" // EU (Paris). + SaEast1RegionID = "sa-east-1" // South America (Sao Paulo). + UsEast1RegionID = "us-east-1" // US East (N. Virginia). + UsEast2RegionID = "us-east-2" // US East (Ohio). + UsWest1RegionID = "us-west-1" // US West (N. California). + UsWest2RegionID = "us-west-2" // US West (Oregon). +) + +// AWS China partition's regions. +const ( + CnNorth1RegionID = "cn-north-1" // China (Beijing). + CnNorthwest1RegionID = "cn-northwest-1" // China (Ningxia). +) + +// AWS GovCloud (US) partition's regions. +const ( + UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US). +) + +// Service identifiers +const ( + A4bServiceID = "a4b" // A4b. + AcmServiceID = "acm" // Acm. + AcmPcaServiceID = "acm-pca" // AcmPca. + ApiMediatailorServiceID = "api.mediatailor" // ApiMediatailor. + ApiPricingServiceID = "api.pricing" // ApiPricing. + ApiSagemakerServiceID = "api.sagemaker" // ApiSagemaker. + ApigatewayServiceID = "apigateway" // Apigateway. + ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. + Appstream2ServiceID = "appstream2" // Appstream2. + AthenaServiceID = "athena" // Athena. + AutoscalingServiceID = "autoscaling" // Autoscaling. + AutoscalingPlansServiceID = "autoscaling-plans" // AutoscalingPlans. + BatchServiceID = "batch" // Batch. + BudgetsServiceID = "budgets" // Budgets. + CeServiceID = "ce" // Ce. + Cloud9ServiceID = "cloud9" // Cloud9. + ClouddirectoryServiceID = "clouddirectory" // Clouddirectory. + CloudformationServiceID = "cloudformation" // Cloudformation. + CloudfrontServiceID = "cloudfront" // Cloudfront. + CloudhsmServiceID = "cloudhsm" // Cloudhsm. + Cloudhsmv2ServiceID = "cloudhsmv2" // Cloudhsmv2. + CloudsearchServiceID = "cloudsearch" // Cloudsearch. + CloudsearchdomainServiceID = "cloudsearchdomain" // Cloudsearchdomain. + CloudtrailServiceID = "cloudtrail" // Cloudtrail. + CodebuildServiceID = "codebuild" // Codebuild. + CodecommitServiceID = "codecommit" // Codecommit. + CodedeployServiceID = "codedeploy" // Codedeploy. + CodepipelineServiceID = "codepipeline" // Codepipeline. + CodestarServiceID = "codestar" // Codestar. + CognitoIdentityServiceID = "cognito-identity" // CognitoIdentity. + CognitoIdpServiceID = "cognito-idp" // CognitoIdp. + CognitoSyncServiceID = "cognito-sync" // CognitoSync. + ComprehendServiceID = "comprehend" // Comprehend. + ConfigServiceID = "config" // Config. + CurServiceID = "cur" // Cur. + DataIotServiceID = "data.iot" // DataIot. + DatapipelineServiceID = "datapipeline" // Datapipeline. + DaxServiceID = "dax" // Dax. + DevicefarmServiceID = "devicefarm" // Devicefarm. + DirectconnectServiceID = "directconnect" // Directconnect. + DiscoveryServiceID = "discovery" // Discovery. + DmsServiceID = "dms" // Dms. + DsServiceID = "ds" // Ds. + DynamodbServiceID = "dynamodb" // Dynamodb. + Ec2ServiceID = "ec2" // Ec2. + Ec2metadataServiceID = "ec2metadata" // Ec2metadata. + EcrServiceID = "ecr" // Ecr. + EcsServiceID = "ecs" // Ecs. + ElasticacheServiceID = "elasticache" // Elasticache. + ElasticbeanstalkServiceID = "elasticbeanstalk" // Elasticbeanstalk. + ElasticfilesystemServiceID = "elasticfilesystem" // Elasticfilesystem. + ElasticloadbalancingServiceID = "elasticloadbalancing" // Elasticloadbalancing. + ElasticmapreduceServiceID = "elasticmapreduce" // Elasticmapreduce. + ElastictranscoderServiceID = "elastictranscoder" // Elastictranscoder. + EmailServiceID = "email" // Email. + EntitlementMarketplaceServiceID = "entitlement.marketplace" // EntitlementMarketplace. + EsServiceID = "es" // Es. + EventsServiceID = "events" // Events. + FirehoseServiceID = "firehose" // Firehose. + FmsServiceID = "fms" // Fms. + GameliftServiceID = "gamelift" // Gamelift. + GlacierServiceID = "glacier" // Glacier. + GlueServiceID = "glue" // Glue. + GreengrassServiceID = "greengrass" // Greengrass. + GuarddutyServiceID = "guardduty" // Guardduty. + HealthServiceID = "health" // Health. + IamServiceID = "iam" // Iam. + ImportexportServiceID = "importexport" // Importexport. + InspectorServiceID = "inspector" // Inspector. + IotServiceID = "iot" // Iot. + IotanalyticsServiceID = "iotanalytics" // Iotanalytics. + KinesisServiceID = "kinesis" // Kinesis. + KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. + KinesisvideoServiceID = "kinesisvideo" // Kinesisvideo. + KmsServiceID = "kms" // Kms. + LambdaServiceID = "lambda" // Lambda. + LightsailServiceID = "lightsail" // Lightsail. + LogsServiceID = "logs" // Logs. + MachinelearningServiceID = "machinelearning" // Machinelearning. + MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. + MediaconvertServiceID = "mediaconvert" // Mediaconvert. + MedialiveServiceID = "medialive" // Medialive. + MediapackageServiceID = "mediapackage" // Mediapackage. + MediastoreServiceID = "mediastore" // Mediastore. + MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. + MghServiceID = "mgh" // Mgh. + MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. + ModelsLexServiceID = "models.lex" // ModelsLex. + MonitoringServiceID = "monitoring" // Monitoring. + MturkRequesterServiceID = "mturk-requester" // MturkRequester. + NeptuneServiceID = "neptune" // Neptune. + OpsworksServiceID = "opsworks" // Opsworks. + OpsworksCmServiceID = "opsworks-cm" // OpsworksCm. + OrganizationsServiceID = "organizations" // Organizations. + PinpointServiceID = "pinpoint" // Pinpoint. + PollyServiceID = "polly" // Polly. + RdsServiceID = "rds" // Rds. + RedshiftServiceID = "redshift" // Redshift. + RekognitionServiceID = "rekognition" // Rekognition. + ResourceGroupsServiceID = "resource-groups" // ResourceGroups. + Route53ServiceID = "route53" // Route53. + Route53domainsServiceID = "route53domains" // Route53domains. + RuntimeLexServiceID = "runtime.lex" // RuntimeLex. + RuntimeSagemakerServiceID = "runtime.sagemaker" // RuntimeSagemaker. + S3ServiceID = "s3" // S3. + SdbServiceID = "sdb" // Sdb. + SecretsmanagerServiceID = "secretsmanager" // Secretsmanager. + ServerlessrepoServiceID = "serverlessrepo" // Serverlessrepo. + ServicecatalogServiceID = "servicecatalog" // Servicecatalog. + ServicediscoveryServiceID = "servicediscovery" // Servicediscovery. + ShieldServiceID = "shield" // Shield. + SmsServiceID = "sms" // Sms. + SnowballServiceID = "snowball" // Snowball. + SnsServiceID = "sns" // Sns. + SqsServiceID = "sqs" // Sqs. + SsmServiceID = "ssm" // Ssm. + StatesServiceID = "states" // States. + StoragegatewayServiceID = "storagegateway" // Storagegateway. + StreamsDynamodbServiceID = "streams.dynamodb" // StreamsDynamodb. + StsServiceID = "sts" // Sts. + SupportServiceID = "support" // Support. + SwfServiceID = "swf" // Swf. + TaggingServiceID = "tagging" // Tagging. + TranslateServiceID = "translate" // Translate. + WafServiceID = "waf" // Waf. + WafRegionalServiceID = "waf-regional" // WafRegional. + WorkdocsServiceID = "workdocs" // Workdocs. + WorkmailServiceID = "workmail" // Workmail. + WorkspacesServiceID = "workspaces" // Workspaces. + XrayServiceID = "xray" // Xray. +) + +// NewDefaultResolver returns an Endpoint resolver that will be able +// to resolve endpoints for: AWS Standard, AWS China, and AWS GovCloud (US). +// +// Use DefaultPartitions() to get the list of the default partitions. +func NewDefaultResolver() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +// DefaultPartitions returns a list of the partitions the SDK is bundled +// with. The available partitions are: AWS Standard, AWS China, and AWS GovCloud (US). +// +// partitions := endpoints.DefaultPartitions +// for _, p := range partitions { +// // ... inspect partitions +// } +func DefaultPartitions() Partitions { + return defaultPartitions.Partitions() +} + +var defaultPartitions = partitions{ + awsPartition, + awscnPartition, + awsusgovPartition, +} + +// AwsPartition returns the Resolver for AWS Standard. +func AwsPartition() Partition { + return awsPartition.Partition() +} + +var awsPartition = partition{ + ID: "aws", + Name: "AWS Standard", + DNSSuffix: "amazonaws.com", + RegionRegex: regionRegex{ + Regexp: func() *regexp.Regexp { + reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$") + return reg + }(), + }, + Defaults: endpoint{ + Hostname: "{service}.{region}.{dnsSuffix}", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + Regions: regions{ + "ap-northeast-1": region{ + Description: "Asia Pacific (Tokyo)", + }, + "ap-northeast-2": region{ + Description: "Asia Pacific (Seoul)", + }, + "ap-south-1": region{ + Description: "Asia Pacific (Mumbai)", + }, + "ap-southeast-1": region{ + Description: "Asia Pacific (Singapore)", + }, + "ap-southeast-2": region{ + Description: "Asia Pacific (Sydney)", + }, + "ca-central-1": region{ + Description: "Canada (Central)", + }, + "eu-central-1": region{ + Description: "EU (Frankfurt)", + }, + "eu-west-1": region{ + Description: "EU (Ireland)", + }, + "eu-west-2": region{ + Description: "EU (London)", + }, + "eu-west-3": region{ + Description: "EU (Paris)", + }, + "sa-east-1": region{ + Description: "South America (Sao Paulo)", + }, + "us-east-1": region{ + Description: "US East (N. Virginia)", + }, + "us-east-2": region{ + Description: "US East (Ohio)", + }, + "us-west-1": region{ + Description: "US West (N. California)", + }, + "us-west-2": region{ + Description: "US West (Oregon)", + }, + }, + Services: services{ + "a4b": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "acm": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "acm-pca": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "api.mediatailor": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + }, + }, + "api.pricing": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "pricing", + }, + }, + Endpoints: endpoints{ + "ap-south-1": endpoint{}, + "us-east-1": endpoint{}, + }, + }, + "api.sagemaker": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "apigateway": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "application-autoscaling": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "application-autoscaling", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "appstream2": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + CredentialScope: credentialScope{ + Service: "appstream", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "athena": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "autoscaling": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "autoscaling-plans": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "autoscaling-plans", + }, + }, + Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "batch": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "budgets": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "budgets.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "ce": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "ce.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "cloud9": service{ + + Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "clouddirectory": service{ + + Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cloudformation": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cloudfront": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "cloudfront.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "cloudhsm": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cloudhsmv2": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "cloudhsm", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cloudsearch": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cloudsearchdomain": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "cloudtrail": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "codebuild": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "codebuild-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "codebuild-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "codebuild-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "codebuild-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "codecommit": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "codedeploy": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "codepipeline": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "codestar": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cognito-identity": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cognito-idp": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cognito-sync": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "comprehend": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "config": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "cur": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "data.iot": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "datapipeline": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "dax": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "devicefarm": service{ + + Endpoints: endpoints{ + "us-west-2": endpoint{}, + }, + }, + "directconnect": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "discovery": service{ + + Endpoints: endpoints{ + "us-west-2": endpoint{}, + }, + }, + "dms": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ds": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "dynamodb": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "local": endpoint{ + Hostname: "localhost:8000", + Protocols: []string{"http"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ec2": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ec2metadata": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "169.254.169.254/latest", + Protocols: []string{"http"}, + }, + }, + }, + "ecr": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ecs": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elasticache": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "fips": endpoint{ + Hostname: "elasticache-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elasticbeanstalk": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elasticfilesystem": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elasticloadbalancing": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elasticmapreduce": service{ + Defaults: endpoint{ + SSLCommonName: "{region}.{service}.{dnsSuffix}", + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{ + SSLCommonName: "{service}.{region}.{dnsSuffix}", + }, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{ + SSLCommonName: "{service}.{region}.{dnsSuffix}", + }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "elastictranscoder": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "email": service{ + + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "entitlement.marketplace": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "aws-marketplace", + }, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "es": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "events": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "firehose": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "fms": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "gamelift": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "glacier": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "glue": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "greengrass": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "guardduty": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "health": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "iam": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "iam.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "importexport": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "importexport.amazonaws.com", + SignatureVersions: []string{"v2", "v4"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + Service: "IngestionService", + }, + }, + }, + }, + "inspector": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "iot": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "execute-api", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "iotanalytics": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kinesis": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kinesisanalytics": service{ + + Endpoints: endpoints{ + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kinesisvideo": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kms": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "lambda": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "lightsail": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "logs": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "machinelearning": service{ + + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + }, + }, + "marketplacecommerceanalytics": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "mediaconvert": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "medialive": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "mediapackage": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "mediastore": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "metering.marketplace": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "aws-marketplace", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "mgh": service{ + + Endpoints: endpoints{ + "us-west-2": endpoint{}, + }, + }, + "mobileanalytics": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "models.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "monitoring": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "mturk-requester": service{ + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "sandbox": endpoint{ + Hostname: "mturk-requester-sandbox.us-east-1.amazonaws.com", + }, + "us-east-1": endpoint{}, + }, + }, + "neptune": service{ + + Endpoints: endpoints{ + "eu-west-1": endpoint{ + Hostname: "rds.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "rds.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "rds.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoint{ + Hostname: "rds.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "opsworks": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "opsworks-cm": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "organizations": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "organizations.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "pinpoint": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "mobiletargeting", + }, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "polly": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "rds": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{ + SSLCommonName: "{service}.{dnsSuffix}", + }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "redshift": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "rekognition": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "resource-groups": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "route53": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "route53.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "route53domains": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "runtime.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "runtime.sagemaker": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "s3": service{ + PartitionEndpoint: "us-east-1", + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + + HasDualStack: boxedTrue, + DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "s3.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{ + Hostname: "s3.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ap-southeast-2": endpoint{ + Hostname: "s3.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{ + Hostname: "s3.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "s3-external-1": endpoint{ + Hostname: "s3-external-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoint{ + Hostname: "s3.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-1": endpoint{ + Hostname: "s3.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{ + Hostname: "s3.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + "us-west-2": endpoint{ + Hostname: "s3.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3", "s3v4"}, + }, + }, + }, + "sdb": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"v2"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{ + Hostname: "sdb.amazonaws.com", + }, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "secretsmanager": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "secretsmanager-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "secretsmanager-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "secretsmanager-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "secretsmanager-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "serverlessrepo": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Protocols: []string{"https"}, + }, + "ap-northeast-2": endpoint{ + Protocols: []string{"https"}, + }, + "ap-south-1": endpoint{ + Protocols: []string{"https"}, + }, + "ap-southeast-1": endpoint{ + Protocols: []string{"https"}, + }, + "ap-southeast-2": endpoint{ + Protocols: []string{"https"}, + }, + "ca-central-1": endpoint{ + Protocols: []string{"https"}, + }, + "eu-central-1": endpoint{ + Protocols: []string{"https"}, + }, + "eu-west-1": endpoint{ + Protocols: []string{"https"}, + }, + "eu-west-2": endpoint{ + Protocols: []string{"https"}, + }, + "sa-east-1": endpoint{ + Protocols: []string{"https"}, + }, + "us-east-1": endpoint{ + Protocols: []string{"https"}, + }, + "us-east-2": endpoint{ + Protocols: []string{"https"}, + }, + "us-west-1": endpoint{ + Protocols: []string{"https"}, + }, + "us-west-2": endpoint{ + Protocols: []string{"https"}, + }, + }, + }, + "servicecatalog": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "servicediscovery": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "shield": service{ + IsRegionalized: boxedFalse, + Defaults: endpoint{ + SSLCommonName: "Shield.us-east-1.amazonaws.com", + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "sms": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "snowball": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "sns": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "sqs": service{ + Defaults: endpoint{ + SSLCommonName: "{region}.queue.{dnsSuffix}", + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "fips-us-east-1": endpoint{ + Hostname: "sqs-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "sqs-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoint{ + Hostname: "sqs-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "sqs-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{ + SSLCommonName: "queue.{dnsSuffix}", + }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ssm": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "states": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "storagegateway": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "streams.dynamodb": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "dynamodb", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "local": endpoint{ + Hostname: "localhost:8000", + Protocols: []string{"http"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "sts": service{ + PartitionEndpoint: "aws-global", + Defaults: endpoint{ + Hostname: "sts.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{ + Hostname: "sts.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "aws-global": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "sts-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "sts-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "sts-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "sts-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "support": service{ + + Endpoints: endpoints{ + "us-east-1": endpoint{}, + }, + }, + "swf": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "tagging": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "translate": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "translate-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "translate-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "translate-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "waf": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "waf.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, + "waf-regional": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "workdocs": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "workmail": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "workspaces": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "xray": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + }, +} + +// AwsCnPartition returns the Resolver for AWS China. +func AwsCnPartition() Partition { + return awscnPartition.Partition() +} + +var awscnPartition = partition{ + ID: "aws-cn", + Name: "AWS China", + DNSSuffix: "amazonaws.com.cn", + RegionRegex: regionRegex{ + Regexp: func() *regexp.Regexp { + reg, _ := regexp.Compile("^cn\\-\\w+\\-\\d+$") + return reg + }(), + }, + Defaults: endpoint{ + Hostname: "{service}.{region}.{dnsSuffix}", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + Regions: regions{ + "cn-north-1": region{ + Description: "China (Beijing)", + }, + "cn-northwest-1": region{ + Description: "China (Ningxia)", + }, + }, + Services: services{ + "apigateway": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "application-autoscaling": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "application-autoscaling", + }, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "autoscaling": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "cloudformation": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "cloudsearchdomain": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "cloudtrail": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "codebuild": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "codedeploy": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "cognito-identity": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "config": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "data.iot": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "directconnect": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "ds": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "dynamodb": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "ec2": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "ec2metadata": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "169.254.169.254/latest", + Protocols: []string{"http"}, + }, + }, + }, + "ecr": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "ecs": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "elasticache": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "elasticbeanstalk": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "elasticloadbalancing": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "elasticmapreduce": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "es": service{ + + Endpoints: endpoints{ + "cn-northwest-1": endpoint{}, + }, + }, + "events": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "glacier": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "iam": service{ + PartitionEndpoint: "aws-cn-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "iam.cn-north-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + }, + }, + "iot": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "execute-api", + }, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "kinesis": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "lambda": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "logs": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "monitoring": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "rds": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "redshift": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "s3": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + SignatureVersions: []string{"s3v4"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "sms": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "snowball": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "sns": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "sqs": service{ + Defaults: endpoint{ + SSLCommonName: "{region}.queue.{dnsSuffix}", + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "ssm": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "storagegateway": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, + "streams.dynamodb": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "dynamodb", + }, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "sts": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "swf": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "tagging": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + }, +} + +// AwsUsGovPartition returns the Resolver for AWS GovCloud (US). +func AwsUsGovPartition() Partition { + return awsusgovPartition.Partition() +} + +var awsusgovPartition = partition{ + ID: "aws-us-gov", + Name: "AWS GovCloud (US)", + DNSSuffix: "amazonaws.com", + RegionRegex: regionRegex{ + Regexp: func() *regexp.Regexp { + reg, _ := regexp.Compile("^us\\-gov\\-\\w+\\-\\d+$") + return reg + }(), + }, + Defaults: endpoint{ + Hostname: "{service}.{region}.{dnsSuffix}", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + Regions: regions{ + "us-gov-west-1": region{ + Description: "AWS GovCloud (US)", + }, + }, + Services: services{ + "acm": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "apigateway": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "application-autoscaling": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "autoscaling": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"http", "https"}, + }, + }, + }, + "cloudformation": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "cloudhsm": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "cloudhsmv2": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "cloudhsm", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "cloudsearchdomain": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "cloudtrail": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "codedeploy": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "config": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "data.iot": service{ + Defaults: endpoint{ + Unresolveable: boxedTrue, + }, + }, + "directconnect": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "dms": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "dynamodb": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "ec2": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "ec2metadata": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "169.254.169.254/latest", + Protocols: []string{"http"}, + }, + }, + }, + "ecr": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "ecs": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "elasticache": service{ + + Endpoints: endpoints{ + "fips": endpoint{ + Hostname: "elasticache-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-west-1": endpoint{}, + }, + }, + "elasticbeanstalk": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "elasticloadbalancing": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"http", "https"}, + }, + }, + }, + "elasticmapreduce": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"https"}, + }, + }, + }, + "es": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "events": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "glacier": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"http", "https"}, + }, + }, + }, + "iam": service{ + PartitionEndpoint: "aws-us-gov-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-us-gov-global": endpoint{ + Hostname: "iam.us-gov.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "inspector": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "iot": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "execute-api", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "kinesis": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "kms": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "lambda": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "logs": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "metering.marketplace": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "aws-marketplace", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "monitoring": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "polly": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "rds": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "redshift": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "rekognition": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "s3": service{ + Defaults: endpoint{ + SignatureVersions: []string{"s3", "s3v4"}, + }, + Endpoints: endpoints{ + "fips-us-gov-west-1": endpoint{ + Hostname: "s3-fips-us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-west-1": endpoint{ + Hostname: "s3.us-gov-west-1.amazonaws.com", + Protocols: []string{"http", "https"}, + }, + }, + }, + "sms": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "snowball": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "sns": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"http", "https"}, + }, + }, + }, + "sqs": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + SSLCommonName: "{region}.queue.{dnsSuffix}", + Protocols: []string{"http", "https"}, + }, + }, + }, + "ssm": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "states": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "storagegateway": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "streams.dynamodb": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "dynamodb", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "sts": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "swf": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "tagging": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "translate": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "translate-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + }, +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/doc.go new file mode 100644 index 000000000000..faf8723fe4a1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/doc.go @@ -0,0 +1,69 @@ +// Package endpoints provides the types and functionality for defining regions +// and endpoints, as well as querying those definitions. +// +// The SDK's Regions and Endpoints metadata is code generated into the endpoints +// package, and is accessible via the DefaultResolver function. This function +// returns a endpoint Resolver will search the metadata and build an associated +// endpoint if one is found. The default resolver will search all partitions +// known by the SDK. e.g AWS Standard (aws), AWS China (aws-cn), and +// AWS GovCloud (US) (aws-us-gov). +// . +// +// Enumerating Regions and Endpoint Metadata +// +// Casting the Resolver returned by DefaultResolver to a EnumPartitions interface +// will allow you to get access to the list of underlying Partitions with the +// Partitions method. This is helpful if you want to limit the SDK's endpoint +// resolving to a single partition, or enumerate regions, services, and endpoints +// in the partition. +// +// resolver := endpoints.NewDefaultResolver() +// partitions := resolver.Partitions() +// +// for _, p := range partitions { +// fmt.Println("Regions for", p.ID()) +// for id, _ := range p.Regions() { +// fmt.Println("*", id) +// } +// +// fmt.Println("Services for", p.ID()) +// for id, _ := range p.Services() { +// fmt.Println("*", id) +// } +// } +// +// Using Custom Endpoints +// +// The endpoints package also gives you the ability to use your own logic how +// endpoints are resolved. This is a great way to define a custom endpoint +// for select services, without passing that logic down through your code. +// +// If a type implements the Resolver interface it can be used to resolve +// endpoints. To use this with the SDK's Session and Config set the value +// of the type to the EndpointsResolver field of aws.Config when initializing +// the service client. +// +// In addition the ResolverFunc is a wrapper for a func matching the signature +// of Resolver.ResolveEndpoint, converting it to a type that satisfies the +// Resolver interface. +// +// +// defaultResolver := endpoints.NewDefaultResolver() +// myCustomResolver := func(service, region string) (aws.Endpoint, error) { +// if service == endpoints.S3ServiceID { +// return aws.Endpoint{ +// URL: "s3.custom.endpoint.com", +// SigningRegion: "custom-signing-region", +// }, nil +// } +// +// return defaultResolver.ResolveEndpoint(service, region) +// } +// +// cfg, err := external.LoadDefaultAWSConfig() +// if err != nil { +// panic(err) +// } +// cfg.Region = "us-west-2" +// cfg.EndpointResolver = aws.EndpointResolverFunc(myCustomResolver) +package endpoints diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/endpoints.go new file mode 100644 index 000000000000..194b57b6f83d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/endpoints.go @@ -0,0 +1,344 @@ +package endpoints + +import ( + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// ResolveOptions provide the configuration needed to direct how the +// endpoints will be resolved. +type ResolveOptions struct { + // DisableSSL forces the endpoint to be resolved as HTTP. + // instead of HTTPS if the service supports it. + DisableSSL bool + + // Sets the resolver to resolve the endpoint as a dualstack endpoint + // for the service. If dualstack support for a service is not known and + // StrictMatching is not enabled a dualstack endpoint for the service will + // be returned. This endpoint may not be valid. If StrictMatching is + // enabled only services that are known to support dualstack will return + // dualstack endpoints. + UseDualStack bool + + // Enables strict matching of services and regions resolved endpoints. + // If the partition doesn't enumerate the exact service and region an + // error will be returned. This option will prevent returning endpoints + // that look valid, but may not resolve to any real endpoint. + StrictMatching bool +} + +// A Resolver provides endpoint resolution based on modeled endpoint data. +type Resolver struct { + ResolveOptions + + partitions partitions +} + +// ResolveEndpoint attempts to resolve an endpoint againsted the modeled endpoint +// data. If an endpoint is found it will be returned. An error will be returned +// otherwise. +// +// Searches through the partitions in the order they are defined. +func (r *Resolver) ResolveEndpoint(service, region string) (aws.Endpoint, error) { + return r.partitions.EndpointFor(service, region, r.ResolveOptions) +} + +// Partitions returns the partitions that make up the resolver. +func (r *Resolver) Partitions() Partitions { + return r.partitions.Partitions() +} + +// Partitions is a slice of paritions describing regions and endpoints +type Partitions []Partition + +// ForRegion returns the first partition which includes the region +// passed in. This includes both known regions and regions which match +// a pattern supported by the partition which may include regions that are +// not explicitly known by the partition. Use the Regions method of the +// returned Partition if explicit support is needed. +func (ps Partitions) ForRegion(id string) (Partition, bool) { + for _, p := range ps { + if _, ok := p.p.Regions[id]; ok || p.p.RegionRegex.MatchString(id) { + return p, true + } + } + + return Partition{}, false +} + +// ForPartition returns the parition with the matching ID passed in. +func (ps Partitions) ForPartition(id string) (Partition, bool) { + for _, p := range ps { + if p.ID() == id { + return p, true + } + } + + return Partition{}, false +} + +// A Partition provides the ability to enumerate the partition's regions +// and services. +type Partition struct { + id string + p *partition +} + +// ID returns the identifier of the partition. +func (p Partition) ID() string { return p.id } + +// Endpoint attempts to resolve the endpoint based on service and region. +// See Options for information on configuring how the endpoint is resolved. +// +// If the service cannot be found in the metadata the endpoint will be resolved +// based on the parition's endpoint pattern, and service endpoint prefix. +// +// When resolving endpoints you can choose to enable StrictMatching. This will +// require the provided service and region to be known by the partition. +// If the endpoint cannot be strictly resolved an error will be returned. This +// mode is useful to ensure the endpoint resolved is valid. Without +// StrictMatching enabled the endpoint returned my look valid but may not work. +// StrictMatching requires the SDK to be updated if you want to take advantage +// of new regions and services expansions. +// +// Errors that can be returned. +// * UnknownServiceError +// * UnknownEndpointError +func (p Partition) Endpoint(service, region string, opts ResolveOptions) (aws.Endpoint, error) { + return p.p.EndpointFor(service, region, opts) +} + +// Regions returns a map of Regions indexed by their ID. This is useful for +// enumerating over the regions in a partition. +func (p Partition) Regions() map[string]Region { + rs := map[string]Region{} + for id := range p.p.Regions { + rs[id] = Region{ + id: id, + p: p.p, + } + } + + return rs +} + +// RegionsForService returns the map of regions for the service id specified. +// false is returned if the service is not found in the partition. +func (p Partition) RegionsForService(id string) (map[string]Region, bool) { + if _, ok := p.p.Services[id]; !ok { + return nil, false + } + + s := Service{ + id: id, + p: p.p, + } + return s.Regions(), true +} + +// Services returns a map of Service indexed by their ID. This is useful for +// enumerating over the services in a partition. +func (p Partition) Services() map[string]Service { + ss := map[string]Service{} + for id := range p.p.Services { + ss[id] = Service{ + id: id, + p: p.p, + } + } + + return ss +} + +// Resolver returns an endpoint resolver for the partitions. Use this to satisfy +// the SDK's EndpointResolver. +func (p Partition) Resolver() *Resolver { + return &Resolver{ + partitions: partitions{*p.p}, + } +} + +// A Region provides information about a region, and ability to resolve an +// endpoint from the context of a region, given a service. +type Region struct { + id, desc string + p *partition +} + +// ID returns the region's identifier. +func (r Region) ID() string { return r.id } + +// Endpoint resolves an endpoint from the context of the region given +// a service. See Partition.EndpointFor for usage and errors that can be returned. +func (r Region) Endpoint(service string, opts ResolveOptions) (aws.Endpoint, error) { + return r.p.EndpointFor(service, r.id, opts) +} + +// Services returns a list of all services that are known to be in this region. +func (r Region) Services() map[string]Service { + ss := map[string]Service{} + for id, s := range r.p.Services { + if _, ok := s.Endpoints[r.id]; ok { + ss[id] = Service{ + id: id, + p: r.p, + } + } + } + + return ss +} + +// A Service provides information about a service, and ability to resolve an +// endpoint from the context of a service, given a region. +type Service struct { + id string + p *partition +} + +// ID returns the identifier for the service. +func (s Service) ID() string { return s.id } + +// Endpoint resolves an endpoint from the context of a service given +// a region. See Partition.EndpointFor for usage and errors that can be returned. +func (s Service) Endpoint(region string, opts ResolveOptions) (aws.Endpoint, error) { + return s.p.EndpointFor(s.id, region, opts) +} + +// Regions returns a map of Regions that the service is present in. +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Regions() map[string]Region { + rs := map[string]Region{} + for id := range s.p.Services[s.id].Endpoints { + if _, ok := s.p.Regions[id]; ok { + rs[id] = Region{ + id: id, + p: s.p, + } + } + } + + return rs +} + +// Endpoints returns a map of Endpoints indexed by their ID for all known +// endpoints for a service. +// +// A region is the AWS region the service exists in. Whereas a Endpoint is +// an URL that can be resolved to a instance of a service. +func (s Service) Endpoints() map[string]Endpoint { + es := map[string]Endpoint{} + for id := range s.p.Services[s.id].Endpoints { + es[id] = Endpoint{ + id: id, + serviceID: s.id, + p: s.p, + } + } + + return es +} + +// A Endpoint provides information about endpoints, and provides the ability +// to resolve that endpoint for the service, and the region the endpoint +// represents. +type Endpoint struct { + id string + serviceID string + p *partition +} + +// ID returns the identifier for an endpoint. +func (e Endpoint) ID() string { return e.id } + +// ServiceID returns the identifier the endpoint belongs to. +func (e Endpoint) ServiceID() string { return e.serviceID } + +// Resolve resolves an endpoint from the context of a service and +// region the endpoint represents. See Partition.EndpointFor for usage and +// errors that can be returned. +func (e Endpoint) Resolve(opts ResolveOptions) (aws.Endpoint, error) { + return e.p.EndpointFor(e.serviceID, e.id, opts) +} + +// So that the Error interface type can be included as an anonymous field +// in the requestError struct and not conflict with the error.Error() method. +type awsError awserr.Error + +// A UnknownServiceError is returned when the service does not resolve to an +// endpoint. Includes a list of all known services for the partition. Returned +// when a partition does not support the service. +type UnknownServiceError struct { + awsError + Partition string + Service string + Known []string +} + +// NewUnknownServiceError builds and returns UnknownServiceError. +func NewUnknownServiceError(p, s string, known []string) UnknownServiceError { + return UnknownServiceError{ + awsError: awserr.New("UnknownServiceError", + "could not resolve endpoint for unknown service", nil), + Partition: p, + Service: s, + Known: known, + } +} + +// String returns the string representation of the error. +func (e UnknownServiceError) Error() string { + extra := fmt.Sprintf("partition: %q, service: %q", + e.Partition, e.Service) + if len(e.Known) > 0 { + extra += fmt.Sprintf(", known: %v", e.Known) + } + return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) +} + +// String returns the string representation of the error. +func (e UnknownServiceError) String() string { + return e.Error() +} + +// A UnknownEndpointError is returned when in StrictMatching mode and the +// service is valid, but the region does not resolve to an endpoint. Includes +// a list of all known endpoints for the service. +type UnknownEndpointError struct { + awsError + Partition string + Service string + Region string + Known []string +} + +// NewUnknownEndpointError builds and returns UnknownEndpointError. +func NewUnknownEndpointError(p, s, r string, known []string) UnknownEndpointError { + return UnknownEndpointError{ + awsError: awserr.New("UnknownEndpointError", + "could not resolve endpoint", nil), + Partition: p, + Service: s, + Region: r, + Known: known, + } +} + +// String returns the string representation of the error. +func (e UnknownEndpointError) Error() string { + extra := fmt.Sprintf("partition: %q, service: %q, region: %q", + e.Partition, e.Service, e.Region) + if len(e.Known) > 0 { + extra += fmt.Sprintf(", known: %v", e.Known) + } + return awserr.SprintError(e.Code(), e.Message(), extra, e.OrigErr()) +} + +// String returns the string representation of the error. +func (e UnknownEndpointError) String() string { + return e.Error() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model.go new file mode 100644 index 000000000000..d3bcbb80744d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model.go @@ -0,0 +1,313 @@ +package endpoints + +import ( + "fmt" + "regexp" + "strconv" + "strings" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +type partitions []partition + +func (ps partitions) EndpointFor(service, region string, opts ResolveOptions) (aws.Endpoint, error) { + for i := 0; i < len(ps); i++ { + if !ps[i].canResolveEndpoint(service, region, opts.StrictMatching) { + continue + } + + return ps[i].EndpointFor(service, region, opts) + } + + // If loose matching fallback to first partition format to use + // when resolving the endpoint. + if !opts.StrictMatching && len(ps) > 0 { + return ps[0].EndpointFor(service, region, opts) + } + + return aws.Endpoint{}, NewUnknownEndpointError("all partitions", service, region, []string{}) +} + +// Partitions satisfies the EnumPartitions interface and returns a list +// of Partitions representing each partition represented in the SDK's +// endpoints model. +func (ps partitions) Partitions() Partitions { + parts := make(Partitions, 0, len(ps)) + for i := 0; i < len(ps); i++ { + parts = append(parts, ps[i].Partition()) + } + + return parts +} + +type partition struct { + ID string `json:"partition"` + Name string `json:"partitionName"` + DNSSuffix string `json:"dnsSuffix"` + RegionRegex regionRegex `json:"regionRegex"` + Defaults endpoint `json:"defaults"` + Regions regions `json:"regions"` + Services services `json:"services"` +} + +func (p partition) Partition() Partition { + return Partition{ + id: p.ID, + p: &p, + } +} + +func (p partition) canResolveEndpoint(service, region string, strictMatch bool) bool { + s, hasService := p.Services[service] + _, hasEndpoint := s.Endpoints[region] + + if hasEndpoint && hasService { + return true + } + + if strictMatch { + return false + } + + return p.RegionRegex.MatchString(region) +} + +func (p partition) EndpointFor(service, region string, opts ResolveOptions) (resolved aws.Endpoint, err error) { + s, hasService := p.Services[service] + if !hasService && opts.StrictMatching { + // Only return error if the resolver will not fallback to creating + // endpoint based on service endpoint ID passed in. + return resolved, NewUnknownServiceError(p.ID, service, serviceList(p.Services)) + } + + e, hasEndpoint := s.endpointForRegion(region) + if !hasEndpoint && opts.StrictMatching { + return resolved, NewUnknownEndpointError(p.ID, service, region, endpointList(s.Endpoints)) + } + + defs := []endpoint{p.Defaults, s.Defaults} + return e.resolve(service, region, p.DNSSuffix, defs, opts), nil +} + +func serviceList(ss services) []string { + list := make([]string, 0, len(ss)) + for k := range ss { + list = append(list, k) + } + return list +} +func endpointList(es endpoints) []string { + list := make([]string, 0, len(es)) + for k := range es { + list = append(list, k) + } + return list +} + +type regionRegex struct { + *regexp.Regexp +} + +func (rr *regionRegex) UnmarshalJSON(b []byte) (err error) { + // Strip leading and trailing quotes + regex, err := strconv.Unquote(string(b)) + if err != nil { + return fmt.Errorf("unable to strip quotes from regex, %v", err) + } + + rr.Regexp, err = regexp.Compile(regex) + if err != nil { + return fmt.Errorf("unable to unmarshal region regex, %v", err) + } + return nil +} + +type regions map[string]region + +type region struct { + Description string `json:"description"` +} + +type services map[string]service + +type service struct { + PartitionEndpoint string `json:"partitionEndpoint"` + IsRegionalized boxedBool `json:"isRegionalized,omitempty"` + Defaults endpoint `json:"defaults"` + Endpoints endpoints `json:"endpoints"` +} + +func (s *service) endpointForRegion(region string) (endpoint, bool) { + if s.IsRegionalized == boxedFalse { + return s.Endpoints[s.PartitionEndpoint], region == s.PartitionEndpoint + } + + if e, ok := s.Endpoints[region]; ok { + return e, true + } + + // Unable to find any matching endpoint, return + // blank that will be used for generic endpoint creation. + return endpoint{}, false +} + +type endpoints map[string]endpoint + +type endpoint struct { + // True if the endpoint cannot be resolved for this partition/region/service + Unresolveable boxedBool `json:"-"` + + Hostname string `json:"hostname"` + Protocols []string `json:"protocols"` + CredentialScope credentialScope `json:"credentialScope"` + + // Custom fields not modeled + HasDualStack boxedBool `json:"-"` + DualStackHostname string `json:"-"` + + // Signature Version not used + SignatureVersions []string `json:"signatureVersions"` + + // SSLCommonName not used. + SSLCommonName string `json:"sslCommonName"` +} + +const ( + defaultProtocol = "https" + defaultSigner = "v4" +) + +var ( + protocolPriority = []string{"https", "http"} + signerPriority = []string{"v4", "v2"} +) + +func getByPriority(s []string, p []string, def string) string { + if len(s) == 0 { + return def + } + + for i := 0; i < len(p); i++ { + for j := 0; j < len(s); j++ { + if s[j] == p[i] { + return s[j] + } + } + } + + return s[0] +} + +func (e endpoint) resolve(service, region, dnsSuffix string, defs []endpoint, opts ResolveOptions) aws.Endpoint { + var merged endpoint + for _, def := range defs { + merged.mergeIn(def) + } + merged.mergeIn(e) + e = merged + + var u string + if e.Unresolveable != boxedTrue { + // Only attempt to resolve the endpoint if it can be resolved. + hostname := e.Hostname + + // Offset the hostname for dualstack if enabled + if opts.UseDualStack && e.HasDualStack == boxedTrue { + hostname = e.DualStackHostname + } + + u = strings.Replace(hostname, "{service}", service, 1) + u = strings.Replace(u, "{region}", region, 1) + u = strings.Replace(u, "{dnsSuffix}", dnsSuffix, 1) + + scheme := getEndpointScheme(e.Protocols, opts.DisableSSL) + u = fmt.Sprintf("%s://%s", scheme, u) + } + + signingRegion := e.CredentialScope.Region + if len(signingRegion) == 0 { + signingRegion = region + } + + signingName := e.CredentialScope.Service + var signingNameDerived bool + if len(signingName) == 0 { + signingName = service + signingNameDerived = true + } + + return aws.Endpoint{ + URL: u, + SigningRegion: signingRegion, + SigningName: signingName, + SigningNameDerived: signingNameDerived, + SigningMethod: getByPriority(e.SignatureVersions, signerPriority, defaultSigner), + } +} + +func getEndpointScheme(protocols []string, disableSSL bool) string { + if disableSSL { + return "http" + } + + return getByPriority(protocols, protocolPriority, defaultProtocol) +} + +func (e *endpoint) mergeIn(other endpoint) { + if other.Unresolveable != boxedBoolUnset { + e.Unresolveable = other.Unresolveable + } + if len(other.Hostname) > 0 { + e.Hostname = other.Hostname + } + if len(other.Protocols) > 0 { + e.Protocols = other.Protocols + } + if len(other.SignatureVersions) > 0 { + e.SignatureVersions = other.SignatureVersions + } + if len(other.CredentialScope.Region) > 0 { + e.CredentialScope.Region = other.CredentialScope.Region + } + if len(other.CredentialScope.Service) > 0 { + e.CredentialScope.Service = other.CredentialScope.Service + } + if len(other.SSLCommonName) > 0 { + e.SSLCommonName = other.SSLCommonName + } + if other.HasDualStack != boxedBoolUnset { + e.HasDualStack = other.HasDualStack + } + if len(other.DualStackHostname) > 0 { + e.DualStackHostname = other.DualStackHostname + } +} + +type credentialScope struct { + Region string `json:"region"` + Service string `json:"service"` +} + +type boxedBool int + +func (b *boxedBool) UnmarshalJSON(buf []byte) error { + v, err := strconv.ParseBool(string(buf)) + if err != nil { + return err + } + + if v { + *b = boxedTrue + } else { + *b = boxedFalse + } + + return nil +} + +const ( + boxedBoolUnset boxedBool = iota + boxedFalse + boxedTrue +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model_codegen.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model_codegen.go new file mode 100644 index 000000000000..033afb26acec --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/endpoints/v3model_codegen.go @@ -0,0 +1,330 @@ +// +build codegen + +package endpoints + +import ( + "fmt" + "io" + "reflect" + "strings" + "text/template" + "unicode" +) + +// A CodeGenOptions are the options for code generating the endpoints into +// Go code from the endpoints model definition. +type CodeGenOptions struct { + // Options for how the model will be decoded. + DecodeModelOptions DecodeModelOptions +} + +// Set combines all of the option functions together +func (d *CodeGenOptions) Set(optFns ...func(*CodeGenOptions)) { + for _, fn := range optFns { + fn(d) + } +} + +// CodeGenModel given a endpoints model file will decode it and attempt to +// generate Go code from the model definition. Error will be returned if +// the code is unable to be generated, or decoded. +func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGenOptions)) error { + var opts CodeGenOptions + opts.Set(optFns...) + + resolver, err := DecodeModel(modelFile, func(d *DecodeModelOptions) { + *d = opts.DecodeModelOptions + }) + if err != nil { + return err + } + + tmpl := template.Must(template.New("tmpl").Funcs(funcMap).Parse(v3Tmpl)) + if err := tmpl.ExecuteTemplate(outFile, "defaults", resolver.partitions); err != nil { + return fmt.Errorf("failed to execute template, %v", err) + } + + return nil +} + +func toSymbol(v string) string { + out := []rune{} + for _, c := range strings.Title(v) { + if !(unicode.IsNumber(c) || unicode.IsLetter(c)) { + continue + } + + out = append(out, c) + } + + return string(out) +} + +func quoteString(v string) string { + return fmt.Sprintf("%q", v) +} + +func regionConstName(p, r string) string { + return toSymbol(p) + toSymbol(r) +} + +func partitionGetter(id string) string { + return fmt.Sprintf("%sPartition", toSymbol(id)) +} + +func partitionVarName(id string) string { + return fmt.Sprintf("%sPartition", strings.ToLower(toSymbol(id))) +} + +func listPartitionNames(ps partitions) string { + names := []string{} + switch len(ps) { + case 1: + return ps[0].Name + case 2: + return fmt.Sprintf("%s and %s", ps[0].Name, ps[1].Name) + default: + for i, p := range ps { + if i == len(ps)-1 { + names = append(names, "and "+p.Name) + } else { + names = append(names, p.Name) + } + } + return strings.Join(names, ", ") + } +} + +func boxedBoolIfSet(msg string, v boxedBool) string { + switch v { + case boxedTrue: + return fmt.Sprintf(msg, "boxedTrue") + case boxedFalse: + return fmt.Sprintf(msg, "boxedFalse") + default: + return "" + } +} + +func stringIfSet(msg, v string) string { + if len(v) == 0 { + return "" + } + + return fmt.Sprintf(msg, v) +} + +func stringSliceIfSet(msg string, vs []string) string { + if len(vs) == 0 { + return "" + } + + names := []string{} + for _, v := range vs { + names = append(names, `"`+v+`"`) + } + + return fmt.Sprintf(msg, strings.Join(names, ",")) +} + +func endpointIsSet(v endpoint) bool { + return !reflect.DeepEqual(v, endpoint{}) +} + +func serviceSet(ps partitions) map[string]struct{} { + set := map[string]struct{}{} + for _, p := range ps { + for id := range p.Services { + set[id] = struct{}{} + } + } + + return set +} + +var funcMap = template.FuncMap{ + "ToSymbol": toSymbol, + "QuoteString": quoteString, + "RegionConst": regionConstName, + "PartitionGetter": partitionGetter, + "PartitionVarName": partitionVarName, + "ListPartitionNames": listPartitionNames, + "BoxedBoolIfSet": boxedBoolIfSet, + "StringIfSet": stringIfSet, + "StringSliceIfSet": stringSliceIfSet, + "EndpointIsSet": endpointIsSet, + "ServicesSet": serviceSet, +} + +const v3Tmpl = ` +{{ define "defaults" -}} +// Code generated by aws/endpoints/v3model_codegen.go. DO NOT EDIT. + +package endpoints + +import ( + "regexp" +) + + {{ template "partition consts" . }} + + {{ range $_, $partition := . }} + {{ template "partition region consts" $partition }} + {{ end }} + + {{ template "service consts" . }} + + {{ template "endpoint resolvers" . }} +{{- end }} + +{{ define "partition consts" }} + // Partition identifiers + const ( + {{ range $_, $p := . -}} + {{ ToSymbol $p.ID }}PartitionID = {{ QuoteString $p.ID }} // {{ $p.Name }} partition. + {{ end -}} + ) +{{- end }} + +{{ define "partition region consts" }} + // {{ .Name }} partition's regions. + const ( + {{ range $id, $region := .Regions -}} + {{ ToSymbol $id }}RegionID = {{ QuoteString $id }} // {{ $region.Description }}. + {{ end -}} + ) +{{- end }} + +{{ define "service consts" }} + // Service identifiers + const ( + {{ $serviceSet := ServicesSet . -}} + {{ range $id, $_ := $serviceSet -}} + {{ ToSymbol $id }}ServiceID = {{ QuoteString $id }} // {{ ToSymbol $id }}. + {{ end -}} + ) +{{- end }} + +{{ define "endpoint resolvers" }} + // NewDefaultResolver returns an Endpoint resolver that will be able + // to resolve endpoints for: {{ ListPartitionNames . }}. + // + // Use DefaultPartitions() to get the list of the default partitions. + func NewDefaultResolver() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } + } + + // DefaultPartitions returns a list of the partitions the SDK is bundled + // with. The available partitions are: {{ ListPartitionNames . }}. + // + // partitions := endpoints.DefaultPartitions + // for _, p := range partitions { + // // ... inspect partitions + // } + func DefaultPartitions() Partitions { + return defaultPartitions.Partitions() + } + + var defaultPartitions = partitions{ + {{ range $_, $partition := . -}} + {{ PartitionVarName $partition.ID }}, + {{ end }} + } + + {{ range $_, $partition := . -}} + {{ $name := PartitionGetter $partition.ID -}} + // {{ $name }} returns the Resolver for {{ $partition.Name }}. + func {{ $name }}() Partition { + return {{ PartitionVarName $partition.ID }}.Partition() + } + var {{ PartitionVarName $partition.ID }} = {{ template "gocode Partition" $partition }} + {{ end }} +{{ end }} + +{{ define "gocode Partition" -}} +partition{ + {{ StringIfSet "ID: %q,\n" .ID -}} + {{ StringIfSet "Name: %q,\n" .Name -}} + {{ StringIfSet "DNSSuffix: %q,\n" .DNSSuffix -}} + RegionRegex: {{ template "gocode RegionRegex" .RegionRegex }}, + {{ if EndpointIsSet .Defaults -}} + Defaults: {{ template "gocode Endpoint" .Defaults }}, + {{- end }} + Regions: {{ template "gocode Regions" .Regions }}, + Services: {{ template "gocode Services" .Services }}, +} +{{- end }} + +{{ define "gocode RegionRegex" -}} +regionRegex{ + Regexp: func() *regexp.Regexp{ + reg, _ := regexp.Compile({{ QuoteString .Regexp.String }}) + return reg + }(), +} +{{- end }} + +{{ define "gocode Regions" -}} +regions{ + {{ range $id, $region := . -}} + "{{ $id }}": {{ template "gocode Region" $region }}, + {{ end -}} +} +{{- end }} + +{{ define "gocode Region" -}} +region{ + {{ StringIfSet "Description: %q,\n" .Description -}} +} +{{- end }} + +{{ define "gocode Services" -}} +services{ + {{ range $id, $service := . -}} + "{{ $id }}": {{ template "gocode Service" $service }}, + {{ end }} +} +{{- end }} + +{{ define "gocode Service" -}} +service{ + {{ StringIfSet "PartitionEndpoint: %q,\n" .PartitionEndpoint -}} + {{ BoxedBoolIfSet "IsRegionalized: %s,\n" .IsRegionalized -}} + {{ if EndpointIsSet .Defaults -}} + Defaults: {{ template "gocode Endpoint" .Defaults -}}, + {{- end }} + {{ if .Endpoints -}} + Endpoints: {{ template "gocode Endpoints" .Endpoints }}, + {{- end }} +} +{{- end }} + +{{ define "gocode Endpoints" -}} +endpoints{ + {{ range $id, $endpoint := . -}} + "{{ $id }}": {{ template "gocode Endpoint" $endpoint }}, + {{ end }} +} +{{- end }} + +{{ define "gocode Endpoint" -}} +endpoint{ + {{ BoxedBoolIfSet "Unresolveable: %s,\n" .Unresolveable -}} + {{ StringIfSet "Hostname: %q,\n" .Hostname -}} + {{ StringIfSet "SSLCommonName: %q,\n" .SSLCommonName -}} + {{ StringSliceIfSet "Protocols: []string{%s},\n" .Protocols -}} + {{ StringSliceIfSet "SignatureVersions: []string{%s},\n" .SignatureVersions -}} + {{ if or .CredentialScope.Region .CredentialScope.Service -}} + CredentialScope: credentialScope{ + {{ StringIfSet "Region: %q,\n" .CredentialScope.Region -}} + {{ StringIfSet "Service: %q,\n" .CredentialScope.Service -}} + }, + {{- end }} + {{ BoxedBoolIfSet "HasDualStack: %s,\n" .HasDualStack -}} + {{ StringIfSet "DualStackHostname: %q,\n" .DualStackHostname -}} + +} +{{- end }} +` diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/errors.go new file mode 100644 index 000000000000..c5671378eafb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/errors.go @@ -0,0 +1,17 @@ +package aws + +import "github.com/aws/aws-sdk-go-v2/aws/awserr" + +var ( + // ErrMissingRegion is an error that is returned if region configuration is + // not found. + // + // @readonly + ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil) + + // ErrMissingEndpoint is an error that is returned if an endpoint cannot be + // resolved for a service. + // + // @readonly + ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil) +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/config.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/config.go new file mode 100644 index 000000000000..5753b432d16b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/config.go @@ -0,0 +1,132 @@ +package external + +import ( + "github.com/aws/aws-sdk-go-v2/aws" +) + +// DefaultConfigLoaders are a slice of functions that will read external configuration +// sources for configuration values. These values are read by the AWSConfigResolvers +// using interfaces to extract specific information from the external configuration. +var DefaultConfigLoaders = []ConfigLoader{ + LoadEnvConfig, + LoadSharedConfigIgnoreNotExist, +} + +// DefaultAWSConfigResolvers are a slice of functions that will resolve external +// configuration values into AWS configuration values. +// +// This will setup the AWS configuration's Region, +var DefaultAWSConfigResolvers = []AWSConfigResolver{ + ResolveDefaultAWSConfig, + ResolveCustomCABundle, + + ResolveRegion, + + ResolveFallbackEC2Credentials, // Initial defauilt credentails provider. + ResolveCredentialsValue, + ResolveEndpointCredentials, + ResolveContainerEndpointPathCredentials, // TODO is this order right? + ResolveAssumeRoleCredentials, +} + +// A Config represents a generic configuration value or set of values. This type +// will be used by the AWSConfigResolvers to extract +// +// General the Config type will use type assertion against the Provider interfaces +// to extract specific data from the Config. +type Config interface{} + +// A ConfigLoader is used to load external configuration data and returns it as +// a generic Config type. +// +// The loader should return an error if it fails to load the external configuration +// or the configuration data is malformed, or required components missing. +type ConfigLoader func(Configs) (Config, error) + +// An AWSConfigResolver will extract configuration data from the Configs slice +// using the provider interfaces to extract specific functionality. The extracted +// configuration values will be written to the AWS Config value. +// +// The resolver should return an error if it it fails to extract the data, the +// data is malformed, or incomplete. +type AWSConfigResolver func(cfg *aws.Config, configs Configs) error + +// Configs is a slice of Config values. These values will be used by the +// AWSConfigResolvers to extract external configuration values to populate the +// AWS Config type. +// +// Use AppendFromLoaders to add additional external Config values that are +// loaded from external sources. +// +// Use ResolveAWSConfig after external Config values have been added or loaded +// to extract the loaded configuration values into the AWS Config. +type Configs []Config + +// AppendFromLoaders iterates over the slice of loaders passed in calling each +// loader function in order. The external config value returned by the loader +// will be added to the returned Configs slice. +// +// If a loader returns an error this method will stop iterating and return +// that error. +func (cs Configs) AppendFromLoaders(loaders []ConfigLoader) (Configs, error) { + for _, fn := range loaders { + cfg, err := fn(cs) + if err != nil { + return nil, err + } + + cs = append(cs, cfg) + } + + return cs, nil +} + +// ResolveAWSConfig returns a AWS configuration populated with values by calling +// the resolvers slice passed in. Each resolver is called in order. Any resolver +// may overwrite the AWs Configuration value of a previous resolver. +// +// If an resolver returns an error this method will return that error, and stop +// iterating over the resolvers. +func (cs Configs) ResolveAWSConfig(resolvers []AWSConfigResolver) (aws.Config, error) { + var cfg aws.Config + + for _, fn := range resolvers { + if err := fn(&cfg, cs); err != nil { + // TODO provide better error? + return aws.Config{}, err + } + } + + return cfg, nil +} + +// LoadDefaultAWSConfig reads the SDK's default external configurations, and +// populates an AWS Config with the values from the external configurations. +// +// An optional variadic set of additional Config values can be provided as input +// that will be prepended to the Configs slice. Use this to add custom configuration. +// The custom configurations must satisfy the respective providers for their data +// or the custom data will be ignored by the resolvers and config loaders. +// +// cfg, err := external.LoadDefaultAWSConfig( +// WithSharedConfigProfile("test-profile"), +// ) +// if err != nil { +// panic(fmt.Sprintf("failed loading config, %v", err)) +// } +// +// +// The default configuration sources are: +// * Environment Variables +// * Shared Configuration and Shared Credentials files. +func LoadDefaultAWSConfig(configs ...Config) (aws.Config, error) { + var cfgs Configs + cfgs = append(cfgs, configs...) + + cfgs, err := cfgs.AppendFromLoaders(DefaultConfigLoaders) + if err != nil { + return aws.Config{}, err + } + + return cfgs.ResolveAWSConfig(DefaultAWSConfigResolvers) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/env_config.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/env_config.go new file mode 100644 index 000000000000..902252c46da2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/env_config.go @@ -0,0 +1,236 @@ +package external + +import ( + "io/ioutil" + "os" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// CredentialsSourceName provides a name of the provider when config is +// loaded from environment. +const CredentialsSourceName = "EnvConfigCredentials" + +// Environment variables that will be read for configuration values. +const ( + AWSAccessKeyIDEnvVar = "AWS_ACCESS_KEY_ID" + AWSAccessKeyEnvVar = "AWS_ACCESS_KEY" + + AWSSecreteAccessKeyEnvVar = "AWS_SECRET_ACCESS_KEY" + AWSSecreteKeyEnvVar = "AWS_SECRET_KEY" + + AWSSessionTokenEnvVar = "AWS_SESSION_TOKEN" + + AWSCredentialsEndpointEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" + + // TODO shorter name? + AWSContainerCredentialsEndpointPathEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" + + AWSRegionEnvVar = "AWS_REGION" + AWSDefaultRegionEnvVar = "AWS_DEFAULT_REGION" + + AWSProfileEnvVar = "AWS_PROFILE" + AWSDefaultProfileEnvVar = "AWS_DEFAULT_PROFILE" + + AWSSharedCredentialsFileEnvVar = "AWS_SHARED_CREDENTIALS_FILE" + + AWSConfigFileEnvVar = "AWS_CONFIG_FILE" + + AWSCustomCABundleEnvVar = "AWS_CA_BUNDLE" +) + +var ( + credAccessEnvKeys = []string{ + AWSAccessKeyIDEnvVar, + AWSAccessKeyEnvVar, + } + credSecretEnvKeys = []string{ + AWSSecreteAccessKeyEnvVar, + AWSSecreteKeyEnvVar, + } + regionEnvKeys = []string{ + AWSRegionEnvVar, + AWSDefaultRegionEnvVar, + } + profileEnvKeys = []string{ + AWSProfileEnvVar, + AWSDefaultProfileEnvVar, + } +) + +// EnvConfig is a collection of environment values the SDK will read +// setup config from. All environment values are optional. But some values +// such as credentials require multiple values to be complete or the values +// will be ignored. +type EnvConfig struct { + // Environment configuration values. If set both Access Key ID and Secret Access + // Key must be provided. Session Token and optionally also be provided, but is + // not required. + // + // # Access Key ID + // AWS_ACCESS_KEY_ID=AKID + // AWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set. + // + // # Secret Access Key + // AWS_SECRET_ACCESS_KEY=SECRET + // AWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set. + // + // # Session Token + // AWS_SESSION_TOKEN=TOKEN + Credentials aws.Credentials + + // TODO doc + CredentialsEndpoint string + + // TODO doc, shorter name? + ContainerCredentialsEndpointPath string + + // Region value will instruct the SDK where to make service API requests to. If is + // not provided in the environment the region must be provided before a service + // client request is made. + // + // AWS_REGION=us-west-2 + // AWS_DEFAULT_REGION=us-west-2 + Region string + + // Profile name the SDK should load use when loading shared configuration from the + // shared configuration files. If not provided "default" will be used as the + // profile name. + // + // AWS_PROFILE=my_profile + // AWS_DEFAULT_PROFILE=my_profile + SharedConfigProfile string + + // Shared credentials file path can be set to instruct the SDK to use an alternate + // file for the shared credentials. If not set the file will be loaded from + // $HOME/.aws/credentials on Linux/Unix based systems, and + // %USERPROFILE%\.aws\credentials on Windows. + // + // AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials + SharedCredentialsFile string + + // Shared config file path can be set to instruct the SDK to use an alternate + // file for the shared config. If not set the file will be loaded from + // $HOME/.aws/config on Linux/Unix based systems, and + // %USERPROFILE%\.aws\config on Windows. + // + // AWS_CONFIG_FILE=$HOME/my_shared_config + SharedConfigFile string + + // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file + // that the SDK will use instead of the system's root CA bundle. + // Only use this if you want to configure the SDK to use a custom set + // of CAs. + // + // Enabling this option will attempt to merge the Transport + // into the SDK's HTTP client. If the client's Transport is + // not a http.Transport an error will be returned. If the + // Transport's TLS config is set this option will cause the + // SDK to overwrite the Transport's TLS config's RootCAs value. + // + // Setting a custom HTTPClient in the aws.Config options will override this setting. + // To use this option and custom HTTP client, the HTTP client needs to be provided + // when creating the config. Not the service client. + // + // AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle + CustomCABundle string +} + +// LoadEnvConfig reads configuration values from the OS's environment variables. +// Returning the a Config typed EnvConfig to satisfy the ConfigLoader func type. +func LoadEnvConfig(cfgs Configs) (Config, error) { + return NewEnvConfig() +} + +// NewEnvConfig retrieves the SDK's environment configuration. +// See `EnvConfig` for the values that will be retrieved. +func NewEnvConfig() (EnvConfig, error) { + var cfg EnvConfig + + creds := aws.Credentials{ + Source: CredentialsSourceName, + } + setFromEnvVal(&creds.AccessKeyID, credAccessEnvKeys) + setFromEnvVal(&creds.SecretAccessKey, credSecretEnvKeys) + if creds.HasKeys() { + creds.SessionToken = os.Getenv(AWSSessionTokenEnvVar) + cfg.Credentials = creds + } + + cfg.CredentialsEndpoint = os.Getenv(AWSCredentialsEndpointEnvVar) + cfg.ContainerCredentialsEndpointPath = os.Getenv(AWSContainerCredentialsEndpointPathEnvVar) + + setFromEnvVal(&cfg.Region, regionEnvKeys) + setFromEnvVal(&cfg.SharedConfigProfile, profileEnvKeys) + + cfg.SharedCredentialsFile = os.Getenv(AWSSharedCredentialsFileEnvVar) + cfg.SharedConfigFile = os.Getenv(AWSConfigFileEnvVar) + + cfg.CustomCABundle = os.Getenv(AWSCustomCABundleEnvVar) + + return cfg, nil +} + +// GetRegion returns the AWS Region if set in the environment. Returns an empty +// string if not set. +func (c EnvConfig) GetRegion() (string, error) { + return c.Region, nil +} + +// GetCredentialsValue returns the AWS Credentials if both AccessKey and ScreteAccessKey +// are set in the environment. Returns a zero value Credentials if not set. +func (c EnvConfig) GetCredentialsValue() (aws.Credentials, error) { + return c.Credentials, nil +} + +// GetSharedConfigProfile returns the shared config profile if set in the +// environment. Returns an empty string if not set. +func (c EnvConfig) GetSharedConfigProfile() (string, error) { + return c.SharedConfigProfile, nil +} + +// GetCredentialsEndpoint returns the credentials endpoint string if set. +func (c EnvConfig) GetCredentialsEndpoint() (string, error) { + return c.CredentialsEndpoint, nil +} + +// GetContainerCredentialsEndpointPath returns the container credentails endpoint +// path string if set. +func (c EnvConfig) GetContainerCredentialsEndpointPath() (string, error) { + return c.ContainerCredentialsEndpointPath, nil +} + +// GetSharedConfigFiles returns a slice of filenames set in the environment. +// +// Will return the filenames in the order of: +// * Shared Credentials +// * Shared Config +func (c EnvConfig) GetSharedConfigFiles() ([]string, error) { + files := make([]string, 0, 2) + if v := c.SharedCredentialsFile; len(v) > 0 { + files = append(files, v) + } + if v := c.SharedConfigFile; len(v) > 0 { + files = append(files, v) + } + + return files, nil +} + +// GetCustomCABundle returns the custom CA bundle's PEM bytes if the file was +func (c EnvConfig) GetCustomCABundle() ([]byte, error) { + if len(c.CustomCABundle) == 0 { + return nil, nil + } + + return ioutil.ReadFile(c.CustomCABundle) +} + +func setFromEnvVal(dst *string, keys []string) { + for _, k := range keys { + if v := os.Getenv(k); len(v) > 0 { + *dst = v + break + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/http_client.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/http_client.go new file mode 100644 index 000000000000..71e9830b04c4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/http_client.go @@ -0,0 +1,42 @@ +package external + +import ( + "crypto/tls" + "crypto/x509" + "net/http" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +func addHTTPClientCABundle(client *http.Client, pemCerts []byte) error { + var t *http.Transport + + switch v := client.Transport.(type) { + case *http.Transport: + t = v + default: + if client.Transport != nil { + return awserr.New("LoadCustomCABundleError", + "unable to set custom CA bundle trasnsport must be http.Transport type", nil) + } + } + + if t == nil { + t = &http.Transport{} + } + if t.TLSClientConfig == nil { + t.TLSClientConfig = &tls.Config{} + } + if t.TLSClientConfig.RootCAs == nil { + t.TLSClientConfig.RootCAs = x509.NewCertPool() + } + + if !t.TLSClientConfig.RootCAs.AppendCertsFromPEM(pemCerts) { + return awserr.New("LoadCustomCABundleError", + "failed to load custom CA bundle PEM file", nil) + } + + client.Transport = t + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/local.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/local.go new file mode 100644 index 000000000000..a555f42c0d14 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/local.go @@ -0,0 +1,49 @@ +package external + +import ( + "fmt" + "net" + "net/url" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +var lookupHostFn = net.LookupHost + +func isLoopbackHost(host string) (bool, error) { + ip := net.ParseIP(host) + if ip != nil { + return ip.IsLoopback(), nil + } + + // Host is not an ip, perform lookup + addrs, err := lookupHostFn(host) + if err != nil { + return false, err + } + for _, addr := range addrs { + if !net.ParseIP(addr).IsLoopback() { + return false, nil + } + } + + return true, nil +} + +func validateLocalURL(v string) error { + u, err := url.Parse(v) + if err != nil { + return err + } + + host := aws.URLHostname(u) + if len(host) == 0 { + return fmt.Errorf("unable to parse host from local HTTP cred provider URL") + } else if isLoopback, err := isLoopbackHost(host); err != nil { + return fmt.Errorf("failed to resolve host %q, %v", host, err) + } else if !isLoopback { + return fmt.Errorf("invalid endpoint host, %q, only host resolving to loopback addresses are allowed", host) + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/provider.go new file mode 100644 index 000000000000..54fe9324318c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/provider.go @@ -0,0 +1,325 @@ +package external + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/ec2metadata" +) + +// SharedConfigProfileProvider provides access to the shared config profile +// name external configuration value. +type SharedConfigProfileProvider interface { + GetSharedConfigProfile() (string, error) +} + +// WithSharedConfigProfile wraps a strings to satisfy the SharedConfigProfileProvider +// interface so a slice of custom shared config files ared used when loading the +// SharedConfig. +type WithSharedConfigProfile string + +// GetSharedConfigProfile returns the shared config profile. +func (c WithSharedConfigProfile) GetSharedConfigProfile() (string, error) { + return string(c), nil +} + +// GetSharedConfigProfile searchds the Configs for a SharedConfigProfileProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetSharedConfigProfile(configs Configs) (string, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(SharedConfigProfileProvider); ok { + v, err := p.GetSharedConfigProfile() + if err != nil { + return "", false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return "", false, nil +} + +// SharedConfigFilesProvider provides access to the shared config filesnames +// external configuration value. +type SharedConfigFilesProvider interface { + GetSharedConfigFiles() ([]string, error) +} + +// WithSharedConfigFiles wraps a slice of strings to satisfy the +// SharedConfigFilesProvider interface so a slice of custom shared config files +// ared used when loading the SharedConfig. +type WithSharedConfigFiles []string + +// GetSharedConfigFiles returns the slice of shared config files. +func (c WithSharedConfigFiles) GetSharedConfigFiles() ([]string, error) { + return []string(c), nil +} + +// GetSharedConfigFiles searchds the Configs for a SharedConfigFilesProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetSharedConfigFiles(configs Configs) ([]string, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(SharedConfigFilesProvider); ok { + v, err := p.GetSharedConfigFiles() + if err != nil { + return nil, false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return nil, false, nil +} + +// CustomCABundleProvider provides access to the custom CA bundle PEM bytes. +type CustomCABundleProvider interface { + GetCustomCABundle() ([]byte, error) +} + +// WithCustomCABundle provides wrapping of a region string to satisfy the +// CustomCABundleProvider interface. +type WithCustomCABundle []byte + +// GetCustomCABundle returns the CA bundle PEM bytes. +func (v WithCustomCABundle) GetCustomCABundle() ([]byte, error) { + return []byte(v), nil +} + +// GetCustomCABundle searchds the Configs for a CustomCABundleProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetCustomCABundle(configs Configs) ([]byte, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(CustomCABundleProvider); ok { + v, err := p.GetCustomCABundle() + if err != nil { + return nil, false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return nil, false, nil +} + +// RegionProvider provides access to the region external configuration value. +type RegionProvider interface { + GetRegion() (string, error) +} + +// WithRegion provides wrapping of a region string to satisfy the RegionProvider +// interface. +type WithRegion string + +// GetRegion returns the region string. +func (v WithRegion) GetRegion() (string, error) { + return string(v), nil +} + +// GetRegion searchds the Configs for a RegionProvider and returns the value +// if found. Returns an error if a provider fails before a value is found. +func GetRegion(configs Configs) (string, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(RegionProvider); ok { + v, err := p.GetRegion() + if err != nil { + return "", false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return "", false, nil +} + +// CredentialsValueProvider provides access to the credentials external +// configuration value. +type CredentialsValueProvider interface { + GetCredentialsValue() (aws.Credentials, error) +} + +// WithCredentialsValue provides wrapping of a credentials Value to satisfy the +// CredentialsValueProvider interface. +type WithCredentialsValue aws.Credentials + +// GetCredentialsValue returns the credentials value. +func (v WithCredentialsValue) GetCredentialsValue() (aws.Credentials, error) { + return aws.Credentials(v), nil +} + +// GetCredentialsValue searchds the Configs for a CredentialsValueProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetCredentialsValue(configs Configs) (aws.Credentials, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(CredentialsValueProvider); ok { + v, err := p.GetCredentialsValue() + if err != nil { + return aws.Credentials{}, false, err + } + if v.HasKeys() { + return v, true, nil + } + } + } + + return aws.Credentials{}, false, nil +} + +// CredentialsEndpointProvider provides access to the credentials endpoint +// external configuration value. +type CredentialsEndpointProvider interface { + GetCredentialsEndpoint() (string, error) +} + +// WithCredentialsEndpoint provides wrapping of a string to satisfy the +// CredentialsEndpointProvider interface. +type WithCredentialsEndpoint string + +// GetCredentialsEndpoint returns the endpoint. +func (p WithCredentialsEndpoint) GetCredentialsEndpoint() (string, error) { + return string(p), nil +} + +// GetCredentialsEndpoint searchds the Configs for a CredentialsEndpointProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetCredentialsEndpoint(configs Configs) (string, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(CredentialsEndpointProvider); ok { + v, err := p.GetCredentialsEndpoint() + if err != nil { + return "", false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return "", false, nil +} + +// ContainerCredentialsEndpointPathProvider provides access to the credentials endpoint path +// external configuration value. +type ContainerCredentialsEndpointPathProvider interface { + GetContainerCredentialsEndpointPath() (string, error) +} + +// WithContainerCredentialsEndpointPath provides wrapping of a string to satisfy the +// ContainerCredentialsEndpointPathProvider interface. +type WithContainerCredentialsEndpointPath string + +// GetContainerCredentialsEndpointPath returns the endpoint path. +func (p WithContainerCredentialsEndpointPath) GetContainerCredentialsEndpointPath() (string, error) { + return string(p), nil +} + +// GetContainerCredentialsEndpointPath searchds the Configs for a +// ContainerCredentialsEndpointPathProvider and returns the value if found. +// Returns an error if a provider fails before a +// value is found. +func GetContainerCredentialsEndpointPath(configs Configs) (string, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(ContainerCredentialsEndpointPathProvider); ok { + v, err := p.GetContainerCredentialsEndpointPath() + if err != nil { + return "", false, err + } + if len(v) > 0 { + return v, true, nil + } + } + } + + return "", false, nil +} + +// AssumeRoleConfigProvider provides access to the assume role config +// external configuration value. +type AssumeRoleConfigProvider interface { + GetAssumeRoleConfig() (AssumeRoleConfig, error) +} + +// WithAssumeRoleConfig provides wrapping of a string to satisfy the +// AssumeRoleConfigProvider interface. +type WithAssumeRoleConfig AssumeRoleConfig + +// GetAssumeRoleConfig returns the AssumeRoleConfig. +func (p WithAssumeRoleConfig) GetAssumeRoleConfig() (AssumeRoleConfig, error) { + return AssumeRoleConfig(p), nil +} + +// GetAssumeRoleConfig searchds the Configs for a AssumeRoleConfigProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetAssumeRoleConfig(configs Configs) (AssumeRoleConfig, bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(AssumeRoleConfigProvider); ok { + v, err := p.GetAssumeRoleConfig() + if err != nil { + return AssumeRoleConfig{}, false, err + } + if len(v.RoleARN) > 0 && v.Source != nil { + return v, true, nil + } + } + } + + return AssumeRoleConfig{}, false, nil +} + +// MFATokenFuncProvider provides access to the MFA token function needed for +// Assume Role with MFA. +type MFATokenFuncProvider interface { + GetMFATokenFunc() (func() (string, error), error) +} + +// WithMFATokenFunc provides wrapping of a string to satisfy the +// MFATokenFuncProvider interface. +type WithMFATokenFunc func() (string, error) + +// GetMFATokenFunc returns the MFA Token function. +func (p WithMFATokenFunc) GetMFATokenFunc() (func() (string, error), error) { + return p, nil +} + +// GetMFATokenFunc searchds the Configs for a MFATokenFuncProvider +// and returns the value if found. Returns an error if a provider fails before a +// value is found. +func GetMFATokenFunc(configs Configs) (func() (string, error), bool, error) { + for _, cfg := range configs { + if p, ok := cfg.(MFATokenFuncProvider); ok { + v, err := p.GetMFATokenFunc() + if err != nil { + return nil, false, err + } + if v != nil { + return v, true, nil + } + } + } + + return nil, false, nil +} + +// WithEC2MetadataRegion provides a RegionProvider that retrieves the region +// from the EC2 Metadata service. +// +// TODO add this provider to the default config loading? +type WithEC2MetadataRegion struct { + Client *ec2metadata.EC2Metadata +} + +// GetRegion attempts to retreive the region from EC2 Metadata service. +func (p WithEC2MetadataRegion) GetRegion() (string, error) { + return p.Client.Region() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/resolve.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/resolve.go new file mode 100644 index 000000000000..9eff51adc3ee --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/resolve.go @@ -0,0 +1,216 @@ +package external + +import ( + "fmt" + "net/http" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/defaults" + "github.com/aws/aws-sdk-go-v2/aws/ec2metadata" + "github.com/aws/aws-sdk-go-v2/aws/ec2rolecreds" + "github.com/aws/aws-sdk-go-v2/aws/endpointcreds" + "github.com/aws/aws-sdk-go-v2/aws/stscreds" + "github.com/aws/aws-sdk-go-v2/service/sts" +) + +// ResolveDefaultAWSConfig will write default configuration values into the cfg +// value. It will write the default values, overwriting any previous value. +// +// This should be used as the first resolver in the slice of resolvers when +// resolving external configuration. +func ResolveDefaultAWSConfig(cfg *aws.Config, configs Configs) error { + *cfg = defaults.Config() + return nil +} + +// ResolveCustomCABundle extracts the first instance of a custom CA bundle filename +// from the external configurations. It will update the HTTP Client's builder +// to be configured with the custom CA bundle. +// +// Config provider used: +// * CustomCABundleProvider +func ResolveCustomCABundle(cfg *aws.Config, configs Configs) error { + v, found, err := GetCustomCABundle(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + return addHTTPClientCABundle(cfg.HTTPClient, v) +} + +// ResolveRegion extracts the first instance of a Region from the Configs slice. +// +// Config providers used: +// * RegionProvider +func ResolveRegion(cfg *aws.Config, configs Configs) error { + v, found, err := GetRegion(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + cfg.Region = v + return nil +} + +// ResolveCredentialsValue extracts the first instance of Credentials from the +// config slices. +// +// Config providers used: +// * CredentialsValueProvider +func ResolveCredentialsValue(cfg *aws.Config, configs Configs) error { + v, found, err := GetCredentialsValue(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + cfg.Credentials = aws.StaticCredentialsProvider{Value: v} + + return nil +} + +// ResolveEndpointCredentials will extract the credentials endpoint from the config +// slice. Using the endpoint, provided, to create a endpoint credential provider. +// +// Config providers used: +// * CredentialsEndpointProvider +func ResolveEndpointCredentials(cfg *aws.Config, configs Configs) error { + v, found, err := GetCredentialsEndpoint(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + if err := validateLocalURL(v); err != nil { + return err + } + + cfgCp := cfg.Copy() + cfgCp.EndpointResolver = aws.ResolveWithEndpointURL(v) + + provider := endpointcreds.New(cfgCp) + provider.ExpiryWindow = 5 * time.Minute + + cfg.Credentials = provider + + return nil +} + +const containerCredentialsEndpoint = "http://169.254.170.2" + +// ResolveContainerEndpointPathCredentials will extract the container credentials +// endpoint from the config slice. Using the endpoint provided, to create a +// endpoint credential provider. +// +// Config providers used: +// * ContainerCredentialsEndpointPathProvider +func ResolveContainerEndpointPathCredentials(cfg *aws.Config, configs Configs) error { + v, found, err := GetContainerCredentialsEndpointPath(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + cfgCp := cfg.Copy() + + v = containerCredentialsEndpoint + v + cfgCp.EndpointResolver = aws.ResolveWithEndpointURL(v) + + provider := endpointcreds.New(cfgCp) + provider.ExpiryWindow = 5 * time.Minute + + cfg.Credentials = provider + + return nil +} + +// ResolveAssumeRoleCredentials extracts the assume role configuration from +// the external configurations. +// +// Config providers used: +func ResolveAssumeRoleCredentials(cfg *aws.Config, configs Configs) error { + v, found, err := GetAssumeRoleConfig(configs) + if err != nil { + // TODO error handling, What is the best way to handle this? + // capture previous errors continue. error out if all errors + return err + } + if !found { + return nil + } + + cfgCp := cfg.Copy() + // TODO support additional credential providers that are already set? + cfgCp.Credentials = aws.StaticCredentialsProvider{Value: v.Source.Credentials} + + provider := stscreds.NewAssumeRoleProvider( + sts.New(cfgCp), v.RoleARN, + ) + provider.RoleSessionName = v.RoleSessionName + + if id := v.ExternalID; len(id) > 0 { + provider.ExternalID = aws.String(id) + } + if len(v.MFASerial) > 0 { + tp, foundTP, err := GetMFATokenFunc(configs) + if err != nil { + return err + } + if !foundTP { + return fmt.Errorf("token provider required for AssumeRole with MFA") + } + provider.SerialNumber = aws.String(v.MFASerial) + provider.TokenProvider = tp + } + + cfg.Credentials = provider + + return nil +} + +// ResolveFallbackEC2Credentials will configure the AWS config credentials to +// use EC2 Instance Role always. +func ResolveFallbackEC2Credentials(cfg *aws.Config, configs Configs) error { + cfgCp := cfg.Copy() + cfgCp.HTTPClient = shallowCopyHTTPClient(cfgCp.HTTPClient) + cfgCp.HTTPClient.Timeout = 5 * time.Second + + provider := ec2rolecreds.NewProvider(ec2metadata.New(cfgCp)) + provider.ExpiryWindow = 5 * time.Minute + + cfg.Credentials = provider + + return nil +} + +func shallowCopyHTTPClient(client *http.Client) *http.Client { + return &http.Client{ + Transport: client.Transport, + CheckRedirect: client.CheckRedirect, + Jar: client.Jar, + Timeout: client.Timeout, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/external/shared_config.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/shared_config.go new file mode 100644 index 000000000000..c6dc6241a3d6 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/external/shared_config.go @@ -0,0 +1,425 @@ +package external + +import ( + "fmt" + "os" + "path/filepath" + "runtime" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/internal/ini" +) + +const ( + // Static Credentials group + accessKeyIDKey = `aws_access_key_id` // group required + secretAccessKey = `aws_secret_access_key` // group required + sessionTokenKey = `aws_session_token` // optional + + // Assume Role Credentials group + roleArnKey = `role_arn` // group required + sourceProfileKey = `source_profile` // group required + externalIDKey = `external_id` // optional + mfaSerialKey = `mfa_serial` // optional + roleSessionNameKey = `role_session_name` // optional + + // Additional Config fields + regionKey = `region` +) + +// DefaultSharedConfigProfile is the default profile to be used when +// loading configuration from the config files if another profile name +// is not provided. +var DefaultSharedConfigProfile = `default` + +// DefaultSharedCredentialsFilename returns the SDK's default file path +// for the shared credentials file. +// +// Builds the shared config file path based on the OS's platform. +// +// - Linux/Unix: $HOME/.aws/credentials +// - Windows: %USERPROFILE%\.aws\credentials +func DefaultSharedCredentialsFilename() string { + return filepath.Join(userHomeDir(), ".aws", "credentials") +} + +// DefaultSharedConfigFilename returns the SDK's default file path for +// the shared config file. +// +// Builds the shared config file path based on the OS's platform. +// +// - Linux/Unix: $HOME/.aws/config +// - Windows: %USERPROFILE%\.aws\config +func DefaultSharedConfigFilename() string { + return filepath.Join(userHomeDir(), ".aws", "config") +} + +// DefaultSharedConfigFiles is a slice of the default shared config files that +// the will be used in order to load the SharedConfig. +var DefaultSharedConfigFiles = []string{ + DefaultSharedCredentialsFilename(), + DefaultSharedConfigFilename(), +} + +// AssumeRoleConfig provides the values defining the configuration for an IAM +// assume role. +type AssumeRoleConfig struct { + RoleARN string + ExternalID string + MFASerial string + RoleSessionName string + + sourceProfile string + Source *SharedConfig +} + +// SharedConfig represents the configuration fields of the SDK config files. +type SharedConfig struct { + Profile string + + // Credentials values from the config file. Both aws_access_key_id + // and aws_secret_access_key must be provided together in the same file + // to be considered valid. The values will be ignored if not a complete group. + // aws_session_token is an optional field that can be provided if both of the + // other two fields are also provided. + // + // aws_access_key_id + // aws_secret_access_key + // aws_session_token + Credentials aws.Credentials + + AssumeRole AssumeRoleConfig + + // Region is the region the SDK should use for looking up AWS service endpoints + // and signing requests. + // + // region + Region string +} + +// GetRegion returns the region for the profile if a region is set. +func (c SharedConfig) GetRegion() (string, error) { + return c.Region, nil +} + +// GetCredentialsValue returns the credentials for a profile if they were set. +func (c SharedConfig) GetCredentialsValue() (aws.Credentials, error) { + return c.Credentials, nil +} + +// GetAssumeRoleConfig returns the assume role config for a profile. Will be +// a zero value if not set. +func (c SharedConfig) GetAssumeRoleConfig() (AssumeRoleConfig, error) { + return c.AssumeRole, nil +} + +// LoadSharedConfigIgnoreNotExist is an alias for LoadSharedConfig with the +// addition of ignoring when none of the files exist or when the profile +// is not found in any of the files. +func LoadSharedConfigIgnoreNotExist(configs Configs) (Config, error) { + cfg, err := LoadSharedConfig(configs) + if err != nil { + if _, ok := err.(SharedConfigNotExistErrors); ok { + return SharedConfig{}, nil + } + return nil, err + } + + return cfg, nil +} + +// LoadSharedConfig uses the Configs passed in to load the SharedConfig from file +// The file names and profile name are sourced from the Configs. +// +// If profile name is not provided DefaultSharedConfigProfile (default) will +// be used. +// +// If shared config filenames are not provided DefaultSharedConfigFiles will +// be used. +// +// Config providers used: +// * SharedConfigProfileProvider +// * SharedConfigFilesProvider +func LoadSharedConfig(configs Configs) (Config, error) { + var profile string + var files []string + var ok bool + var err error + + profile, ok, err = GetSharedConfigProfile(configs) + if err != nil { + return nil, err + } + if !ok { + profile = DefaultSharedConfigProfile + } + + files, ok, err = GetSharedConfigFiles(configs) + if err != nil { + return nil, err + } + if !ok { + files = DefaultSharedConfigFiles + } + + return NewSharedConfig(profile, files) +} + +// NewSharedConfig retrieves the configuration from the list of files +// using the profile provided. The order the files are listed will determine +// precedence. Values in subsequent files will overwrite values defined in +// earlier files. +// +// For example, given two files A and B. Both define credentials. If the order +// of the files are A then B, B's credential values will be used instead of A's. +func NewSharedConfig(profile string, filenames []string) (SharedConfig, error) { + if len(filenames) == 0 { + return SharedConfig{}, fmt.Errorf("no shared config files provided") + } + + files, err := loadSharedConfigIniFiles(filenames) + if err != nil { + return SharedConfig{}, err + } + + cfg := SharedConfig{} + if err = cfg.setFromIniFiles(profile, files); err != nil { + return SharedConfig{}, err + } + + if len(cfg.AssumeRole.sourceProfile) > 0 { + if err := cfg.setAssumeRoleSource(profile, files); err != nil { + return SharedConfig{}, err + } + } + + return cfg, nil +} + +type sharedConfigFile struct { + Filename string + IniData ini.Sections +} + +func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { + files := make([]sharedConfigFile, 0, len(filenames)) + + errs := SharedConfigNotExistErrors{} + for _, filename := range filenames { + sections, err := ini.OpenFile(filename) + if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ini.ErrCodeUnableToReadFile { + errs = append(errs, + SharedConfigFileNotExistError{Filename: filename, Err: err}, + ) + // Skip files which can't be opened and read for whatever reason + continue + } else if err != nil { + return nil, SharedConfigLoadError{Filename: filename, Err: err} + } + + files = append(files, sharedConfigFile{ + Filename: filename, IniData: sections, + }) + } + + if len(files) == 0 { + return nil, errs + } + + return files, nil +} + +func (c *SharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { + var assumeRoleSrc SharedConfig + + // Multiple level assume role chains are not support + if c.AssumeRole.sourceProfile == origProfile { + assumeRoleSrc = *c + assumeRoleSrc.AssumeRole = AssumeRoleConfig{} + } else { + err := assumeRoleSrc.setFromIniFiles(c.AssumeRole.sourceProfile, files) + if err != nil { + return SharedConfigAssumeRoleError{ + Profile: c.Profile, + RoleARN: c.AssumeRole.RoleARN, + Err: err, + } + } + } + + if len(assumeRoleSrc.Credentials.AccessKeyID) == 0 { + return SharedConfigAssumeRoleError{ + Profile: c.Profile, + RoleARN: c.AssumeRole.RoleARN, + Err: fmt.Errorf("source profile has no shared credentials"), + } + } + + c.AssumeRole.Source = &assumeRoleSrc + + return nil +} + +// Returns an error if all of the files fail to load. If at least one file is +// successfully loaded and contains the profile, no error will be returned. +func (c *SharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { + c.Profile = profile + + existErrs := SharedConfigNotExistErrors{} + for _, f := range files { + if err := c.setFromIniFile(profile, f); err != nil { + if _, ok := err.(SharedConfigProfileNotExistError); ok { + existErrs = append(existErrs, err) + continue + } + return err + } + } + + if len(existErrs) == len(files) { + return existErrs + } + + return nil +} + +// setFromFile loads the configuration from the file using +// the profile provided. A SharedConfig pointer type value is used so that +// multiple config file loadings can be chained. +// +// Only loads complete logically grouped values, and will not set fields in cfg +// for incomplete grouped values in the config. Such as credentials. For example +// if a config file only includes aws_access_key_id but no aws_secret_access_key +// the aws_access_key_id will be ignored. +func (c *SharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { + section, ok := file.IniData.GetSection(profile) + if !ok { + // Fallback to to alternate profile name: profile + section, ok = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) + if !ok { + return SharedConfigProfileNotExistError{ + Filename: file.Filename, + Profile: profile, + Err: nil, + } + } + } + + // Shared Credentials + akid := section.String(accessKeyIDKey) + secret := section.String(secretAccessKey) + if len(akid) > 0 && len(secret) > 0 { + c.Credentials = aws.Credentials{ + AccessKeyID: akid, + SecretAccessKey: secret, + SessionToken: section.String(sessionTokenKey), + Source: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), + } + } + + // Assume Role + roleArn := section.String(roleArnKey) + srcProfile := section.String(sourceProfileKey) + if len(roleArn) > 0 && len(srcProfile) > 0 { + c.AssumeRole = AssumeRoleConfig{ + RoleARN: roleArn, + ExternalID: section.String(externalIDKey), + MFASerial: section.String(mfaSerialKey), + RoleSessionName: section.String(roleSessionNameKey), + + sourceProfile: srcProfile, + } + } + + // Region + if v := section.String(regionKey); len(v) > 0 { + c.Region = v + } + + return nil +} + +// SharedConfigNotExistErrors provides an error type for failure to load shared +// config because resources do not exist. +type SharedConfigNotExistErrors []error + +func (es SharedConfigNotExistErrors) Error() string { + msg := "failed to load shared config\n" + for _, e := range es { + msg += "\t" + e.Error() + } + return msg +} + +// SharedConfigLoadError is an error for the shared config file failed to load. +type SharedConfigLoadError struct { + Filename string + Err error +} + +// Cause is the underlying error that caused the failure. +func (e SharedConfigLoadError) Cause() error { + return e.Err +} + +func (e SharedConfigLoadError) Error() string { + return fmt.Sprintf("failed to load shared config file, %s, %v", e.Filename, e.Err) +} + +// SharedConfigFileNotExistError is an error for the shared config when +// the filename does not exist. +type SharedConfigFileNotExistError struct { + Filename string + Profile string + Err error +} + +// Cause is the underlying error that caused the failure. +func (e SharedConfigFileNotExistError) Cause() error { + return e.Err +} + +func (e SharedConfigFileNotExistError) Error() string { + return fmt.Sprintf("failed to open shared config file, %s, %v", e.Filename, e.Err) +} + +// SharedConfigProfileNotExistError is an error for the shared config when +// the profile was not find in the config file. +type SharedConfigProfileNotExistError struct { + Filename string + Profile string + Err error +} + +// Cause is the underlying error that caused the failure. +func (e SharedConfigProfileNotExistError) Cause() error { + return e.Err +} + +func (e SharedConfigProfileNotExistError) Error() string { + return fmt.Sprintf("failed to get shared config profile, %s, in %s, %v", e.Profile, e.Filename, e.Err) +} + +// SharedConfigAssumeRoleError is an error for the shared config when the +// profile contains assume role information, but that information is invalid +// or not complete. +type SharedConfigAssumeRoleError struct { + Profile string + RoleARN string + Err error +} + +func (e SharedConfigAssumeRoleError) Error() string { + return fmt.Sprintf("failed to load assume role %s, of profile %s, %v", + e.RoleARN, e.Profile, e.Err) +} + +func userHomeDir() string { + if runtime.GOOS == "windows" { // Windows + return os.Getenv("USERPROFILE") + } + + // *nix + return os.Getenv("HOME") +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/handlers.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/handlers.go new file mode 100644 index 000000000000..be2b4535d18f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/handlers.go @@ -0,0 +1,256 @@ +package aws + +import ( + "fmt" + "strings" +) + +// A Handlers provides a collection of request handlers for various +// stages of handling requests. +type Handlers struct { + Validate HandlerList + Build HandlerList + Sign HandlerList + Send HandlerList + ValidateResponse HandlerList + Unmarshal HandlerList + UnmarshalMeta HandlerList + UnmarshalError HandlerList + Retry HandlerList + AfterRetry HandlerList + Complete HandlerList +} + +// Copy returns of this handler's lists. +func (h *Handlers) Copy() Handlers { + return Handlers{ + Validate: h.Validate.copy(), + Build: h.Build.copy(), + Sign: h.Sign.copy(), + Send: h.Send.copy(), + ValidateResponse: h.ValidateResponse.copy(), + Unmarshal: h.Unmarshal.copy(), + UnmarshalError: h.UnmarshalError.copy(), + UnmarshalMeta: h.UnmarshalMeta.copy(), + Retry: h.Retry.copy(), + AfterRetry: h.AfterRetry.copy(), + Complete: h.Complete.copy(), + } +} + +// Clear removes callback functions for all handlers +func (h *Handlers) Clear() { + h.Validate.Clear() + h.Build.Clear() + h.Send.Clear() + h.Sign.Clear() + h.Unmarshal.Clear() + h.UnmarshalMeta.Clear() + h.UnmarshalError.Clear() + h.ValidateResponse.Clear() + h.Retry.Clear() + h.AfterRetry.Clear() + h.Complete.Clear() +} + +// A HandlerListRunItem represents an entry in the HandlerList which +// is being run. +type HandlerListRunItem struct { + Index int + Handler NamedHandler + Request *Request +} + +// A HandlerList manages zero or more handlers in a list. +type HandlerList struct { + list []NamedHandler + + // Called after each request handler in the list is called. If set + // and the func returns true the HandlerList will continue to iterate + // over the request handlers. If false is returned the HandlerList + // will stop iterating. + // + // Should be used if extra logic to be performed between each handler + // in the list. This can be used to terminate a list's iteration + // based on a condition such as error like, HandlerListStopOnError. + // Or for logging like HandlerListLogItem. + AfterEachFn func(item HandlerListRunItem) bool +} + +// A NamedHandler is a struct that contains a name and function callback. +type NamedHandler struct { + Name string + Fn func(*Request) +} + +// copy creates a copy of the handler list. +func (l *HandlerList) copy() HandlerList { + n := HandlerList{ + AfterEachFn: l.AfterEachFn, + } + if len(l.list) == 0 { + return n + } + + n.list = append(make([]NamedHandler, 0, len(l.list)), l.list...) + return n +} + +// Clear clears the handler list. +func (l *HandlerList) Clear() { + l.list = l.list[0:0] +} + +// Len returns the number of handlers in the list. +func (l *HandlerList) Len() int { + return len(l.list) +} + +// PushBack pushes handler f to the back of the handler list. +func (l *HandlerList) PushBack(f func(*Request)) { + l.PushBackNamed(NamedHandler{"__anonymous", f}) +} + +// PushBackNamed pushes named handler f to the back of the handler list. +func (l *HandlerList) PushBackNamed(n NamedHandler) { + if cap(l.list) == 0 { + l.list = make([]NamedHandler, 0, 5) + } + l.list = append(l.list, n) +} + +// PushFront pushes handler f to the front of the handler list. +func (l *HandlerList) PushFront(f func(*Request)) { + l.PushFrontNamed(NamedHandler{"__anonymous", f}) +} + +// PushFrontNamed pushes named handler f to the front of the handler list. +func (l *HandlerList) PushFrontNamed(n NamedHandler) { + if cap(l.list) == len(l.list) { + // Allocating new list required + l.list = append([]NamedHandler{n}, l.list...) + } else { + // Enough room to prepend into list. + l.list = append(l.list, NamedHandler{}) + copy(l.list[1:], l.list) + l.list[0] = n + } +} + +// Remove removes a NamedHandler n +func (l *HandlerList) Remove(n NamedHandler) { + l.RemoveByName(n.Name) +} + +// RemoveByName removes a NamedHandler by name. +func (l *HandlerList) RemoveByName(name string) { + for i := 0; i < len(l.list); i++ { + m := l.list[i] + if m.Name == name { + // Shift array preventing creating new arrays + copy(l.list[i:], l.list[i+1:]) + l.list[len(l.list)-1] = NamedHandler{} + l.list = l.list[:len(l.list)-1] + + // decrement list so next check to length is correct + i-- + } + } +} + +// SwapNamed will swap out any existing handlers with the same name as the +// passed in NamedHandler returning true if handlers were swapped. False is +// returned otherwise. +func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) { + for i := 0; i < len(l.list); i++ { + if l.list[i].Name == n.Name { + l.list[i].Fn = n.Fn + swapped = true + } + } + + return swapped +} + +// SetBackNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the end of the list. +func (l *HandlerList) SetBackNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushBackNamed(n) + } +} + +// SetFrontNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the beginning of +// the list. +func (l *HandlerList) SetFrontNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushFrontNamed(n) + } +} + +// Run executes all handlers in the list with a given request object. +func (l *HandlerList) Run(r *Request) { + for i, h := range l.list { + h.Fn(r) + item := HandlerListRunItem{ + Index: i, Handler: h, Request: r, + } + if l.AfterEachFn != nil && !l.AfterEachFn(item) { + return + } + } +} + +// HandlerListLogItem logs the request handler and the state of the +// request's Error value. Always returns true to continue iterating +// request handlers in a HandlerList. +func HandlerListLogItem(item HandlerListRunItem) bool { + if item.Request.Config.Logger == nil { + return true + } + item.Request.Config.Logger.Log("DEBUG: RequestHandler", + item.Index, item.Handler.Name, item.Request.Error) + + return true +} + +// HandlerListStopOnError returns false to stop the HandlerList iterating +// over request handlers if Request.Error is not nil. True otherwise +// to continue iterating. +func HandlerListStopOnError(item HandlerListRunItem) bool { + return item.Request.Error == nil +} + +// WithAppendUserAgent will add a string to the user agent prefixed with a +// single white space. +func WithAppendUserAgent(s string) Option { + return func(r *Request) { + r.Handlers.Build.PushBack(func(r2 *Request) { + AddToUserAgent(r, s) + }) + } +} + +// MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request +// header. If the extra parameters are provided they will be added as metadata to the +// name/version pair resulting in the following format. +// "name/version (extra0; extra1; ...)" +// The user agent part will be concatenated with this current request's user agent string. +func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request) { + ua := fmt.Sprintf("%s/%s", name, version) + if len(extra) > 0 { + ua += fmt.Sprintf(" (%s)", strings.Join(extra, "; ")) + } + return func(r *Request) { + AddToUserAgent(r, ua) + } +} + +// MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. +// The input string will be concatenated with the current request's user agent string. +func MakeAddToUserAgentFreeFormHandler(s string) func(*Request) { + return func(r *Request) { + AddToUserAgent(r, s) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/http_request.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/http_request.go new file mode 100644 index 000000000000..40dfe40d18e9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/http_request.go @@ -0,0 +1,24 @@ +package aws + +import ( + "io" + "net/http" + "net/url" +) + +func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request { + req := new(http.Request) + *req = *r + req.URL = &url.URL{} + *req.URL = *r.URL + req.Body = body + + req.Header = http.Header{} + for k, v := range r.Header { + for _, vv := range v { + req.Header.Add(k, vv) + } + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/jsonvalue.go new file mode 100644 index 000000000000..91a6f277a7eb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/jsonvalue.go @@ -0,0 +1,12 @@ +package aws + +// JSONValue is a representation of a grab bag type that will be marshaled +// into a json string. This type can be used just like any other map. +// +// Example: +// +// values := aws.JSONValue{ +// "Foo": "Bar", +// } +// values["Baz"] = "Qux" +type JSONValue map[string]interface{} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/logger.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/logger.go new file mode 100644 index 000000000000..189e5201eb85 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/logger.go @@ -0,0 +1,97 @@ +package aws + +import ( + "log" + "os" +) + +// A LogLevel defines the level logging should be performed at. Used to instruct +// the SDK which statements should be logged. +type LogLevel uint + +// Matches returns true if the v LogLevel is enabled by this LogLevel. Should be +// used with logging sub levels. Is safe to use on nil value LogLevelTypes. If +// LogLevel is nil, will default to LogOff comparison. +func (l LogLevel) Matches(v LogLevel) bool { + return l&v == v +} + +// AtLeast returns true if this LogLevel is at least high enough to satisfies v. +// Is safe to use on nil value LogLevelTypes. If LogLevel is nil, will default +// to LogOff comparison. +func (l LogLevel) AtLeast(v LogLevel) bool { + return l >= v +} + +const ( + // LogOff states that no logging should be performed by the SDK. This is the + // default state of the SDK, and should be use to disable all logging. + LogOff LogLevel = iota * 0x1000 + + // LogDebug state that debug output should be logged by the SDK. This should + // be used to inspect request made and responses received. + LogDebug +) + +// Debug Logging Sub Levels +const ( + // LogDebugWithSigning states that the SDK should log request signing and + // presigning events. This should be used to log the signing details of + // requests for debugging. Will also enable LogDebug. + LogDebugWithSigning LogLevel = LogDebug | (1 << iota) + + // LogDebugWithHTTPBody states the SDK should log HTTP request and response + // HTTP bodys in addition to the headers and path. This should be used to + // see the body content of requests and responses made while using the SDK + // Will also enable LogDebug. + LogDebugWithHTTPBody + + // LogDebugWithRequestRetries states the SDK should log when service requests will + // be retried. This should be used to log when you want to log when service + // requests are being retried. Will also enable LogDebug. + LogDebugWithRequestRetries + + // LogDebugWithRequestErrors states the SDK should log when service requests fail + // to build, send, validate, or unmarshal. + LogDebugWithRequestErrors +) + +// A Logger is a minimalistic interface for the SDK to log messages to. Should +// be used to provide custom logging writers for the SDK to use. +type Logger interface { + Log(...interface{}) +} + +// A LoggerFunc is a convenience type to convert a function taking a variadic +// list of arguments and wrap it so the Logger interface can be used. +// +// Example: +// s3.New(sess, &aws.Config{Logger: aws.LoggerFunc(func(args ...interface{}) { +// fmt.Fprintln(os.Stdout, args...) +// })}) +type LoggerFunc func(...interface{}) + +// Log calls the wrapped function with the arguments provided +func (f LoggerFunc) Log(args ...interface{}) { + f(args...) +} + +// NewDefaultLogger returns a Logger which will write log messages to stdout, and +// use same formatting runes as the stdlib log.Logger +// +// TODO remove, moved to default pkg +func NewDefaultLogger() Logger { + return &defaultLogger{ + logger: log.New(os.Stdout, "", log.LstdFlags), + } +} + +// A defaultLogger provides a minimalistic logger satisfying the Logger interface. +type defaultLogger struct { + logger *log.Logger +} + +// Log logs the parameters to the stdlib logger. See log.Println. +func (l defaultLogger) Log(args ...interface{}) { + l.logger.Println(args...) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/offset_reader.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/offset_reader.go new file mode 100644 index 000000000000..cb4614cd3a59 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/offset_reader.go @@ -0,0 +1,58 @@ +package aws + +import ( + "io" + "sync" +) + +// offsetReader is a thread-safe io.ReadCloser to prevent racing +// with retrying requests +type offsetReader struct { + buf io.ReadSeeker + lock sync.Mutex + closed bool +} + +func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { + reader := &offsetReader{} + buf.Seek(offset, 0) + + reader.buf = buf + return reader +} + +// Close will close the instance of the offset reader's access to +// the underlying io.ReadSeeker. +func (o *offsetReader) Close() error { + o.lock.Lock() + defer o.lock.Unlock() + o.closed = true + return nil +} + +// Read is a thread-safe read of the underlying io.ReadSeeker +func (o *offsetReader) Read(p []byte) (int, error) { + o.lock.Lock() + defer o.lock.Unlock() + + if o.closed { + return 0, io.EOF + } + + return o.buf.Read(p) +} + +// Seek is a thread-safe seeking operation. +func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { + o.lock.Lock() + defer o.lock.Unlock() + + return o.buf.Seek(offset, whence) +} + +// CloseAndCopy will return a new offsetReader with a copy of the old buffer +// and close the old buffer. +func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { + o.Close() + return newOffsetReader(o.buf, offset) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request.go new file mode 100644 index 000000000000..b180eb3b816c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request.go @@ -0,0 +1,587 @@ +package aws + +import ( + "bytes" + "fmt" + "io" + "net" + "net/http" + "net/url" + "reflect" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +const ( + // ErrCodeSerialization is the serialization error code that is received + // during protocol unmarshaling. + ErrCodeSerialization = "SerializationError" + + // ErrCodeRead is an error that is returned during HTTP reads. + ErrCodeRead = "ReadError" + + // ErrCodeResponseTimeout is the connection timeout error that is received + // during body reads. + ErrCodeResponseTimeout = "ResponseTimeout" + + // ErrCodeRequestCanceled is the error code that will be returned by an + // API request that was canceled. Requests given a Context may + // return this error when canceled. + ErrCodeRequestCanceled = "RequestCanceled" +) + +// A Request is the service request to be made. +type Request struct { + Config Config + Metadata Metadata + Handlers Handlers + + Retryer + Time time.Time + ExpireTime time.Duration + Operation *Operation + HTTPRequest *http.Request + HTTPResponse *http.Response + Body io.ReadSeeker + BodyStart int64 // offset from beginning of Body that the request body starts + Params interface{} + Error error + Data interface{} + RequestID string + RetryCount int + Retryable *bool + RetryDelay time.Duration + NotHoist bool + SignedHeaderVals http.Header + LastSignedAt time.Time + DisableFollowRedirects bool + + context Context + + built bool + + // Need to persist an intermediate body between the input Body and HTTP + // request body because the HTTP Client's transport can maintain a reference + // to the HTTP request's body after the client has returned. This value is + // safe to use concurrently and wrap the input Body for each HTTP request. + safeBody *offsetReader +} + +// An Operation is the service API operation to be made. +type Operation struct { + Name string + HTTPMethod string + HTTPPath string + *Paginator + + BeforePresignFn func(r *Request) error +} + +// New returns a new Request pointer for the service API +// operation and parameters. +// +// Params is any value of input parameters to be the request payload. +// Data is pointer value to an object which the request's response +// payload will be deserialized to. +func New(cfg Config, metadata Metadata, handlers Handlers, + retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request { + + // TODO improve this experiance for config copy? + cfg = cfg.Copy() + + method := operation.HTTPMethod + if method == "" { + method = "POST" + } + + httpReq, _ := http.NewRequest(method, "", nil) + + // TODO need better way of handling this error... NewRequest should return error. + endpoint, err := cfg.EndpointResolver.ResolveEndpoint(metadata.ServiceName, cfg.Region) + if err == nil { + // TODO so ugly + metadata.Endpoint = endpoint.URL + if len(endpoint.SigningName) > 0 && !endpoint.SigningNameDerived { + metadata.SigningName = endpoint.SigningName + } + if len(endpoint.SigningRegion) > 0 { + metadata.SigningRegion = endpoint.SigningRegion + } + + httpReq.URL, err = url.Parse(endpoint.URL + operation.HTTPPath) + if err != nil { + httpReq.URL = &url.URL{} + err = awserr.New("InvalidEndpointURL", "invalid endpoint uri", err) + } + } + + r := &Request{ + Config: cfg, + Metadata: metadata, + Handlers: handlers.Copy(), + + Retryer: retryer, + Time: time.Now(), + ExpireTime: 0, + Operation: operation, + HTTPRequest: httpReq, + Body: nil, + Params: params, + Error: err, + Data: data, + } + r.SetBufferBody([]byte{}) + + return r +} + +// A Option is a functional option that can augment or modify a request when +// using a WithContext API operation method. +type Option func(*Request) + +// WithGetResponseHeader builds a request Option which will retrieve a single +// header value from the HTTP Response. If there are multiple values for the +// header key use WithGetResponseHeaders instead to access the http.Header +// map directly. The passed in val pointer must be non-nil. +// +// This Option can be used multiple times with a single API operation. +// +// var id2, versionID string +// svc.PutObjectWithContext(ctx, params, +// request.WithGetResponseHeader("x-amz-id-2", &id2), +// request.WithGetResponseHeader("x-amz-version-id", &versionID), +// ) +func WithGetResponseHeader(key string, val *string) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *val = req.HTTPResponse.Header.Get(key) + }) + } +} + +// WithGetResponseHeaders builds a request Option which will retrieve the +// headers from the HTTP response and assign them to the passed in headers +// variable. The passed in headers pointer must be non-nil. +// +// var headers http.Header +// svc.PutObjectWithContext(ctx, params, request.WithGetResponseHeaders(&headers)) +func WithGetResponseHeaders(headers *http.Header) Option { + return func(r *Request) { + r.Handlers.Complete.PushBack(func(req *Request) { + *headers = req.HTTPResponse.Header + }) + } +} + +// WithLogLevel is a request option that will set the request to use a specific +// log level when the request is made. +// +// svc.PutObjectWithContext(ctx, params, request.WithLogLevel(LogDebugWithHTTPBody) +func WithLogLevel(l LogLevel) Option { + return func(r *Request) { + r.Config.LogLevel = l + } +} + +// ApplyOptions will apply each option to the request calling them in the order +// the were provided. +func (r *Request) ApplyOptions(opts ...Option) { + for _, opt := range opts { + opt(r) + } +} + +// Context will always returns a non-nil context. If Request does not have a +// context BackgroundContext will be returned. +func (r *Request) Context() Context { + if r.context != nil { + return r.context + } + return BackgroundContext() +} + +// SetContext adds a Context to the current request that can be used to cancel +// a in-flight request. The Context value must not be nil, or this method will +// panic. +// +// Unlike http.Request.WithContext, SetContext does not return a copy of the +// Request. It is not safe to use use a single Request value for multiple +// requests. A new Request should be created for each API operation request. +// +// Go 1.6 and below: +// The http.Request's Cancel field will be set to the Done() value of +// the context. This will overwrite the Cancel field's value. +// +// Go 1.7 and above: +// The http.Request.WithContext will be used to set the context on the underlying +// http.Request. This will create a shallow copy of the http.Request. The SDK +// may create sub contexts in the future for nested requests such as retries. +func (r *Request) SetContext(ctx Context) { + if ctx == nil { + panic("context cannot be nil") + } + setRequestContext(r, ctx) +} + +// WillRetry returns if the request's can be retried. +func (r *Request) WillRetry() bool { + return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() +} + +// ParamsFilled returns if the request's parameters have been populated +// and the parameters are valid. False is returned if no parameters are +// provided or invalid. +func (r *Request) ParamsFilled() bool { + return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid() +} + +// SetBufferBody will set the request's body bytes that will be sent to +// the service API. +func (r *Request) SetBufferBody(buf []byte) { + r.SetReaderBody(bytes.NewReader(buf)) +} + +// SetStringBody sets the body of the request to be backed by a string. +func (r *Request) SetStringBody(s string) { + r.SetReaderBody(strings.NewReader(s)) +} + +// SetReaderBody will set the request's body reader. +func (r *Request) SetReaderBody(reader io.ReadSeeker) { + r.Body = reader + r.ResetBody() +} + +// Presign returns the request's signed URL. Error will be returned +// if the signing fails. +func (r *Request) Presign(expireTime time.Duration) (string, error) { + r.ExpireTime = expireTime + r.NotHoist = false + + if r.Operation.BeforePresignFn != nil { + r = r.copy() + err := r.Operation.BeforePresignFn(r) + if err != nil { + return "", err + } + } + + r.Sign() + if r.Error != nil { + return "", r.Error + } + return r.HTTPRequest.URL.String(), nil +} + +// PresignRequest behaves just like presign, with the addition of returning a +// set of headers that were signed. +// +// Returns the URL string for the API operation with signature in the query string, +// and the HTTP headers that were included in the signature. These headers must +// be included in any HTTP request made with the presigned URL. +// +// To prevent hoisting any headers to the query string set NotHoist to true on +// this Request value prior to calling PresignRequest. +func (r *Request) PresignRequest(expireTime time.Duration) (string, http.Header, error) { + r.ExpireTime = expireTime + r.Sign() + if r.Error != nil { + return "", nil, r.Error + } + return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil +} + +func debugLogReqError(r *Request, stage string, retrying bool, err error) { + if !r.Config.LogLevel.Matches(LogDebugWithRequestErrors) { + return + } + + retryStr := "not retrying" + if retrying { + retryStr = "will retry" + } + + r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", + stage, r.Metadata.ServiceName, r.Operation.Name, retryStr, err)) +} + +// Build will build the request's object so it can be signed and sent +// to the service. Build will also validate all the request's parameters. +// Anny additional build Handlers set on this request will be run +// in the order they were set. +// +// The request will only be built once. Multiple calls to build will have +// no effect. +// +// If any Validate or Build errors occur the build will stop and the error +// which occurred will be returned. +func (r *Request) Build() error { + if !r.built { + r.Handlers.Validate.Run(r) + if r.Error != nil { + debugLogReqError(r, "Validate Request", false, r.Error) + return r.Error + } + r.Handlers.Build.Run(r) + if r.Error != nil { + debugLogReqError(r, "Build Request", false, r.Error) + return r.Error + } + r.built = true + } + + return r.Error +} + +// Sign will sign the request returning error if errors are encountered. +// +// Send will build the request prior to signing. All Sign Handlers will +// be executed in the order they were set. +func (r *Request) Sign() error { + r.Build() + if r.Error != nil { + debugLogReqError(r, "Build Request", false, r.Error) + return r.Error + } + + r.Handlers.Sign.Run(r) + return r.Error +} + +func (r *Request) getNextRequestBody() (io.ReadCloser, error) { + if r.safeBody != nil { + r.safeBody.Close() + } + + r.safeBody = newOffsetReader(r.Body, r.BodyStart) + + // Go 1.8 tightened and clarified the rules code needs to use when building + // requests with the http package. Go 1.8 removed the automatic detection + // of if the Request.Body was empty, or actually had bytes in it. The SDK + // always sets the Request.Body even if it is empty and should not actually + // be sent. This is incorrect. + // + // Go 1.8 did add a http.NoBody value that the SDK can use to tell the http + // client that the request really should be sent without a body. The + // Request.Body cannot be set to nil, which is preferable, because the + // field is exported and could introduce nil pointer dereferences for users + // of the SDK if they used that field. + // + // Related golang/go#18257 + l, err := computeBodyLength(r.Body) + if err != nil { + return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) + } + + var body io.ReadCloser + if l == 0 { + body = NoBody + } else if l > 0 { + body = r.safeBody + } else { + // Hack to prevent sending bodies for methods where the body + // should be ignored by the server. Sending bodies on these + // methods without an associated ContentLength will cause the + // request to socket timeout because the server does not handle + // Transfer-Encoding: chunked bodies for these methods. + // + // This would only happen if a ReaderSeekerCloser was used with + // a io.Reader that was not also an io.Seeker. + switch r.Operation.HTTPMethod { + case "GET", "HEAD", "DELETE": + body = NoBody + default: + body = r.safeBody + } + } + + return body, nil +} + +// Attempts to compute the length of the body of the reader using the +// io.Seeker interface. If the value is not seekable because of being +// a ReaderSeekerCloser without an unerlying Seeker -1 will be returned. +// If no error occurs the length of the body will be returned. +func computeBodyLength(r io.ReadSeeker) (int64, error) { + seekable := true + // Determine if the seeker is actually seekable. ReaderSeekerCloser + // hides the fact that a io.Readers might not actually be seekable. + switch v := r.(type) { + case ReaderSeekerCloser: + seekable = v.IsSeeker() + case *ReaderSeekerCloser: + seekable = v.IsSeeker() + } + if !seekable { + return -1, nil + } + + curOffset, err := r.Seek(0, 1) + if err != nil { + return 0, err + } + + endOffset, err := r.Seek(0, 2) + if err != nil { + return 0, err + } + + _, err = r.Seek(curOffset, 0) + if err != nil { + return 0, err + } + + return endOffset - curOffset, nil +} + +// GetBody will return an io.ReadSeeker of the Request's underlying +// input body with a concurrency safe wrapper. +func (r *Request) GetBody() io.ReadSeeker { + return r.safeBody +} + +// Send will send the request returning error if errors are encountered. +// +// Send will sign the request prior to sending. All Send Handlers will +// be executed in the order they were set. +// +// Canceling a request is non-deterministic. If a request has been canceled, +// then the transport will choose, randomly, one of the state channels during +// reads or getting the connection. +// +// readLoop() and getConn(req *Request, cm connectMethod) +// https://github.com/golang/go/blob/master/src/net/http/transport.go +// +// Send will not close the request.Request's body. +func (r *Request) Send() error { + defer func() { + // Regardless of success or failure of the request trigger the Complete + // request handlers. + r.Handlers.Complete.Run(r) + }() + + for { + if BoolValue(r.Retryable) { + if r.Config.LogLevel.Matches(LogDebugWithRequestRetries) { + r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", + r.Metadata.ServiceName, r.Operation.Name, r.RetryCount)) + } + + // The previous http.Request will have a reference to the r.Body + // and the HTTP Client's Transport may still be reading from + // the request's body even though the Client's Do returned. + r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) + r.ResetBody() + + // Closing response body to ensure that no response body is leaked + // between retry attempts. + if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { + r.HTTPResponse.Body.Close() + } + } + + r.Sign() + if r.Error != nil { + return r.Error + } + + r.Retryable = nil + + r.Handlers.Send.Run(r) + if r.Error != nil { + if !shouldRetryCancel(r) { + return r.Error + } + + err := r.Error + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) + if r.Error != nil { + debugLogReqError(r, "Send Request", false, err) + return r.Error + } + debugLogReqError(r, "Send Request", true, err) + continue + } + r.Handlers.UnmarshalMeta.Run(r) + r.Handlers.ValidateResponse.Run(r) + if r.Error != nil { + r.Handlers.UnmarshalError.Run(r) + err := r.Error + + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) + if r.Error != nil { + debugLogReqError(r, "Validate Response", false, err) + return r.Error + } + debugLogReqError(r, "Validate Response", true, err) + continue + } + + r.Handlers.Unmarshal.Run(r) + if r.Error != nil { + err := r.Error + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) + if r.Error != nil { + debugLogReqError(r, "Unmarshal Response", false, err) + return r.Error + } + debugLogReqError(r, "Unmarshal Response", true, err) + continue + } + + break + } + + return nil +} + +// copy will copy a request which will allow for local manipulation of the +// request. +func (r *Request) copy() *Request { + req := &Request{} + *req = *r + req.Handlers = r.Handlers.Copy() + op := *r.Operation + req.Operation = &op + return req +} + +// AddToUserAgent adds the string to the end of the request's current user agent. +func AddToUserAgent(r *Request, s string) { + curUA := r.HTTPRequest.Header.Get("User-Agent") + if len(curUA) > 0 { + s = curUA + " " + s + } + r.HTTPRequest.Header.Set("User-Agent", s) +} + +func shouldRetryCancel(r *Request) bool { + awsErr, ok := r.Error.(awserr.Error) + timeoutErr := false + errStr := r.Error.Error() + if ok { + if awsErr.Code() == ErrCodeRequestCanceled { + return false + } + err := awsErr.OrigErr() + netErr, netOK := err.(net.Error) + timeoutErr = netOK && netErr.Temporary() + if urlErr, ok := err.(*url.Error); !timeoutErr && ok { + errStr = urlErr.Err.Error() + } + } + + // There can be two types of canceled errors here. + // The first being a net.Error and the other being an error. + // If the request was timed out, we want to continue the retry + // process. Otherwise, return the canceled error. + return timeoutErr || + (errStr != "net/http: request canceled" && + errStr != "net/http: request canceled while waiting for connection") + +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_7.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_7.go new file mode 100644 index 000000000000..6db88c8648fc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_7.go @@ -0,0 +1,39 @@ +// +build !go1.8 + +package aws + +import "io" + +// NoBody is an io.ReadCloser with no bytes. Read always returns EOF +// and Close always returns nil. It can be used in an outgoing client +// request to explicitly signal that a request has zero bytes. +// An alternative, however, is to simply set Request.Body to nil. +// +// Copy of Go 1.8 NoBody type from net/http/http.go +type noBody struct{} + +func (noBody) Read([]byte) (int, error) { return 0, io.EOF } +func (noBody) Close() error { return nil } +func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } + +// NoBody is an empty reader that will trigger the Go HTTP client to not include +// and body in the HTTP request. +var NoBody = noBody{} + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_8.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_8.go new file mode 100644 index 000000000000..ad81c3d8bfbd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_1_8.go @@ -0,0 +1,33 @@ +// +build go1.8 + +package aws + +import ( + "net/http" +) + +// NoBody is a http.NoBody reader instructing Go HTTP client to not include +// and body in the HTTP request. +var NoBody = http.NoBody + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +// +// Will also set the Go 1.8's http.Request.GetBody member to allow retrying +// PUT/POST redirects. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body + r.HTTPRequest.GetBody = r.getNextRequestBody +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context.go new file mode 100644 index 000000000000..19fa4fbb7889 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context.go @@ -0,0 +1,12 @@ +// +build go1.7 + +package aws + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx Context) { + r.context = ctx + r.HTTPRequest = r.HTTPRequest.WithContext(ctx) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context_1_6.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context_1_6.go new file mode 100644 index 000000000000..0b333d25e570 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_context_1_6.go @@ -0,0 +1,12 @@ +// +build !go1.7 + +package aws + +// setContext updates the Request to use the passed in context for cancellation. +// Context will also be used for request retry delay. +// +// Creates shallow copy of the http.Request with the WithContext method. +func setRequestContext(r *Request, ctx Context) { + r.context = ctx + r.HTTPRequest.Cancel = ctx.Done() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/request_pagination.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_pagination.go new file mode 100644 index 000000000000..15594c900d47 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/request_pagination.go @@ -0,0 +1,187 @@ +package aws + +import ( + "sync/atomic" + + "github.com/aws/aws-sdk-go-v2/internal/awsutil" +) + +// A Pager provides paginating of SDK API operations which are paginatable. +// Generally you should not use this type directly, but use the "Pages" API +// operations method to automatically perform pagination for you. Such as, +// "S3.ListObjectsPages", and "S3.ListObjectsPagesWithContext" methods. +// +// Pagier differs from a Paginator type in that pagination is the type that +// does the pagination between API operations, and Paginator defines the +// configuration that will be used per page request. +// +// for p.Next() { +// data := p.CurrentPage().(*s3.ListObjectsOutput) +// // process the page's data +// } +// return p.Err() +// +// See service client API operation Pages methods for examples how the SDK will +// use the Pager type. +type Pager struct { + // Function to return a Request value for each pagination request. + // Any configuration or handlers that need to be applied to the request + // prior to getting the next page should be done here before the request + // returned. + // + // NewRequest should always be built from the same API operations. It is + // undefined if different API operations are returned on subsequent calls. + NewRequest func() (*Request, error) + + started bool + nextTokens []interface{} + + err error + curPage interface{} +} + +// hasNextPage will return true if Pager is able to determine that the API +// operation has additional pages. False will be returned if there are no more +// pages remaining. +// +// Will always return true if Next has not been called yet. +func (p *Pager) hasNextPage() bool { + return !(p.started && len(p.nextTokens) == 0) +} + +// Err returns the error Pager encountered when retrieving the next page. +func (p *Pager) Err() error { + return p.err +} + +// CurrentPage returns the current page. Page should only be called after a successful +// call to Next. It is undefined what Page will return if Page is called after +// Next returns false. +func (p *Pager) CurrentPage() interface{} { + return p.curPage +} + +// Next will attempt to retrieve the next page for the API operation. When a page +// is retrieved true will be returned. If the page cannot be retrieved, or there +// are no more pages false will be returned. +// +// Use the Page method to retrieve the current page data. The data will need +// to be cast to the API operation's output type. +// +// Use the Err method to determine if an error occurred if Page returns false. +func (p *Pager) Next() bool { + if !p.hasNextPage() { + return false + } + + req, err := p.NewRequest() + if err != nil { + p.err = err + return false + } + + if p.started { + for i, intok := range req.Operation.InputTokens { + awsutil.SetValueAtPath(req.Params, intok, p.nextTokens[i]) + } + } + p.started = true + + err = req.Send() + if err != nil { + p.err = err + return false + } + + p.nextTokens = req.nextPageTokens() + p.curPage = req.Data + + return true +} + +// A Paginator is the configuration data that defines how an API operation +// should be paginated. This type is used by the API service models to define +// the generated pagination config for service APIs. +// +// The Pager type is what provides iterating between pages of an API. It +// is only used to store the token metadata the SDK should use for performing +// pagination. +type Paginator struct { + InputTokens []string + OutputTokens []string + LimitToken string + TruncationToken string +} + +// nextPageTokens returns the tokens to use when asking for the next page of data. +func (r *Request) nextPageTokens() []interface{} { + if r.Operation.Paginator == nil { + return nil + } + if r.Operation.TruncationToken != "" { + tr, _ := awsutil.ValuesAtPath(r.Data, r.Operation.TruncationToken) + if len(tr) == 0 { + return nil + } + + switch v := tr[0].(type) { + case *bool: + if !BoolValue(v) { + return nil + } + case bool: + if v == false { + return nil + } + } + } + + tokens := []interface{}{} + tokenAdded := false + for _, outToken := range r.Operation.OutputTokens { + vs, _ := awsutil.ValuesAtPath(r.Data, outToken) + + if len(vs) == 0 { + tokens = append(tokens, nil) + continue + } + v := vs[0] + + switch tv := v.(type) { + case *string: + if len(StringValue(tv)) == 0 { + tokens = append(tokens, nil) + continue + } + case string: + if len(tv) == 0 { + tokens = append(tokens, nil) + continue + } + } + + tokenAdded = true + tokens = append(tokens, v) + } + if !tokenAdded { + return nil + } + + return tokens +} + +// Ensure a deprecated item is only logged once instead of each time its used. +func logDeprecatedf(logger Logger, flag *int32, msg string) { + if logger == nil { + return + } + if atomic.CompareAndSwapInt32(flag, 0, 1) { + logger.Log(msg) + } +} + +var ( + logDeprecatedHasNextPage int32 + logDeprecatedNextPage int32 + logDeprecatedEachPage int32 +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/response.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/response.go new file mode 100644 index 000000000000..ea7717bfe4c8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/response.go @@ -0,0 +1,8 @@ +package aws + +// Response provides the response meta data for a SDK API request's response. +type Response struct { + // TODO these fields should be focused on response, not just embedded request value. + // Need refactor of request for this to be better. + Request *Request +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/retryer.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/retryer.go new file mode 100644 index 000000000000..a71b96999b84 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/retryer.go @@ -0,0 +1,160 @@ +package aws + +import ( + "time" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// Retryer is an interface to control retry logic for a given service. +// The default implementation used by most services is the client.DefaultRetryer +// structure, which contains basic retry logic using exponential backoff. +type Retryer interface { + RetryRules(*Request) time.Duration + ShouldRetry(*Request) bool + MaxRetries() int +} + +// WithRetryer sets a config Retryer value to the given Config returning it +// for chaining. +func WithRetryer(cfg *Config, retryer Retryer) *Config { + cfg.Retryer = retryer + return cfg +} + +// retryableCodes is a collection of service response codes which are retry-able +// without any further action. +var retryableCodes = map[string]struct{}{ + "RequestError": {}, + "RequestTimeout": {}, + ErrCodeResponseTimeout: {}, + "RequestTimeoutException": {}, // Glacier's flavor of RequestTimeout +} + +var throttleCodes = map[string]struct{}{ + "ProvisionedThroughputExceededException": {}, + "Throttling": {}, + "ThrottlingException": {}, + "RequestLimitExceeded": {}, + "RequestThrottled": {}, + "TooManyRequestsException": {}, // Lambda functions + "PriorRequestNotComplete": {}, // Route53 +} + +// credsExpiredCodes is a collection of error codes which signify the credentials +// need to be refreshed. Expired tokens require refreshing of credentials, and +// resigning before the request can be retried. +var credsExpiredCodes = map[string]struct{}{ + "ExpiredToken": {}, + "ExpiredTokenException": {}, + "RequestExpired": {}, // EC2 Only +} + +func isCodeThrottle(code string) bool { + _, ok := throttleCodes[code] + return ok +} + +func isCodeRetryable(code string) bool { + if _, ok := retryableCodes[code]; ok { + return true + } + + return isCodeExpiredCreds(code) +} + +func isCodeExpiredCreds(code string) bool { + _, ok := credsExpiredCodes[code] + return ok +} + +var validParentCodes = map[string]struct{}{ + ErrCodeSerialization: {}, + ErrCodeRead: {}, +} + +type temporaryError interface { + Temporary() bool +} + +func isNestedErrorRetryable(parentErr awserr.Error) bool { + if parentErr == nil { + return false + } + + if _, ok := validParentCodes[parentErr.Code()]; !ok { + return false + } + + err := parentErr.OrigErr() + if err == nil { + return false + } + + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) + } + + if t, ok := err.(temporaryError); ok { + return t.Temporary() || isErrConnectionReset(err) + } + + return isErrConnectionReset(err) +} + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if error is nil. +func IsErrorRetryable(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr) + } + } + return false +} + +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if error is nil. +func IsErrorThrottle(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeThrottle(aerr.Code()) + } + } + return false +} + +// IsErrorExpiredCreds returns whether the error code is a credential expiry error. +// Returns false if error is nil. +func IsErrorExpiredCreds(err error) bool { + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeExpiredCreds(aerr.Code()) + } + } + return false +} + +// IsErrorRetryable returns whether the error is retryable, based on its Code. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorRetryable +func (r *Request) IsErrorRetryable() bool { + return IsErrorRetryable(r.Error) +} + +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set +// +// Alias for the utility function IsErrorThrottle +func (r *Request) IsErrorThrottle() bool { + return IsErrorThrottle(r.Error) +} + +// IsErrorExpired returns whether the error code is a credential expiry error. +// Returns false if the request has no Error set. +// +// Alias for the utility function IsErrorExpiredCreds +func (r *Request) IsErrorExpired() bool { + return IsErrorExpiredCreds(r.Error) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/header_rules.go new file mode 100644 index 000000000000..244c86da0543 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/header_rules.go @@ -0,0 +1,82 @@ +package v4 + +import ( + "net/http" + "strings" +) + +// validator houses a set of rule needed for validation of a +// string value +type rules []rule + +// rule interface allows for more flexible rules and just simply +// checks whether or not a value adheres to that rule +type rule interface { + IsValid(value string) bool +} + +// IsValid will iterate through all rules and see if any rules +// apply to the value and supports nested rules +func (r rules) IsValid(value string) bool { + for _, rule := range r { + if rule.IsValid(value) { + return true + } + } + return false +} + +// mapRule generic rule for maps +type mapRule map[string]struct{} + +// IsValid for the map rule satisfies whether it exists in the map +func (m mapRule) IsValid(value string) bool { + _, ok := m[value] + return ok +} + +// whitelist is a generic rule for whitelisting +type whitelist struct { + rule +} + +// IsValid for whitelist checks if the value is within the whitelist +func (w whitelist) IsValid(value string) bool { + return w.rule.IsValid(value) +} + +// blacklist is a generic rule for blacklisting +type blacklist struct { + rule +} + +// IsValid for whitelist checks if the value is within the whitelist +func (b blacklist) IsValid(value string) bool { + return !b.rule.IsValid(value) +} + +type patterns []string + +// IsValid for patterns checks each pattern and returns if a match has +// been found +func (p patterns) IsValid(value string) bool { + for _, pattern := range p { + if strings.HasPrefix(http.CanonicalHeaderKey(value), pattern) { + return true + } + } + return false +} + +// inclusiveRules rules allow for rules to depend on one another +type inclusiveRules []rule + +// IsValid will return true if all rules are true +func (r inclusiveRules) IsValid(value string) bool { + for _, rule := range r { + if !rule.IsValid(value) { + return false + } + } + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/options.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/options.go new file mode 100644 index 000000000000..6aa2ed241bb1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/options.go @@ -0,0 +1,7 @@ +package v4 + +// WithUnsignedPayload will enable and set the UnsignedPayload field to +// true of the signer. +func WithUnsignedPayload(v4 *Signer) { + v4.UnsignedPayload = true +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/uri_path.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/uri_path.go new file mode 100644 index 000000000000..bd082e9d1f78 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/uri_path.go @@ -0,0 +1,24 @@ +// +build go1.5 + +package v4 + +import ( + "net/url" + "strings" +) + +func getURIPath(u *url.URL) string { + var uri string + + if len(u.Opaque) > 0 { + uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/") + } else { + uri = u.EscapedPath() + } + + if len(uri) == 0 { + uri = "/" + } + + return uri +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/v4.go new file mode 100644 index 000000000000..ddbade68697d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/signer/v4/v4.go @@ -0,0 +1,755 @@ +// Package v4 implements signing for AWS V4 signer +// +// Provides request signing for request that need to be signed with +// AWS V4 Signatures. +// +// Standalone Signer +// +// Generally using the signer outside of the SDK should not require any additional +// logic when using Go v1.5 or higher. The signer does this by taking advantage +// of the URL.EscapedPath method. If your request URI requires additional escaping +// you many need to use the URL.Opaque to define what the raw URI should be sent +// to the service as. +// +// The signer will first check the URL.Opaque field, and use its value if set. +// The signer does require the URL.Opaque field to be set in the form of: +// +// "///" +// +// // e.g. +// "//example.com/some/path" +// +// The leading "//" and hostname are required or the URL.Opaque escaping will +// not work correctly. +// +// If URL.Opaque is not set the signer will fallback to the URL.EscapedPath() +// method and using the returned value. If you're using Go v1.4 you must set +// URL.Opaque if the URI path needs escaping. If URL.Opaque is not set with +// Go v1.5 the signer will fallback to URL.Path. +// +// AWS v4 signature validation requires that the canonical string's URI path +// element must be the URI escaped form of the HTTP request's path. +// http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html +// +// The Go HTTP client will perform escaping automatically on the request. Some +// of these escaping may cause signature validation errors because the HTTP +// request differs from the URI path or query that the signature was generated. +// https://golang.org/pkg/net/url/#URL.EscapedPath +// +// Because of this, it is recommended that when using the signer outside of the +// SDK that explicitly escaping the request prior to being signed is preferable, +// and will help prevent signature validation errors. This can be done by setting +// the URL.Opaque or URL.RawPath. The SDK will use URL.Opaque first and then +// call URL.EscapedPath() if Opaque is not set. +// +// If signing a request intended for HTTP2 server, and you're using Go 1.6.2 +// through 1.7.4 you should use the URL.RawPath as the pre-escaped form of the +// request URL. https://github.com/golang/go/issues/16847 points to a bug in +// Go pre 1.8 that fails to make HTTP2 requests using absolute URL in the HTTP +// message. URL.Opaque generally will force Go to make requests with absolute URL. +// URL.RawPath does not do this, but RawPath must be a valid escaping of Path +// or url.EscapedPath will ignore the RawPath escaping. +// +// Test `TestStandaloneSign` provides a complete example of using the signer +// outside of the SDK and pre-escaping the URI path. +package v4 + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "sort" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/sdk" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" +) + +const ( + authHeaderPrefix = "AWS4-HMAC-SHA256" + timeFormat = "20060102T150405Z" + shortTimeFormat = "20060102" + + // emptyStringSHA256 is a SHA256 of an empty string + emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` +) + +var ignoredHeaders = rules{ + blacklist{ + mapRule{ + "Authorization": struct{}{}, + "User-Agent": struct{}{}, + "X-Amzn-Trace-Id": struct{}{}, + }, + }, +} + +// requiredSignedHeaders is a whitelist for build canonical headers. +var requiredSignedHeaders = rules{ + whitelist{ + mapRule{ + "Cache-Control": struct{}{}, + "Content-Disposition": struct{}{}, + "Content-Encoding": struct{}{}, + "Content-Language": struct{}{}, + "Content-Md5": struct{}{}, + "Content-Type": struct{}{}, + "Expires": struct{}{}, + "If-Match": struct{}{}, + "If-Modified-Since": struct{}{}, + "If-None-Match": struct{}{}, + "If-Unmodified-Since": struct{}{}, + "Range": struct{}{}, + "X-Amz-Acl": struct{}{}, + "X-Amz-Copy-Source": struct{}{}, + "X-Amz-Copy-Source-If-Match": struct{}{}, + "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, + "X-Amz-Copy-Source-If-None-Match": struct{}{}, + "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, + "X-Amz-Copy-Source-Range": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Grant-Full-control": struct{}{}, + "X-Amz-Grant-Read": struct{}{}, + "X-Amz-Grant-Read-Acp": struct{}{}, + "X-Amz-Grant-Write": struct{}{}, + "X-Amz-Grant-Write-Acp": struct{}{}, + "X-Amz-Metadata-Directive": struct{}{}, + "X-Amz-Mfa": struct{}{}, + "X-Amz-Request-Payer": struct{}{}, + "X-Amz-Server-Side-Encryption": struct{}{}, + "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, + "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, + "X-Amz-Storage-Class": struct{}{}, + "X-Amz-Website-Redirect-Location": struct{}{}, + "X-Amz-Content-Sha256": struct{}{}, + }, + }, + patterns{"X-Amz-Meta-"}, +} + +// allowedHoisting is a whitelist for build query headers. The boolean value +// represents whether or not it is a pattern. +var allowedQueryHoisting = inclusiveRules{ + blacklist{requiredSignedHeaders}, + patterns{"X-Amz-"}, +} + +// Signer applies AWS v4 signing to given request. Use this to sign requests +// that need to be signed with AWS V4 Signatures. +type Signer struct { + // The authentication credentials the request will be signed against. + // This value must be set to sign requests. + Credentials aws.CredentialsProvider + + // Sets the log level the signer should use when reporting information to + // the logger. If the logger is nil nothing will be logged. See + // aws.LogLevel for more information on available logging levels + // + // By default nothing will be logged. + Debug aws.LogLevel + + // The logger loging information will be written to. If there the logger + // is nil, nothing will be logged. + Logger aws.Logger + + // Disables the Signer's moving HTTP header key/value pairs from the HTTP + // request header to the request's query string. This is most commonly used + // with pre-signed requests preventing headers from being added to the + // request's query string. + DisableHeaderHoisting bool + + // Disables the automatic escaping of the URI path of the request for the + // siganture's canonical string's path. For services that do not need additional + // escaping then use this to disable the signer escaping the path. + // + // S3 is an example of a service that does not need additional escaping. + // + // http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html + DisableURIPathEscaping bool + + // Disales the automatical setting of the HTTP request's Body field with the + // io.ReadSeeker passed in to the signer. This is useful if you're using a + // custom wrapper around the body for the io.ReadSeeker and want to preserve + // the Body value on the Request.Body. + // + // This does run the risk of signing a request with a body that will not be + // sent in the request. Need to ensure that the underlying data of the Body + // values are the same. + DisableRequestBodyOverwrite bool + + // UnsignedPayload will prevent signing of the payload. This will only + // work for services that have support for this. + UnsignedPayload bool +} + +// NewSigner returns a Signer pointer configured with the credentials and optional +// option values provided. If not options are provided the Signer will use its +// default configuration. +func NewSigner(credsProvider aws.CredentialsProvider, options ...func(*Signer)) *Signer { + v4 := &Signer{ + Credentials: credsProvider, + } + + for _, option := range options { + option(v4) + } + + return v4 +} + +type signingCtx struct { + ServiceName string + Region string + Request *http.Request + Body io.ReadSeeker + Query url.Values + Time time.Time + ExpireTime time.Duration + SignedHeaderVals http.Header + + DisableURIPathEscaping bool + + credValues aws.Credentials + isPresign bool + formattedTime string + formattedShortTime string + unsignedPayload bool + + bodyDigest string + signedHeaders string + canonicalHeaders string + canonicalString string + credentialString string + stringToSign string + signature string + authorization string +} + +// Sign signs AWS v4 requests with the provided body, service name, region the +// request is made to, and time the request is signed at. The signTime allows +// you to specify that a request is signed for the future, and cannot be +// used until then. +// +// Returns a list of HTTP headers that were included in the signature or an +// error if signing the request failed. Generally for signed requests this value +// is not needed as the full request context will be captured by the http.Request +// value. It is included for reference though. +// +// Sign will set the request's Body to be the `body` parameter passed in. If +// the body is not already an io.ReadCloser, it will be wrapped within one. If +// a `nil` body parameter passed to Sign, the request's Body field will be +// also set to nil. Its important to note that this functionality will not +// change the request's ContentLength of the request. +// +// Sign differs from Presign in that it will sign the request using HTTP +// header values. This type of signing is intended for http.Request values that +// will not be shared, or are shared in a way the header values on the request +// will not be lost. +// +// The requests body is an io.ReadSeeker so the SHA256 of the body can be +// generated. To bypass the signer computing the hash you can set the +// "X-Amz-Content-Sha256" header with a precomputed value. The signer will +// only compute the hash if the request header value is empty. +func (v4 Signer) Sign(r *http.Request, body io.ReadSeeker, service, region string, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, 0, signTime) +} + +// Presign signs AWS v4 requests with the provided body, service name, region +// the request is made to, and time the request is signed at. The signTime +// allows you to specify that a request is signed for the future, and cannot +// be used until then. +// +// Returns a list of HTTP headers that were included in the signature or an +// error if signing the request failed. For presigned requests these headers +// and their values must be included on the HTTP request when it is made. This +// is helpful to know what header values need to be shared with the party the +// presigned request will be distributed to. +// +// Presign differs from Sign in that it will sign the request using query string +// instead of header values. This allows you to share the Presigned Request's +// URL with third parties, or distribute it throughout your system with minimal +// dependencies. +// +// Presign also takes an exp value which is the duration the +// signed request will be valid after the signing time. This is allows you to +// set when the request will expire. +// +// The requests body is an io.ReadSeeker so the SHA256 of the body can be +// generated. To bypass the signer computing the hash you can set the +// "X-Amz-Content-Sha256" header with a precomputed value. The signer will +// only compute the hash if the request header value is empty. +// +// Presigning a S3 request will not compute the body's SHA256 hash by default. +// This is done due to the general use case for S3 presigned URLs is to share +// PUT/GET capabilities. If you would like to include the body's SHA256 in the +// presigned request's signature you can set the "X-Amz-Content-Sha256" +// HTTP header and that will be included in the request's signature. +func (v4 Signer) Presign(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { + return v4.signWithBody(r, body, service, region, exp, signTime) +} + +func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, signTime time.Time) (http.Header, error) { + ctx := &signingCtx{ + Request: r, + Body: body, + Query: r.URL.Query(), + Time: signTime, + ExpireTime: exp, + isPresign: exp != 0, + ServiceName: service, + Region: region, + DisableURIPathEscaping: v4.DisableURIPathEscaping, + unsignedPayload: v4.UnsignedPayload, + } + + for key := range ctx.Query { + sort.Strings(ctx.Query[key]) + } + + if ctx.isRequestSigned() { + ctx.Time = sdk.NowTime() + ctx.handlePresignRemoval() + } + + var err error + ctx.credValues, err = v4.Credentials.Retrieve() + if err != nil { + return http.Header{}, err + } + + ctx.assignAmzQueryValues() + ctx.build(v4.DisableHeaderHoisting) + + // If the request is not presigned the body should be attached to it. This + // prevents the confusion of wanting to send a signed request without + // the body the request was signed for attached. + if !(v4.DisableRequestBodyOverwrite || ctx.isPresign) { + var reader io.ReadCloser + if body != nil { + var ok bool + if reader, ok = body.(io.ReadCloser); !ok { + reader = ioutil.NopCloser(body) + } + } + r.Body = reader + } + + if v4.Debug.Matches(aws.LogDebugWithSigning) { + v4.logSigningInfo(ctx) + } + + return ctx.SignedHeaderVals, nil +} + +func (ctx *signingCtx) handlePresignRemoval() { + if !ctx.isPresign { + return + } + + // The credentials have expired for this request. The current signing + // is invalid, and needs to be request because the request will fail. + ctx.removePresign() + + // Update the request's query string to ensure the values stays in + // sync in the case retrieving the new credentials fails. + ctx.Request.URL.RawQuery = ctx.Query.Encode() +} + +func (ctx *signingCtx) assignAmzQueryValues() { + if ctx.isPresign { + ctx.Query.Set("X-Amz-Algorithm", authHeaderPrefix) + if ctx.credValues.SessionToken != "" { + ctx.Query.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) + } else { + ctx.Query.Del("X-Amz-Security-Token") + } + + return + } + + if ctx.credValues.SessionToken != "" { + ctx.Request.Header.Set("X-Amz-Security-Token", ctx.credValues.SessionToken) + } +} + +// SignRequestHandler is a named request handler the SDK will use to sign +// service client request with using the V4 signature. +var SignRequestHandler = aws.NamedHandler{ + Name: "v4.SignRequestHandler", Fn: func(r *aws.Request) { SignSDKRequest(r) }, +} + +// BuildNamedHandler will build a generic handler for signing. +func BuildNamedHandler(name string, opts ...func(*Signer)) aws.NamedHandler { + return aws.NamedHandler{ + Name: name, + Fn: func(req *aws.Request) { + SignSDKRequest(req, opts...) + }, + } +} + +// SignSDKRequest signs an AWS request with the V4 signature. This +// request handler should only be used with the SDK's built in service client's +// API operation requests. +// +// This function should not be used on its on its own, but in conjunction with +// an AWS service client's API operation call. To sign a standalone request +// not created by a service client's API operation method use the "Sign" or +// "Presign" functions of the "Signer" type. +// +// If the credentials of the request's config are set to +// aws.AnonymousCredentials the request will not be signed. +func SignSDKRequest(req *aws.Request, opts ...func(*Signer)) { + // If the request does not need to be signed ignore the signing of the + // request if the AnonymousCredentials object is used. + if req.Config.Credentials == aws.AnonymousCredentials { + return + } + + region := req.Metadata.SigningRegion + if region == "" { + region = req.Config.Region + } + + name := req.Metadata.SigningName + if name == "" { + name = req.Metadata.ServiceName + } + + v4 := NewSigner(req.Config.Credentials, func(v4 *Signer) { + v4.Debug = req.Config.LogLevel + v4.Logger = req.Config.Logger + v4.DisableHeaderHoisting = req.NotHoist + if name == "s3" { + // S3 service should not have any escaping applied + v4.DisableURIPathEscaping = true + } + // Prevents setting the HTTPRequest's Body. Since the Body could be + // wrapped in a custom io.Closer that we do not want to be stompped + // on top of by the signer. + v4.DisableRequestBodyOverwrite = true + }) + + for _, opt := range opts { + opt(v4) + } + + signingTime := req.Time + if !req.LastSignedAt.IsZero() { + signingTime = req.LastSignedAt + } + + signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.GetBody(), + name, region, req.ExpireTime, signingTime, + ) + if err != nil { + req.Error = err + req.SignedHeaderVals = nil + return + } + + req.SignedHeaderVals = signedHeaders + req.LastSignedAt = sdk.NowTime() +} + +const logSignInfoMsg = `DEBUG: Request Signature: +---[ CANONICAL STRING ]----------------------------- +%s +---[ STRING TO SIGN ]-------------------------------- +%s%s +-----------------------------------------------------` +const logSignedURLMsg = ` +---[ SIGNED URL ]------------------------------------ +%s` + +func (v4 *Signer) logSigningInfo(ctx *signingCtx) { + signedURLMsg := "" + if ctx.isPresign { + signedURLMsg = fmt.Sprintf(logSignedURLMsg, ctx.Request.URL.String()) + } + msg := fmt.Sprintf(logSignInfoMsg, ctx.canonicalString, ctx.stringToSign, signedURLMsg) + v4.Logger.Log(msg) +} + +func (ctx *signingCtx) build(disableHeaderHoisting bool) { + ctx.buildTime() // no depends + ctx.buildCredentialString() // no depends + + ctx.buildBodyDigest() + + unsignedHeaders := ctx.Request.Header + if ctx.isPresign { + if !disableHeaderHoisting { + urlValues := url.Values{} + urlValues, unsignedHeaders = buildQuery(allowedQueryHoisting, unsignedHeaders) // no depends + for k := range urlValues { + ctx.Query[k] = urlValues[k] + } + } + } + + ctx.buildCanonicalHeaders(ignoredHeaders, unsignedHeaders) + ctx.buildCanonicalString() // depends on canon headers / signed headers + ctx.buildStringToSign() // depends on canon string + ctx.buildSignature() // depends on string to sign + + if ctx.isPresign { + ctx.Request.URL.RawQuery += "&X-Amz-Signature=" + ctx.signature + } else { + parts := []string{ + authHeaderPrefix + " Credential=" + ctx.credValues.AccessKeyID + "/" + ctx.credentialString, + "SignedHeaders=" + ctx.signedHeaders, + "Signature=" + ctx.signature, + } + ctx.Request.Header.Set("Authorization", strings.Join(parts, ", ")) + } +} + +func (ctx *signingCtx) buildTime() { + ctx.formattedTime = ctx.Time.UTC().Format(timeFormat) + ctx.formattedShortTime = ctx.Time.UTC().Format(shortTimeFormat) + + if ctx.isPresign { + duration := int64(ctx.ExpireTime / time.Second) + ctx.Query.Set("X-Amz-Date", ctx.formattedTime) + ctx.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) + } else { + ctx.Request.Header.Set("X-Amz-Date", ctx.formattedTime) + } +} + +func (ctx *signingCtx) buildCredentialString() { + ctx.credentialString = strings.Join([]string{ + ctx.formattedShortTime, + ctx.Region, + ctx.ServiceName, + "aws4_request", + }, "/") + + if ctx.isPresign { + ctx.Query.Set("X-Amz-Credential", ctx.credValues.AccessKeyID+"/"+ctx.credentialString) + } +} + +func buildQuery(r rule, header http.Header) (url.Values, http.Header) { + query := url.Values{} + unsignedHeaders := http.Header{} + for k, h := range header { + if r.IsValid(k) { + query[k] = h + } else { + unsignedHeaders[k] = h + } + } + + return query, unsignedHeaders +} +func (ctx *signingCtx) buildCanonicalHeaders(r rule, header http.Header) { + var headers []string + headers = append(headers, "host") + for k, v := range header { + canonicalKey := http.CanonicalHeaderKey(k) + if !r.IsValid(canonicalKey) { + continue // ignored header + } + if ctx.SignedHeaderVals == nil { + ctx.SignedHeaderVals = make(http.Header) + } + + lowerCaseKey := strings.ToLower(k) + if _, ok := ctx.SignedHeaderVals[lowerCaseKey]; ok { + // include additional values + ctx.SignedHeaderVals[lowerCaseKey] = append(ctx.SignedHeaderVals[lowerCaseKey], v...) + continue + } + + headers = append(headers, lowerCaseKey) + ctx.SignedHeaderVals[lowerCaseKey] = v + } + sort.Strings(headers) + + ctx.signedHeaders = strings.Join(headers, ";") + + if ctx.isPresign { + ctx.Query.Set("X-Amz-SignedHeaders", ctx.signedHeaders) + } + + headerValues := make([]string, len(headers)) + for i, k := range headers { + if k == "host" { + if ctx.Request.Host != "" { + headerValues[i] = "host:" + ctx.Request.Host + } else { + headerValues[i] = "host:" + ctx.Request.URL.Host + } + } else { + headerValues[i] = k + ":" + + strings.Join(ctx.SignedHeaderVals[k], ",") + } + } + stripExcessSpaces(headerValues) + ctx.canonicalHeaders = strings.Join(headerValues, "\n") +} + +func (ctx *signingCtx) buildCanonicalString() { + ctx.Request.URL.RawQuery = strings.Replace(ctx.Query.Encode(), "+", "%20", -1) + + uri := getURIPath(ctx.Request.URL) + + if !ctx.DisableURIPathEscaping { + uri = rest.EscapePath(uri, false) + } + + ctx.canonicalString = strings.Join([]string{ + ctx.Request.Method, + uri, + ctx.Request.URL.RawQuery, + ctx.canonicalHeaders + "\n", + ctx.signedHeaders, + ctx.bodyDigest, + }, "\n") +} + +func (ctx *signingCtx) buildStringToSign() { + ctx.stringToSign = strings.Join([]string{ + authHeaderPrefix, + ctx.formattedTime, + ctx.credentialString, + hex.EncodeToString(makeSha256([]byte(ctx.canonicalString))), + }, "\n") +} + +func (ctx *signingCtx) buildSignature() { + secret := ctx.credValues.SecretAccessKey + date := makeHmac([]byte("AWS4"+secret), []byte(ctx.formattedShortTime)) + region := makeHmac(date, []byte(ctx.Region)) + service := makeHmac(region, []byte(ctx.ServiceName)) + credentials := makeHmac(service, []byte("aws4_request")) + signature := makeHmac(credentials, []byte(ctx.stringToSign)) + ctx.signature = hex.EncodeToString(signature) +} + +func (ctx *signingCtx) buildBodyDigest() { + hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") + if hash == "" { + includeSHA256Header := ctx.unsignedPayload || + ctx.ServiceName == "s3" || + ctx.ServiceName == "glacier" + + s3Presign := ctx.isPresign && ctx.ServiceName == "s3" + + if ctx.unsignedPayload || s3Presign { + hash = "UNSIGNED-PAYLOAD" + includeSHA256Header = !s3Presign + } else if ctx.Body == nil { + hash = emptyStringSHA256 + } else { + hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) + } + + if includeSHA256Header { + ctx.Request.Header.Set("X-Amz-Content-Sha256", hash) + } + } + ctx.bodyDigest = hash +} + +// isRequestSigned returns if the request is currently signed or presigned +func (ctx *signingCtx) isRequestSigned() bool { + if ctx.isPresign && ctx.Query.Get("X-Amz-Signature") != "" { + return true + } + if ctx.Request.Header.Get("Authorization") != "" { + return true + } + + return false +} + +// unsign removes signing flags for both signed and presigned requests. +func (ctx *signingCtx) removePresign() { + ctx.Query.Del("X-Amz-Algorithm") + ctx.Query.Del("X-Amz-Signature") + ctx.Query.Del("X-Amz-Security-Token") + ctx.Query.Del("X-Amz-Date") + ctx.Query.Del("X-Amz-Expires") + ctx.Query.Del("X-Amz-Credential") + ctx.Query.Del("X-Amz-SignedHeaders") +} + +func makeHmac(key []byte, data []byte) []byte { + hash := hmac.New(sha256.New, key) + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256(data []byte) []byte { + hash := sha256.New() + hash.Write(data) + return hash.Sum(nil) +} + +func makeSha256Reader(reader io.ReadSeeker) []byte { + hash := sha256.New() + start, _ := reader.Seek(0, 1) + defer reader.Seek(start, 0) + + io.Copy(hash, reader) + return hash.Sum(nil) +} + +const doubleSpace = " " + +// stripExcessSpaces will rewrite the passed in slice's string values to not +// contain muliple side-by-side spaces. +func stripExcessSpaces(vals []string) { + var j, k, l, m, spaces int + for i, str := range vals { + // Trim trailing spaces + for j = len(str) - 1; j >= 0 && str[j] == ' '; j-- { + } + + // Trim leading spaces + for k = 0; k < j && str[k] == ' '; k++ { + } + str = str[k : j+1] + + // Strip multiple spaces. + j = strings.Index(str, doubleSpace) + if j < 0 { + vals[i] = str + continue + } + + buf := []byte(str) + for k, m, l = j, j, len(buf); k < l; k++ { + if buf[k] == ' ' { + if spaces == 0 { + // First space. + buf[m] = buf[k] + m++ + } + spaces++ + } else { + // End of multiple spaces. + spaces = 0 + buf[m] = buf[k] + m++ + } + } + + vals[i] = string(buf[:m]) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/static_provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/static_provider.go new file mode 100644 index 000000000000..0870016a2b1a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/static_provider.go @@ -0,0 +1,52 @@ +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// StaticCredentialsProviderName provides a name of Static provider +const StaticCredentialsProviderName = "StaticCredentialsProvider" + +var ( + // ErrStaticCredentialsEmpty is emitted when static credentials are empty. + ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) +) + +// A StaticCredentialsProvider is a set of credentials which are set programmatically, +// and will never expire. +type StaticCredentialsProvider struct { + Value Credentials +} + +// NewStaticCredentialsProvider return a StaticCredentialsProvider initialized with the AWS credentials +// passed in. +func NewStaticCredentialsProvider(key, secret, session string) StaticCredentialsProvider { + return StaticCredentialsProvider{ + Value: Credentials{ + AccessKeyID: key, + SecretAccessKey: secret, + SessionToken: session, + }, + } +} + +// Retrieve returns the credentials or error if the credentials are invalid. +func (s StaticCredentialsProvider) Retrieve() (Credentials, error) { + v := s.Value + if v.AccessKeyID == "" || v.SecretAccessKey == "" { + return Credentials{Source: StaticCredentialsProviderName}, ErrStaticCredentialsEmpty + } + + if len(v.Source) == 0 { + v.Source = StaticCredentialsProviderName + } + + return v, nil +} + +// IsExpired returns if the credentials are expired. +// +// For StaticCredentialsProvider, the credentials never expired. +func (s StaticCredentialsProvider) IsExpired() bool { + return false +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/stscreds/provider.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/stscreds/provider.go new file mode 100644 index 000000000000..549a2c1a0e4b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/stscreds/provider.go @@ -0,0 +1,264 @@ +/* +Package stscreds are credential Providers to retrieve STS AWS credentials. + +STS provides multiple ways to retrieve credentials which can be used when making +future AWS service API operation calls. + +The SDK will ensure that per instance of credentials.Credentials all requests +to refresh the credentials will be synchronized. But, the SDK is unable to +ensure synchronous usage of the AssumeRoleProvider if the value is shared +between multiple Credentials or service clients. + +Assume Role + +To assume an IAM role using STS with the SDK you can create a new Credentials +with the SDKs's stscreds package. + + // Initial credentials loaded from SDK's default credential chain. Such as + // the environment, shared credentials (~/.aws/credentials), or EC2 Instance + // Role. These credentials will be used to to make the STS Assume Role API. + cfg, err := external.LoadDefaultAWSConfig() + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. + stsSvc := sts.New(cfg) + stsCredProvider := stscreds.NewAssumeRoleProvider(stsSvc, "myRoleArn") + + cfg.Credentials = aws.NewCredentials(stsCredProvider) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(cfg) + +Assume Role with static MFA Token + +To assume an IAM role with a MFA token you can either specify a MFA token code +directly or provide a function to prompt the user each time the credentials +need to refresh the role's credentials. Specifying the TokenCode should be used +for short lived operations that will not need to be refreshed, and when you do +not want to have direct control over the user provides their MFA token. + +With TokenCode the AssumeRoleProvider will be not be able to refresh the role's +credentials. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN using the MFA token code provided. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenCode = aws.String("00000000") + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +Assume Role with MFA Token Provider + +To assume an IAM role with MFA for longer running tasks where the credentials +may need to be refreshed setting the TokenProvider field of AssumeRoleProvider +will allow the credential provider to prompt for new MFA token code when the +role's credentials need to be refreshed. + +The StdinTokenProvider function is available to prompt on stdin to retrieve +the MFA token code from the user. You can also implement custom prompts by +satisfing the TokenProvider function signature. + +Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +have undesirable results as the StdinTokenProvider will not be synchronized. A +single Credentials with an AssumeRoleProvider can be shared safely. + + // Create the credentials from AssumeRoleProvider to assume the role + // referenced by the "myRoleARN" ARN. Prompting for MFA token from stdin. + creds := stscreds.NewCredentials(sess, "myRoleArn", func(p *stscreds.AssumeRoleProvider) { + p.SerialNumber = aws.String("myTokenSerialNumber") + p.TokenProvider = stscreds.StdinTokenProvider + }) + + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +*/ +package stscreds + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/service/sts" +) + +// StdinTokenProvider will prompt on stdout and read from stdin for a string value. +// An error is returned if reading from stdin fails. +// +// Use this function go read MFA tokens from stdin. The function makes no attempt +// to make atomic prompts from stdin across multiple gorouties. +// +// Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will +// have undesirable results as the StdinTokenProvider will not be synchronized. A +// single Credentials with an AssumeRoleProvider can be shared safely +// +// Will wait forever until something is provided on the stdin. +func StdinTokenProvider() (string, error) { + var v string + fmt.Printf("Assume Role MFA token code: ") + _, err := fmt.Scanln(&v) + + return v, err +} + +// ProviderName provides a name of AssumeRole provider +const ProviderName = "AssumeRoleProvider" + +// AssumeRoler represents the minimal subset of the STS client API used by this provider. +type AssumeRoler interface { + AssumeRoleRequest(input *sts.AssumeRoleInput) sts.AssumeRoleRequest +} + +// DefaultDuration is the default amount of time in minutes that the credentials +// will be valid for. +var DefaultDuration = time.Duration(15) * time.Minute + +// AssumeRoleProvider retrieves temporary credentials from the STS service, and +// keeps track of their expiration time. +// +// This credential provider will be used by the SDKs default credential change +// when shared configuration is enabled, and the shared config or shared credentials +// file configure assume role. See Session docs for how to do this. +// +// AssumeRoleProvider does not provide any synchronization and it is not safe +// to share this value across multiple Credentials, Sessions, or service clients +// without also sharing the same Credentials instance. +type AssumeRoleProvider struct { + aws.SafeCredentialsProvider + + // STS client to make assume role request with. + Client AssumeRoler + + // Role to be assumed. + RoleARN string + + // Session name, if you wish to reuse the credentials elsewhere. + RoleSessionName string + + // Expiry duration of the STS credentials. Defaults to 15 minutes if not set. + Duration time.Duration + + // Optional ExternalID to pass along, defaults to nil if not set. + ExternalID *string + + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + Policy *string + + // The identification number of the MFA device that is associated with the user + // who is making the AssumeRole call. Specify this value if the trust policy + // of the role being assumed includes a condition that requires MFA authentication. + // The value is either the serial number for a hardware device (such as GAHT12345678) + // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). + SerialNumber *string + + // The value provided by the MFA device, if the trust policy of the role being + // assumed requires MFA (that is, if the policy includes a condition that tests + // for MFA). If the role being assumed requires MFA and if the TokenCode value + // is missing or expired, the AssumeRole call returns an "access denied" error. + // + // If SerialNumber is set and neither TokenCode nor TokenProvider are also + // set an error will be returned. + TokenCode *string + + // Async method of providing MFA token code for assuming an IAM role with MFA. + // The value returned by the function will be used as the TokenCode in the Retrieve + // call. See StdinTokenProvider for a provider that prompts and reads from stdin. + // + // This token provider will be called when ever the assumed role's + // credentials need to be refreshed when SerialNumber is also set and + // TokenCode is not set. + // + // If both TokenCode and TokenProvider is set, TokenProvider will be used and + // TokenCode is ignored. + TokenProvider func() (string, error) + + // ExpiryWindow will allow the credentials to trigger refreshing prior to + // the credentials actually expiring. This is beneficial so race conditions + // with expiring credentials do not cause request to fail unexpectedly + // due to ExpiredTokenException exceptions. + // + // So a ExpiryWindow of 10s would cause calls to IsExpired() to return true + // 10 seconds before the credentials are actually expired. + // + // If ExpiryWindow is 0 or less it will be ignored. + ExpiryWindow time.Duration +} + +// NewAssumeRoleProvider constructs and returns a credentials provider that +// will retrieve credentials by assuming a IAM role using STS. +func NewAssumeRoleProvider(client AssumeRoler, roleARN string) *AssumeRoleProvider { + p := &AssumeRoleProvider{ + Client: client, + RoleARN: roleARN, + } + p.RetrieveFn = p.retrieveFn + + return p +} + +// Retrieve generates a new set of temporary credentials using STS. +func (p *AssumeRoleProvider) retrieveFn() (aws.Credentials, error) { + // Apply defaults where parameters are not set. + if len(p.RoleSessionName) == 0 { + // Try to work out a role name that will hopefully end up unique. + p.RoleSessionName = fmt.Sprintf("%d", time.Now().UTC().UnixNano()) + } + if p.Duration == 0 { + // Expire as often as AWS permits. + p.Duration = DefaultDuration + } + input := &sts.AssumeRoleInput{ + DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), + RoleArn: aws.String(p.RoleARN), + RoleSessionName: aws.String(p.RoleSessionName), + ExternalId: p.ExternalID, + } + if p.Policy != nil { + input.Policy = p.Policy + } + if p.SerialNumber != nil { + if p.TokenCode != nil { + input.SerialNumber = p.SerialNumber + input.TokenCode = p.TokenCode + } else if p.TokenProvider != nil { + input.SerialNumber = p.SerialNumber + code, err := p.TokenProvider() + if err != nil { + return aws.Credentials{}, err + } + input.TokenCode = aws.String(code) + } else { + return aws.Credentials{}, + awserr.New("AssumeRoleTokenNotAvailable", + "assume role with MFA enabled, but neither TokenCode nor TokenProvider are set", nil) + } + } + + req := p.Client.AssumeRoleRequest(input) + resp, err := req.Send() + if err != nil { + return aws.Credentials{Source: ProviderName}, err + } + + return aws.Credentials{ + AccessKeyID: *resp.Credentials.AccessKeyId, + SecretAccessKey: *resp.Credentials.SecretAccessKey, + SessionToken: *resp.Credentials.SessionToken, + Source: ProviderName, + + CanExpire: true, + Expires: resp.Credentials.Expiration.Add(-p.ExpiryWindow), + }, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/timeout_read_closer.go new file mode 100644 index 000000000000..d8b5124ee5ac --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/timeout_read_closer.go @@ -0,0 +1,94 @@ +package aws + +import ( + "io" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +var timeoutErr = awserr.New( + ErrCodeResponseTimeout, + "read on body has reached the timeout limit", + nil, +) + +type readResult struct { + n int + err error +} + +// timeoutReadCloser will handle body reads that take too long. +// We will return a ErrReadTimeout error if a timeout occurs. +type timeoutReadCloser struct { + reader io.ReadCloser + duration time.Duration +} + +// Read will spin off a goroutine to call the reader's Read method. We will +// select on the timer's channel or the read's channel. Whoever completes first +// will be returned. +func (r *timeoutReadCloser) Read(b []byte) (int, error) { + timer := time.NewTimer(r.duration) + c := make(chan readResult, 1) + + go func() { + n, err := r.reader.Read(b) + timer.Stop() + c <- readResult{n: n, err: err} + }() + + select { + case data := <-c: + return data.n, data.err + case <-timer.C: + return 0, timeoutErr + } +} + +func (r *timeoutReadCloser) Close() error { + return r.reader.Close() +} + +const ( + // HandlerResponseTimeout is what we use to signify the name of the + // response timeout handler. + HandlerResponseTimeout = "ResponseTimeoutHandler" +) + +// adaptToResponseTimeoutError is a handler that will replace any top level error +// to a ErrCodeResponseTimeout, if its child is that. +func adaptToResponseTimeoutError(req *Request) { + if err, ok := req.Error.(awserr.Error); ok { + aerr, ok := err.OrigErr().(awserr.Error) + if ok && aerr.Code() == ErrCodeResponseTimeout { + req.Error = aerr + } + } +} + +// WithResponseReadTimeout is a request option that will wrap the body in a timeout read closer. +// This will allow for per read timeouts. If a timeout occurred, we will return the +// ErrCodeResponseTimeout. +// +// svc.PutObjectWithContext(ctx, params, request.WithTimeoutReadCloser(30 * time.Second) +func WithResponseReadTimeout(duration time.Duration) Option { + return func(r *Request) { + + var timeoutHandler = NamedHandler{ + HandlerResponseTimeout, + func(req *Request) { + req.HTTPResponse.Body = &timeoutReadCloser{ + reader: req.HTTPResponse.Body, + duration: duration, + } + }} + + // remove the handler so we are not stomping over any new durations. + r.Handlers.Send.RemoveByName(HandlerResponseTimeout) + r.Handlers.Send.PushBackNamed(timeoutHandler) + + r.Handlers.Unmarshal.PushBack(adaptToResponseTimeoutError) + r.Handlers.UnmarshalError.PushBack(adaptToResponseTimeoutError) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/types.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/types.go new file mode 100644 index 000000000000..0e2d864e10a8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/types.go @@ -0,0 +1,118 @@ +package aws + +import ( + "io" + "sync" +) + +// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should +// only be used with an io.Reader that is also an io.Seeker. Doing so may +// cause request signature errors, or request body's not sent for GET, HEAD +// and DELETE HTTP methods. +// +// Deprecated: Should only be used with io.ReadSeeker. If using for +// S3 PutObject to stream content use s3manager.Uploader instead. +func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { + return ReaderSeekerCloser{r} +} + +// ReaderSeekerCloser represents a reader that can also delegate io.Seeker and +// io.Closer interfaces to the underlying object if they are available. +type ReaderSeekerCloser struct { + r io.Reader +} + +// Read reads from the reader up to size of p. The number of bytes read, and +// error if it occurred will be returned. +// +// If the reader is not an io.Reader zero bytes read, and nil error will be returned. +// +// Performs the same functionality as io.Reader Read +func (r ReaderSeekerCloser) Read(p []byte) (int, error) { + switch t := r.r.(type) { + case io.Reader: + return t.Read(p) + } + return 0, nil +} + +// Seek sets the offset for the next Read to offset, interpreted according to +// whence: 0 means relative to the origin of the file, 1 means relative to the +// current offset, and 2 means relative to the end. Seek returns the new offset +// and an error, if any. +// +// If the ReaderSeekerCloser is not an io.Seeker nothing will be done. +func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { + switch t := r.r.(type) { + case io.Seeker: + return t.Seek(offset, whence) + } + return int64(0), nil +} + +// IsSeeker returns if the underlying reader is also a seeker. +func (r ReaderSeekerCloser) IsSeeker() bool { + _, ok := r.r.(io.Seeker) + return ok +} + +// Close closes the ReaderSeekerCloser. +// +// If the ReaderSeekerCloser is not an io.Closer nothing will be done. +func (r ReaderSeekerCloser) Close() error { + switch t := r.r.(type) { + case io.Closer: + return t.Close() + } + return nil +} + +// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface +// Can be used with the s3manager.Downloader to download content to a buffer +// in memory. Safe to use concurrently. +type WriteAtBuffer struct { + buf []byte + m sync.Mutex + + // GrowthCoeff defines the growth rate of the internal buffer. By + // default, the growth rate is 1, where expanding the internal + // buffer will allocate only enough capacity to fit the new expected + // length. + GrowthCoeff float64 +} + +// NewWriteAtBuffer creates a WriteAtBuffer with an internal buffer +// provided by buf. +func NewWriteAtBuffer(buf []byte) *WriteAtBuffer { + return &WriteAtBuffer{buf: buf} +} + +// WriteAt writes a slice of bytes to a buffer starting at the position provided +// The number of bytes written will be returned, or error. Can overwrite previous +// written slices if the write ats overlap. +func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) { + pLen := len(p) + expLen := pos + int64(pLen) + b.m.Lock() + defer b.m.Unlock() + if int64(len(b.buf)) < expLen { + if int64(cap(b.buf)) < expLen { + if b.GrowthCoeff < 1 { + b.GrowthCoeff = 1 + } + newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen))) + copy(newBuf, b.buf) + b.buf = newBuf + } + b.buf = b.buf[:expLen] + } + copy(b.buf[pos:], p) + return pLen, nil +} + +// Bytes returns a slice of bytes written to the buffer. +func (b *WriteAtBuffer) Bytes() []byte { + b.m.Lock() + defer b.m.Unlock() + return b.buf +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/url.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/url.go new file mode 100644 index 000000000000..6192b2455b63 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/url.go @@ -0,0 +1,12 @@ +// +build go1.8 + +package aws + +import "net/url" + +// URLHostname will extract the Hostname without port from the URL value. +// +// Wrapper of net/url#URL.Hostname for backwards Go version compatibility. +func URLHostname(url *url.URL) string { + return url.Hostname() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/url_1_7.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/url_1_7.go new file mode 100644 index 000000000000..0210d2720e77 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/url_1_7.go @@ -0,0 +1,29 @@ +// +build !go1.8 + +package aws + +import ( + "net/url" + "strings" +) + +// URLHostname will extract the Hostname without port from the URL value. +// +// Copy of Go 1.8's net/url#URL.Hostname functionality. +func URLHostname(url *url.URL) string { + return stripPort(url.Host) + +} + +// stripPort is copy of Go 1.8 url#URL.Hostname functionality. +// https://golang.org/src/net/url/url.go +func stripPort(hostport string) string { + colon := strings.IndexByte(hostport, ':') + if colon == -1 { + return hostport + } + if i := strings.IndexByte(hostport, ']'); i != -1 { + return strings.TrimPrefix(hostport[:i], "[") + } + return hostport[:colon] +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/validation.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/validation.go new file mode 100644 index 000000000000..6529ba65106f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/validation.go @@ -0,0 +1,234 @@ +package aws + +import ( + "bytes" + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +const ( + // InvalidParameterErrCode is the error code for invalid parameters errors + InvalidParameterErrCode = "InvalidParameter" + // ParamRequiredErrCode is the error code for required parameter errors + ParamRequiredErrCode = "ParamRequiredError" + // ParamMinValueErrCode is the error code for fields with too low of a + // number value. + ParamMinValueErrCode = "ParamMinValueError" + // ParamMinLenErrCode is the error code for fields without enough elements. + ParamMinLenErrCode = "ParamMinLenError" +) + +// Validator provides a way for types to perform validation logic on their +// input values that external code can use to determine if a type's values +// are valid. +type Validator interface { + Validate() error +} + +// An ErrInvalidParams provides wrapping of invalid parameter errors found when +// validating API operation input parameters. +type ErrInvalidParams struct { + // Context is the base context of the invalid parameter group. + Context string + errs []ErrInvalidParam +} + +// Add adds a new invalid parameter error to the collection of invalid +// parameters. The context of the invalid parameter will be updated to reflect +// this collection. +func (e *ErrInvalidParams) Add(err ErrInvalidParam) { + err.SetContext(e.Context) + e.errs = append(e.errs, err) +} + +// AddNested adds the invalid parameter errors from another ErrInvalidParams +// value into this collection. The nested errors will have their nested context +// updated and base context to reflect the merging. +// +// Use for nested validations errors. +func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams) { + for _, err := range nested.errs { + err.SetContext(e.Context) + err.AddNestedContext(nestedCtx) + e.errs = append(e.errs, err) + } +} + +// Len returns the number of invalid parameter errors +func (e ErrInvalidParams) Len() int { + return len(e.errs) +} + +// Code returns the code of the error +func (e ErrInvalidParams) Code() string { + return InvalidParameterErrCode +} + +// Message returns the message of the error +func (e ErrInvalidParams) Message() string { + return fmt.Sprintf("%d validation error(s) found.", len(e.errs)) +} + +// Error returns the string formatted form of the invalid parameters. +func (e ErrInvalidParams) Error() string { + w := &bytes.Buffer{} + fmt.Fprintf(w, "%s: %s\n", e.Code(), e.Message()) + + for _, err := range e.errs { + fmt.Fprintf(w, "- %s\n", err.Message()) + } + + return w.String() +} + +// OrigErr returns the invalid parameters as a awserr.BatchedErrors value +func (e ErrInvalidParams) OrigErr() error { + return awserr.NewBatchError( + InvalidParameterErrCode, e.Message(), e.OrigErrs()) +} + +// OrigErrs returns a slice of the invalid parameters +func (e ErrInvalidParams) OrigErrs() []error { + errs := make([]error, len(e.errs)) + for i := 0; i < len(errs); i++ { + errs[i] = e.errs[i] + } + + return errs +} + +// An ErrInvalidParam represents an invalid parameter error type. +type ErrInvalidParam interface { + awserr.Error + + // Field name the error occurred on. + Field() string + + // SetContext updates the context of the error. + SetContext(string) + + // AddNestedContext updates the error's context to include a nested level. + AddNestedContext(string) +} + +type errInvalidParam struct { + context string + nestedContext string + field string + code string + msg string +} + +// Code returns the error code for the type of invalid parameter. +func (e *errInvalidParam) Code() string { + return e.code +} + +// Message returns the reason the parameter was invalid, and its context. +func (e *errInvalidParam) Message() string { + return fmt.Sprintf("%s, %s.", e.msg, e.Field()) +} + +// Error returns the string version of the invalid parameter error. +func (e *errInvalidParam) Error() string { + return fmt.Sprintf("%s: %s", e.code, e.Message()) +} + +// OrigErr returns nil, Implemented for awserr.Error interface. +func (e *errInvalidParam) OrigErr() error { + return nil +} + +// Field Returns the field and context the error occurred. +func (e *errInvalidParam) Field() string { + field := e.context + if len(field) > 0 { + field += "." + } + if len(e.nestedContext) > 0 { + field += fmt.Sprintf("%s.", e.nestedContext) + } + field += e.field + + return field +} + +// SetContext updates the base context of the error. +func (e *errInvalidParam) SetContext(ctx string) { + e.context = ctx +} + +// AddNestedContext prepends a context to the field's path. +func (e *errInvalidParam) AddNestedContext(ctx string) { + if len(e.nestedContext) == 0 { + e.nestedContext = ctx + } else { + e.nestedContext = fmt.Sprintf("%s.%s", ctx, e.nestedContext) + } + +} + +// An ErrParamRequired represents an required parameter error. +type ErrParamRequired struct { + errInvalidParam +} + +// NewErrParamRequired creates a new required parameter error. +func NewErrParamRequired(field string) *ErrParamRequired { + return &ErrParamRequired{ + errInvalidParam{ + code: ParamRequiredErrCode, + field: field, + msg: fmt.Sprintf("missing required field"), + }, + } +} + +// An ErrParamMinValue represents a minimum value parameter error. +type ErrParamMinValue struct { + errInvalidParam + min float64 +} + +// NewErrParamMinValue creates a new minimum value parameter error. +func NewErrParamMinValue(field string, min float64) *ErrParamMinValue { + return &ErrParamMinValue{ + errInvalidParam: errInvalidParam{ + code: ParamMinValueErrCode, + field: field, + msg: fmt.Sprintf("minimum field value of %v", min), + }, + min: min, + } +} + +// MinValue returns the field's require minimum value. +// +// float64 is returned for both int and float min values. +func (e *ErrParamMinValue) MinValue() float64 { + return e.min +} + +// An ErrParamMinLen represents a minimum length parameter error. +type ErrParamMinLen struct { + errInvalidParam + min int +} + +// NewErrParamMinLen creates a new minimum length parameter error. +func NewErrParamMinLen(field string, min int) *ErrParamMinLen { + return &ErrParamMinLen{ + errInvalidParam: errInvalidParam{ + code: ParamMinLenErrCode, + field: field, + msg: fmt.Sprintf("minimum field size of %v", min), + }, + min: min, + } +} + +// MinLen returns the field's required minimum length. +func (e *ErrParamMinLen) MinLen() int { + return e.min +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/version.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/version.go new file mode 100644 index 000000000000..1b3347637130 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/version.go @@ -0,0 +1,8 @@ +// Package aws provides core functionality for making requests to AWS services. +package aws + +// SDKName is the name of this AWS SDK +const SDKName = "aws-sdk-go" + +// SDKVersion is the version of this SDK +const SDKVersion = "2.0.0-preview.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/waiter.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/waiter.go new file mode 100644 index 000000000000..6e3f7e7b7268 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/waiter.go @@ -0,0 +1,284 @@ +package aws + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" + "github.com/aws/aws-sdk-go-v2/internal/sdk" +) + +// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when +// the waiter's max attempts have been exhausted. +const WaiterResourceNotReadyErrorCode = "ResourceNotReady" + +// A WaiterOption is a function that will update the Waiter value's fields to +// configure the waiter. +type WaiterOption func(*Waiter) + +// WithWaiterMaxAttempts returns the maximum number of times the waiter should +// attempt to check the resource for the target state. +func WithWaiterMaxAttempts(max int) WaiterOption { + return func(w *Waiter) { + w.MaxAttempts = max + } +} + +// WaiterDelay will return a delay the waiter should pause between attempts to +// check the resource state. The passed in attempt is the number of times the +// Waiter has checked the resource state. +// +// Attempt is the number of attempts the Waiter has made checking the resource +// state. +type WaiterDelay func(attempt int) time.Duration + +// ConstantWaiterDelay returns a WaiterDelay that will always return a constant +// delay the waiter should use between attempts. It ignores the number of +// attempts made. +func ConstantWaiterDelay(delay time.Duration) WaiterDelay { + return func(attempt int) time.Duration { + return delay + } +} + +// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in. +func WithWaiterDelay(delayer WaiterDelay) WaiterOption { + return func(w *Waiter) { + w.Delay = delayer + } +} + +// WithWaiterLogger returns a waiter option to set the logger a waiter +// should use to log warnings and errors to. +func WithWaiterLogger(logger Logger) WaiterOption { + return func(w *Waiter) { + w.Logger = logger + } +} + +// WithWaiterRequestOptions returns a waiter option setting the request +// options for each request the waiter makes. Appends to waiter's request +// options already set. +func WithWaiterRequestOptions(opts ...Option) WaiterOption { + return func(w *Waiter) { + w.RequestOptions = append(w.RequestOptions, opts...) + } +} + +// A Waiter provides the functionality to perform a blocking call which will +// wait for a resource state to be satisfied by a service. +// +// This type should not be used directly. The API operations provided in the +// service packages prefixed with "WaitUntil" should be used instead. +type Waiter struct { + Name string + Acceptors []WaiterAcceptor + Logger Logger + + MaxAttempts int + Delay WaiterDelay + + RequestOptions []Option + NewRequest func([]Option) (*Request, error) + SleepWithContext func(Context, time.Duration) error +} + +// ApplyOptions updates the waiter with the list of waiter options provided. +func (w *Waiter) ApplyOptions(opts ...WaiterOption) { + for _, fn := range opts { + fn(w) + } +} + +// WaiterState are states the waiter uses based on WaiterAcceptor definitions +// to identify if the resource state the waiter is waiting on has occurred. +type WaiterState int + +// String returns the string representation of the waiter state. +func (s WaiterState) String() string { + switch s { + case SuccessWaiterState: + return "success" + case FailureWaiterState: + return "failure" + case RetryWaiterState: + return "retry" + default: + return "unknown waiter state" + } +} + +// States the waiter acceptors will use to identify target resource states. +const ( + SuccessWaiterState WaiterState = iota // waiter successful + FailureWaiterState // waiter failed + RetryWaiterState // waiter needs to be retried +) + +// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor +// definition's Expected attribute. +type WaiterMatchMode int + +// Modes the waiter will use when inspecting API response to identify target +// resource states. +const ( + PathAllWaiterMatch WaiterMatchMode = iota // match on all paths + PathWaiterMatch // match on specific path + PathAnyWaiterMatch // match on any path + PathListWaiterMatch // match on list of paths + StatusWaiterMatch // match on status code + ErrorWaiterMatch // match on error +) + +// String returns the string representation of the waiter match mode. +func (m WaiterMatchMode) String() string { + switch m { + case PathAllWaiterMatch: + return "pathAll" + case PathWaiterMatch: + return "path" + case PathAnyWaiterMatch: + return "pathAny" + case PathListWaiterMatch: + return "pathList" + case StatusWaiterMatch: + return "status" + case ErrorWaiterMatch: + return "error" + default: + return "unknown waiter match mode" + } +} + +// WaitWithContext will make requests for the API operation using NewRequest to +// build API requests. The request's response will be compared against the +// Waiter's Acceptors to determine the successful state of the resource the +// waiter is inspecting. +// +// The passed in context must not be nil. If it is nil a panic will occur. The +// Context will be used to cancel the waiter's pending requests and retry delays. +// Use BackgroundContext if no context is available. +// +// The waiter will continue until the target state defined by the Acceptors, +// or the max attempts expires. +// +// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's +// retryer ShouldRetry returns false. This normally will happen when the max +// wait attempts expires. +func (w Waiter) WaitWithContext(ctx Context) error { + + for attempt := 1; ; attempt++ { + req, err := w.NewRequest(w.RequestOptions) + if err != nil { + waiterLogf(w.Logger, "unable to create request %v", err) + return err + } + req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter")) + err = req.Send() + + // See if any of the acceptors match the request's response, or error + for _, a := range w.Acceptors { + if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched { + return matchErr + } + } + + // The Waiter should only check the resource state MaxAttempts times + // This is here instead of in the for loop above to prevent delaying + // unnecessary when the waiter will not retry. + if attempt == w.MaxAttempts { + break + } + + // Delay to wait before inspecting the resource again + if err := sdk.SleepWithContext(ctx, w.Delay(attempt)); err != nil { + return awserr.New(ErrCodeRequestCanceled, "waiter context canceled", err) + } + } + + return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil) +} + +// A WaiterAcceptor provides the information needed to wait for an API operation +// to complete. +type WaiterAcceptor struct { + State WaiterState + Matcher WaiterMatchMode + Argument string + Expected interface{} +} + +// match returns if the acceptor found a match with the passed in request +// or error. True is returned if the acceptor made a match, error is returned +// if there was an error attempting to perform the match. +func (a *WaiterAcceptor) match(name string, l Logger, req *Request, err error) (bool, error) { + result := false + var vals []interface{} + + switch a.Matcher { + case PathAllWaiterMatch, PathWaiterMatch: + // Require all matches to be equal for result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + if len(vals) == 0 { + break + } + result = true + for _, val := range vals { + if !awsutil.DeepEqual(val, a.Expected) { + result = false + break + } + } + case PathAnyWaiterMatch: + // Only a single match needs to equal for the result to match + vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument) + for _, val := range vals { + if awsutil.DeepEqual(val, a.Expected) { + result = true + break + } + } + case PathListWaiterMatch: + // ignored matcher + case StatusWaiterMatch: + s := a.Expected.(int) + result = s == req.HTTPResponse.StatusCode + case ErrorWaiterMatch: + if aerr, ok := err.(awserr.Error); ok { + result = aerr.Code() == a.Expected.(string) + } + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s", + name, a.Matcher) + } + + if !result { + // If there was no matching result found there is nothing more to do + // for this response, retry the request. + return false, nil + } + + switch a.State { + case SuccessWaiterState: + // waiter completed + return true, nil + case FailureWaiterState: + // Waiter failure state triggered + return true, awserr.New(WaiterResourceNotReadyErrorCode, + "failed waiting for successful resource state", err) + case RetryWaiterState: + // clear the error and retry the operation + return false, nil + default: + waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s", + name, a.State) + return false, nil + } +} + +func waiterLogf(logger Logger, msg string, args ...interface{}) { + if logger != nil { + logger.Log(fmt.Sprintf(msg, args...)) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/buildspec.yml b/vendor/github.com/aws/aws-sdk-go-v2/buildspec.yml new file mode 100644 index 000000000000..d0b43faf5037 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/buildspec.yml @@ -0,0 +1,19 @@ +version: 0.2 + +phases: + build: + commands: + - echo Build started on `date` + - export GOPATH=/go + - export SDK_CB_ROOT=`pwd` + - export SDK_GO_ROOT=/go/src/github.com/aws/aws-sdk-go-v2 + - mkdir -p /go/src/github.com/aws + - ln -s $SDK_CB_ROOT $SDK_GO_ROOT + - cd $SDK_GO_ROOT + - go get -u github.com/golang/dep/cmd/dep + - dep ensure + - make unit + - cd $SDK_CB_ROOT + post_build: + commands: + - echo Build completed on `date` diff --git a/vendor/github.com/aws/aws-sdk-go-v2/cleanup_models.sh b/vendor/github.com/aws/aws-sdk-go-v2/cleanup_models.sh new file mode 100755 index 000000000000..72e239a66b2d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/cleanup_models.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Deletes all but the most current model version. +for v in $(ls ./models/apis | grep -v '.go' ); do + for vm in $(ls -r models/apis/$v/ | sed -n '1!p' ); do + echo "rm -r models/apis/$v/$vm" + rm -r models/apis/$v/$vm + done +done diff --git a/vendor/github.com/aws/aws-sdk-go-v2/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/doc.go new file mode 100644 index 000000000000..8f1ff3aabd7e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/doc.go @@ -0,0 +1,65 @@ +/* +Package sdk is the official AWS SDK v2 for the Go programming language. + +aws-sdk-go-v2 is the Developer Preview for the v2 of the AWS SDK for the Go +programming language. Look for additional documentation and examples to be +added. + +Getting started + +The best way to get started working with the SDK is to use `go get` to add the +SDK to your Go Workspace manually. + + go get github.com/aws/aws-sdk-go-v2 + +You could also use [Dep] to add the SDK to your application's dependencies. +Using [Dep] will simplify your update story and help your application keep +pinned to specific version of the SDK + + dep ensure --add github.com/aws/aws-sdk-go-v2 + +### Hello AWS + +This example shows how you can use the v2 SDK to make an API request using the +SDK's Amazon DynamoDB client. + + package main + + import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/endpoints" + "github.com/aws/aws-sdk-go-v2/aws/external" + "github.com/aws/aws-sdk-go-v2/service/dynamodb" + ) + + func main() { + // Using the SDK's default configuration, loading additional config + // and credentials values from the environment variables, shared + // credentials, and shared configuration files + cfg, err := external.LoadDefaultAWSConfig() + if err != nil { + panic("unable to load SDK config, " + err.Error()) + } + + // Set the AWS Region that the service clients should use + cfg.Region = endpoints.UsWest2RegionID + + // Using the Config value, create the DynamoDB client + svc := dynamodb.New(cfg) + + // Build the request with its input parameters + req := svc.DescribeTableRequest(&dynamodb.DescribeTableInput{ + TableName: aws.String("myTable"), + }) + + // Send the request, and get the response or error back + resp, err := req.Send() + if err != nil { + panic("failed to describe table, "+err.Error()) + } + + fmt.Println("Response", resp) + } + +*/ +package sdk diff --git a/vendor/github.com/aws/aws-sdk-go-v2/go.mod b/vendor/github.com/aws/aws-sdk-go-v2/go.mod new file mode 100644 index 000000000000..3eaede21f47e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/go.mod @@ -0,0 +1,23 @@ +module github.com/aws/aws-sdk-go-v2 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-ini/ini v1.25.4 + github.com/go-sql-driver/mysql v1.4.0 + github.com/golang/lint v0.0.0-20180702182130-06c8688daad7 // indirect + github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c // indirect + github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2 + github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 + github.com/jtolds/gls v4.2.1+incompatible // indirect + github.com/pkg/errors v0.8.0 + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect + github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect + github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect + github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/testify v1.2.2 + golang.org/x/lint v0.0.0-20180702182130-06c8688daad7 // indirect + golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3 + golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e // indirect + google.golang.org/appengine v1.2.0 // indirect +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/go.sum b/vendor/github.com/aws/aws-sdk-go-v2/go.sum new file mode 100644 index 000000000000..532abfdf2a6d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/go.sum @@ -0,0 +1,37 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-ini/ini v1.25.4 h1:Mujh4R/dH6YL8bxuISne3xX2+qcQ9p0IxKAP6ExWoUo= +github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= +github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2 h1:iR8wSrr/JCzL1Ul+dRVxtIOnP8DGg/m02nHZJ9PH6P0= +github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2/go.mod h1:YbdHRK9ViqwGMS0rtRY+1I6faHvVyyurKPIPwifihxI= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= +github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co= +github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo= +github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3 h1:czFLhve3vsQetD6JOJ8NZZvGQIXlnN3/yXxbT6/awxI= +golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.2.0 h1:S0iUepdCWODXRvtE+gcRDd15L+k+k1AiHlMiMjefH24= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/copy.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/copy.go new file mode 100644 index 000000000000..938cd14c1e4c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/copy.go @@ -0,0 +1,112 @@ +package awsutil + +import ( + "io" + "reflect" + "time" +) + +// Copy deeply copies a src structure to dst. Useful for copying request and +// response structures. +// +// Can copy between structs of different type, but will only copy fields which +// are assignable, and exist in both structs. Fields which are not assignable, +// or do not exist in both structs are ignored. +func Copy(dst, src interface{}) { + dstval := reflect.ValueOf(dst) + if !dstval.IsValid() { + panic("Copy dst cannot be nil") + } + + rcopy(dstval, reflect.ValueOf(src), true) +} + +// CopyOf returns a copy of src while also allocating the memory for dst. +// src must be a pointer type or this operation will fail. +func CopyOf(src interface{}) (dst interface{}) { + dsti := reflect.New(reflect.TypeOf(src).Elem()) + dst = dsti.Interface() + rcopy(dsti, reflect.ValueOf(src), true) + return +} + +// rcopy performs a recursive copy of values from the source to destination. +// +// root is used to skip certain aspects of the copy which are not valid +// for the root node of a object. +func rcopy(dst, src reflect.Value, root bool) { + if !src.IsValid() { + return + } + + switch src.Kind() { + case reflect.Ptr: + if _, ok := src.Interface().(io.Reader); ok { + if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { + dst.Elem().Set(src) + } else if dst.CanSet() { + dst.Set(src) + } + } else { + e := src.Type().Elem() + if dst.CanSet() && !src.IsNil() { + if _, ok := src.Interface().(*time.Time); !ok { + if dst.Kind() == reflect.String { + dst.SetString(e.String()) + } else { + dst.Set(reflect.New(e)) + } + } else { + tempValue := reflect.New(e) + tempValue.Elem().Set(src.Elem()) + // Sets time.Time's unexported values + dst.Set(tempValue) + } + } + if dst.Kind() != reflect.String && src.Elem().IsValid() { + // Keep the current root state since the depth hasn't changed + rcopy(dst.Elem(), src.Elem(), root) + } + } + case reflect.Struct: + t := dst.Type() + for i := 0; i < t.NumField(); i++ { + name := t.Field(i).Name + srcVal := src.FieldByName(name) + dstVal := dst.FieldByName(name) + if srcVal.IsValid() && dstVal.CanSet() { + rcopy(dstVal, srcVal, false) + } + } + case reflect.Slice: + if src.IsNil() { + break + } + + s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) + dst.Set(s) + for i := 0; i < src.Len(); i++ { + rcopy(dst.Index(i), src.Index(i), false) + } + case reflect.Map: + if src.IsNil() { + break + } + + s := reflect.MakeMap(src.Type()) + dst.Set(s) + for _, k := range src.MapKeys() { + v := src.MapIndex(k) + v2 := reflect.New(v.Type()).Elem() + rcopy(v2, v, false) + dst.SetMapIndex(k, v2) + } + default: + // Assign the value if possible. If its not assignable, the value would + // need to be converted and the impact of that may be unexpected, or is + // not compatible with the dst type. + if src.Type().AssignableTo(dst.Type()) { + dst.Set(src) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go new file mode 100644 index 000000000000..bcfe51a2b7ee --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/equal.go @@ -0,0 +1,33 @@ +package awsutil + +import ( + "reflect" +) + +// DeepEqual returns if the two values are deeply equal like reflect.DeepEqual. +// In addition to this, this method will also dereference the input values if +// possible so the DeepEqual performed will not fail if one parameter is a +// pointer and the other is not. +// +// DeepEqual will not perform indirection of nested values of the input parameters. +func DeepEqual(a, b interface{}) bool { + ra := reflect.Indirect(reflect.ValueOf(a)) + rb := reflect.Indirect(reflect.ValueOf(b)) + + if raValid, rbValid := ra.IsValid(), rb.IsValid(); !raValid && !rbValid { + // If the elements are both nil, and of the same type the are equal + // If they are of different types they are not equal + return reflect.TypeOf(a) == reflect.TypeOf(b) + } else if raValid != rbValid { + // Both values must be valid to be equal + return false + } + + // Special casing for strings as typed enumerations are string aliases + // but are not deep equal. + if ra.Kind() == reflect.String && rb.Kind() == reflect.String { + return ra.String() == rb.String() + } + + return reflect.DeepEqual(ra.Interface(), rb.Interface()) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/path_value.go new file mode 100644 index 000000000000..7e69bd5eb756 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/path_value.go @@ -0,0 +1,225 @@ +package awsutil + +import ( + "reflect" + "regexp" + "strconv" + "strings" + + "github.com/jmespath/go-jmespath" +) + +var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) + +// rValuesAtPath returns a slice of values found in value v. The values +// in v are explored recursively so all nested values are collected. +func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTerm bool) []reflect.Value { + pathparts := strings.Split(path, "||") + if len(pathparts) > 1 { + for _, pathpart := range pathparts { + vals := rValuesAtPath(v, pathpart, createPath, caseSensitive, nilTerm) + if len(vals) > 0 { + return vals + } + } + return nil + } + + values := []reflect.Value{reflect.Indirect(reflect.ValueOf(v))} + components := strings.Split(path, ".") + for len(values) > 0 && len(components) > 0 { + var index *int64 + var indexStar bool + c := strings.TrimSpace(components[0]) + if c == "" { // no actual component, illegal syntax + return nil + } else if caseSensitive && c != "*" && strings.ToLower(c[0:1]) == c[0:1] { + // TODO normalize case for user + return nil // don't support unexported fields + } + + // parse this component + if m := indexRe.FindStringSubmatch(c); m != nil { + c = m[1] + if m[2] == "" { + index = nil + indexStar = true + } else { + i, _ := strconv.ParseInt(m[2], 10, 32) + index = &i + indexStar = false + } + } + + nextvals := []reflect.Value{} + for _, value := range values { + // pull component name out of struct member + if value.Kind() != reflect.Struct { + continue + } + + if c == "*" { // pull all members + for i := 0; i < value.NumField(); i++ { + if f := reflect.Indirect(value.Field(i)); f.IsValid() { + nextvals = append(nextvals, f) + } + } + continue + } + + value = value.FieldByNameFunc(func(name string) bool { + if c == name { + return true + } else if !caseSensitive && strings.ToLower(name) == strings.ToLower(c) { + return true + } + return false + }) + + if nilTerm && value.Kind() == reflect.Ptr && len(components[1:]) == 0 { + if !value.IsNil() { + value.Set(reflect.Zero(value.Type())) + } + return []reflect.Value{value} + } + + if createPath && value.Kind() == reflect.Ptr && value.IsNil() { + // TODO if the value is the terminus it should not be created + // if the value to be set to its position is nil. + value.Set(reflect.New(value.Type().Elem())) + value = value.Elem() + } else { + value = reflect.Indirect(value) + } + + if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { + if !createPath && value.IsNil() { + value = reflect.ValueOf(nil) + } + } + + if value.IsValid() { + nextvals = append(nextvals, value) + } + } + values = nextvals + + if indexStar || index != nil { + nextvals = []reflect.Value{} + for _, valItem := range values { + value := reflect.Indirect(valItem) + if value.Kind() != reflect.Slice { + continue + } + + if indexStar { // grab all indices + for i := 0; i < value.Len(); i++ { + idx := reflect.Indirect(value.Index(i)) + if idx.IsValid() { + nextvals = append(nextvals, idx) + } + } + continue + } + + // pull out index + i := int(*index) + if i >= value.Len() { // check out of bounds + if createPath { + // TODO resize slice + } else { + continue + } + } else if i < 0 { // support negative indexing + i = value.Len() + i + } + value = reflect.Indirect(value.Index(i)) + + if value.Kind() == reflect.Slice || value.Kind() == reflect.Map { + if !createPath && value.IsNil() { + value = reflect.ValueOf(nil) + } + } + + if value.IsValid() { + nextvals = append(nextvals, value) + } + } + values = nextvals + } + + components = components[1:] + } + return values +} + +// ValuesAtPath returns a list of values at the case insensitive lexical +// path inside of a structure. +func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { + result, err := jmespath.Search(path, i) + if err != nil { + return nil, err + } + + v := reflect.ValueOf(result) + if !v.IsValid() || (v.Kind() == reflect.Ptr && v.IsNil()) { + return nil, nil + } + if s, ok := result.([]interface{}); ok { + return s, err + } + if v.Kind() == reflect.Map && v.Len() == 0 { + return nil, nil + } + if v.Kind() == reflect.Slice { + out := make([]interface{}, v.Len()) + for i := 0; i < v.Len(); i++ { + out[i] = v.Index(i).Interface() + } + return out, nil + } + + return []interface{}{result}, nil +} + +// SetValueAtPath sets a value at the case insensitive lexical path inside +// of a structure. +func SetValueAtPath(i interface{}, path string, v interface{}) { + if rvals := rValuesAtPath(i, path, true, false, v == nil); rvals != nil { + for _, rval := range rvals { + if rval.Kind() == reflect.Ptr && rval.IsNil() { + continue + } + setValue(rval, v) + } + } +} + +func setValue(dstVal reflect.Value, src interface{}) { + if dstVal.Kind() == reflect.Ptr { + dstVal = reflect.Indirect(dstVal) + } + srcVal := reflect.ValueOf(src) + + if !srcVal.IsValid() { // src is literal nil + if dstVal.CanAddr() { + // Convert to pointer so that pointer's value can be nil'ed + // dstVal = dstVal.Addr() + } + dstVal.Set(reflect.Zero(dstVal.Type())) + + } else if srcVal.Kind() == reflect.Ptr { + if srcVal.IsNil() { + srcVal = reflect.Zero(dstVal.Type()) + } else { + srcVal = reflect.ValueOf(src).Elem() + } + dstVal.Set(srcVal) + } else { + if dstVal.Kind() == reflect.String { + dstVal.SetString(srcVal.String()) + } else { + dstVal.Set(srcVal) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/prettify.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/prettify.go new file mode 100644 index 000000000000..710eb432f851 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/prettify.go @@ -0,0 +1,113 @@ +package awsutil + +import ( + "bytes" + "fmt" + "io" + "reflect" + "strings" +) + +// Prettify returns the string representation of a value. +func Prettify(i interface{}) string { + var buf bytes.Buffer + prettify(reflect.ValueOf(i), 0, &buf) + return buf.String() +} + +// prettify will recursively walk value v to build a textual +// representation of the value. +func prettify(v reflect.Value, indent int, buf *bytes.Buffer) { + for v.Kind() == reflect.Ptr { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Struct: + strtype := v.Type().String() + if strtype == "time.Time" { + fmt.Fprintf(buf, "%s", v.Interface()) + break + } else if strings.HasPrefix(strtype, "io.") { + buf.WriteString("") + break + } + + buf.WriteString("{\n") + + names := []string{} + for i := 0; i < v.Type().NumField(); i++ { + name := v.Type().Field(i).Name + f := v.Field(i) + if name[0:1] == strings.ToLower(name[0:1]) { + continue // ignore unexported fields + } + if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice || f.Kind() == reflect.Map) && f.IsNil() { + continue // ignore unset fields + } + names = append(names, name) + } + + for i, n := range names { + val := v.FieldByName(n) + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(n + ": ") + prettify(val, indent+2, buf) + + if i < len(names)-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + case reflect.Slice: + strtype := v.Type().String() + if strtype == "[]uint8" { + fmt.Fprintf(buf, " len %d", v.Len()) + break + } + + nl, id, id2 := "", "", "" + if v.Len() > 3 { + nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) + } + buf.WriteString("[" + nl) + for i := 0; i < v.Len(); i++ { + buf.WriteString(id2) + prettify(v.Index(i), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString("," + nl) + } + } + + buf.WriteString(nl + id + "]") + case reflect.Map: + buf.WriteString("{\n") + + for i, k := range v.MapKeys() { + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(k.String() + ": ") + prettify(v.MapIndex(k), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + default: + if !v.IsValid() { + fmt.Fprint(buf, "") + return + } + format := "%v" + switch v.Interface().(type) { + case string: + format = "%q" + case io.ReadSeeker, io.Reader: + format = "buffer(%p)" + } + fmt.Fprintf(buf, format, v.Interface()) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/string_value.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/string_value.go new file mode 100644 index 000000000000..b6432f1a1188 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/awsutil/string_value.go @@ -0,0 +1,89 @@ +package awsutil + +import ( + "bytes" + "fmt" + "reflect" + "strings" +) + +// StringValue returns the string representation of a value. +func StringValue(i interface{}) string { + var buf bytes.Buffer + stringValue(reflect.ValueOf(i), 0, &buf) + return buf.String() +} + +func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { + for v.Kind() == reflect.Ptr { + v = v.Elem() + } + + switch v.Kind() { + case reflect.Struct: + buf.WriteString("{\n") + + names := []string{} + for i := 0; i < v.Type().NumField(); i++ { + name := v.Type().Field(i).Name + f := v.Field(i) + if name[0:1] == strings.ToLower(name[0:1]) { + continue // ignore unexported fields + } + if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { + continue // ignore unset fields + } + names = append(names, name) + } + + for i, n := range names { + val := v.FieldByName(n) + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(n + ": ") + stringValue(val, indent+2, buf) + + if i < len(names)-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + case reflect.Slice: + nl, id, id2 := "", "", "" + if v.Len() > 3 { + nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) + } + buf.WriteString("[" + nl) + for i := 0; i < v.Len(); i++ { + buf.WriteString(id2) + stringValue(v.Index(i), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString("," + nl) + } + } + + buf.WriteString(nl + id + "]") + case reflect.Map: + buf.WriteString("{\n") + + for i, k := range v.MapKeys() { + buf.WriteString(strings.Repeat(" ", indent+2)) + buf.WriteString(k.String() + ": ") + stringValue(v.MapIndex(k), indent+2, buf) + + if i < v.Len()-1 { + buf.WriteString(",\n") + } + } + + buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") + default: + format := "%v" + switch v.Interface().(type) { + case string: + format = "%q" + } + fmt.Fprintf(buf, format, v.Interface()) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ast.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ast.go new file mode 100644 index 000000000000..e83a99886bcc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ast.go @@ -0,0 +1,120 @@ +package ini + +// ASTKind represents different states in the parse table +// and the type of AST that is being constructed +type ASTKind int + +// ASTKind* is used in the parse table to transition between +// the different states +const ( + ASTKindNone = ASTKind(iota) + ASTKindStart + ASTKindExpr + ASTKindEqualExpr + ASTKindStatement + ASTKindSkipStatement + ASTKindExprStatement + ASTKindSectionStatement + ASTKindNestedSectionStatement + ASTKindCompletedNestedSectionStatement + ASTKindCommentStatement + ASTKindCompletedSectionStatement +) + +func (k ASTKind) String() string { + switch k { + case ASTKindNone: + return "none" + case ASTKindStart: + return "start" + case ASTKindExpr: + return "expr" + case ASTKindStatement: + return "stmt" + case ASTKindSectionStatement: + return "section_stmt" + case ASTKindExprStatement: + return "expr_stmt" + case ASTKindCommentStatement: + return "comment" + case ASTKindNestedSectionStatement: + return "nested_section_stmt" + case ASTKindCompletedSectionStatement: + return "completed_stmt" + case ASTKindSkipStatement: + return "skip" + default: + return "" + } +} + +// AST interface allows us to determine what kind of node we +// are on and casting may not need to be necessary. +// +// The root is always the first node in Children +type AST struct { + Kind ASTKind + Root Token + RootToken bool + Children []AST +} + +func newAST(kind ASTKind, root AST, children ...AST) AST { + return AST{ + Kind: kind, + Children: append([]AST{root}, children...), + } +} + +func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST { + return AST{ + Kind: kind, + Root: root, + RootToken: true, + Children: children, + } +} + +// AppendChild will append to the list of children an AST has. +func (a *AST) AppendChild(child AST) { + a.Children = append(a.Children, child) +} + +// GetRoot will return the root AST which can be the first entry +// in the children list or a token. +func (a *AST) GetRoot() AST { + if a.RootToken { + return *a + } + + if len(a.Children) == 0 { + return AST{} + } + + return a.Children[0] +} + +// GetChildren will return the current AST's list of children +func (a *AST) GetChildren() []AST { + if len(a.Children) == 0 { + return []AST{} + } + + if a.RootToken { + return a.Children + } + + return a.Children[1:] +} + +// SetChildren will set and override all children of the AST. +func (a *AST) SetChildren(children []AST) { + if a.RootToken { + a.Children = children + } else { + a.Children = append(a.Children[:1], children...) + } +} + +// Start is used to indicate the starting state of the parse table. +var Start = newAST(ASTKindStart, AST{}) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comma_token.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comma_token.go new file mode 100644 index 000000000000..0895d53cbe65 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comma_token.go @@ -0,0 +1,11 @@ +package ini + +var commaRunes = []rune(",") + +func isComma(b rune) bool { + return b == ',' +} + +func newCommaToken() Token { + return newToken(TokenComma, commaRunes, NoneType) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comment_token.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comment_token.go new file mode 100644 index 000000000000..8d03fd3d3e1d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/comment_token.go @@ -0,0 +1,39 @@ +package ini + +// isComment will return whether or not the next byte(s) is a +// comment. +func isComment(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case ';': + return true + case '#': + return true + case '/': + if len(b) > 1 { + return b[1] == '/' + } + } + + return false +} + +// newCommentToken will create a comment token and +// return how many bytes were read. +func newCommentToken(b []rune) (Token, int, error) { + i := 0 + for ; i < len(b); i++ { + if b[i] == '\n' { + break + } + + if len(b)-i > 2 && b[i] == '\r' && b[i+1] == '\n' { + break + } + } + + return newToken(TokenComment, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/doc.go new file mode 100644 index 000000000000..445b503ca337 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/doc.go @@ -0,0 +1,30 @@ +// Package ini is an LL(1) parser for configuration files. +// +// Example: +// sections, err := ini.OpenFile("/path/to/file") +// if err != nil { +// panic(err) +// } +// +// profile := "foo" +// section, ok := sections.GetSection(profile) +// if !ok { +// fmt.Printf("section %q could not be found", profile) +// } +// +// Below is the BNF that describes this parser +// Grammar: +// stmt -> value stmt' +// stmt' -> epsilon | op stmt +// value -> number | string | boolean | quoted_string +// +// section -> [ section' +// section' -> value section_close +// section_close -> ] +// +// SkipState will skip (NL WS)+ +// +// comment -> # comment' | ; comment' | / comment_slash +// comment_slash -> / comment' +// comment' -> epsilon | value +package ini diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/empty_token.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/empty_token.go new file mode 100644 index 000000000000..04345a54c20d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/empty_token.go @@ -0,0 +1,4 @@ +package ini + +// emptyToken is used to satisfy the Token interface +var emptyToken = newToken(TokenNone, []rune{}, NoneType) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/expression.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/expression.go new file mode 100644 index 000000000000..91ba2a59dd5e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/expression.go @@ -0,0 +1,24 @@ +package ini + +// newExpression will return an expression AST. +// Expr represents an expression +// +// grammar: +// expr -> string | number +func newExpression(tok Token) AST { + return newASTWithRootToken(ASTKindExpr, tok) +} + +func newEqualExpr(left AST, tok Token) AST { + return newASTWithRootToken(ASTKindEqualExpr, tok, left) +} + +// EqualExprKey will return a LHS value in the equal expr +func EqualExprKey(ast AST) string { + children := ast.GetChildren() + if len(children) == 0 || ast.Kind != ASTKindEqualExpr { + return "" + } + + return string(children[0].Root.Raw()) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/fuzz.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/fuzz.go new file mode 100644 index 000000000000..8d462f77e24f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/fuzz.go @@ -0,0 +1,17 @@ +// +build gofuzz + +package ini + +import ( + "bytes" +) + +func Fuzz(data []byte) int { + b := bytes.NewReader(data) + + if _, err := Parse(b); err != nil { + return 0 + } + + return 1 +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini.go new file mode 100644 index 000000000000..af6f397d2ed2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini.go @@ -0,0 +1,51 @@ +package ini + +import ( + "io" + "os" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// OpenFile takes a path to a given file, and will open and parse +// that file. +func OpenFile(path string) (Sections, error) { + f, err := os.Open(path) + if err != nil { + return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) + } + defer f.Close() + + return Parse(f) +} + +// Parse will parse the given file using the shared config +// visitor. +func Parse(f io.Reader) (Sections, error) { + tree, err := ParseAST(f) + if err != nil { + return Sections{}, err + } + + v := NewDefaultVisitor() + if err = Walk(tree, v); err != nil { + return Sections{}, err + } + + return v.Sections, nil +} + +// ParseBytes will parse the given bytes and return the parsed sections. +func ParseBytes(b []byte) (Sections, error) { + tree, err := ParseASTBytes(b) + if err != nil { + return Sections{}, err + } + + v := NewDefaultVisitor() + if err = Walk(tree, v); err != nil { + return Sections{}, err + } + + return v.Sections, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_lexer.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_lexer.go new file mode 100644 index 000000000000..898ebb05cdc2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_lexer.go @@ -0,0 +1,165 @@ +package ini + +import ( + "bytes" + "io" + "io/ioutil" + + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +const ( + // ErrCodeUnableToReadFile is used when a file is failed to be + // opened or read from. + ErrCodeUnableToReadFile = "FailedRead" +) + +// TokenType represents the various different tokens types +type TokenType int + +func (t TokenType) String() string { + switch t { + case TokenNone: + return "none" + case TokenLit: + return "literal" + case TokenSep: + return "sep" + case TokenOp: + return "op" + case TokenWS: + return "ws" + case TokenNL: + return "newline" + case TokenComment: + return "comment" + case TokenComma: + return "comma" + default: + return "" + } +} + +// TokenType enums +const ( + TokenNone = TokenType(iota) + TokenLit + TokenSep + TokenComma + TokenOp + TokenWS + TokenNL + TokenComment +) + +type iniLexer struct{} + +// Tokenize will return a list of tokens during lexical analysis of the +// io.Reader. +func (l *iniLexer) Tokenize(r io.Reader) ([]Token, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, awserr.New(ErrCodeUnableToReadFile, "unable to read file", err) + } + + return l.tokenize(b) +} + +func (l *iniLexer) tokenize(b []byte) ([]Token, error) { + runes := bytes.Runes(b) + var err error + n := 0 + tokenAmount := countTokens(runes) + tokens := make([]Token, tokenAmount) + count := 0 + + for len(runes) > 0 && count < tokenAmount { + switch { + case isWhitespace(runes[0]): + tokens[count], n, err = newWSToken(runes) + case isComma(runes[0]): + tokens[count], n = newCommaToken(), 1 + case isComment(runes): + tokens[count], n, err = newCommentToken(runes) + case isNewline(runes): + tokens[count], n, err = newNewlineToken(runes) + case isSep(runes): + tokens[count], n, err = newSepToken(runes) + case isOp(runes): + tokens[count], n, err = newOpToken(runes) + default: + tokens[count], n, err = newLitToken(runes) + } + + if err != nil { + return nil, err + } + + count++ + + runes = runes[n:] + } + + return tokens[:count], nil +} + +func countTokens(runes []rune) int { + count, n := 0, 0 + var err error + + for len(runes) > 0 { + switch { + case isWhitespace(runes[0]): + _, n, err = newWSToken(runes) + case isComma(runes[0]): + _, n = newCommaToken(), 1 + case isComment(runes): + _, n, err = newCommentToken(runes) + case isNewline(runes): + _, n, err = newNewlineToken(runes) + case isSep(runes): + _, n, err = newSepToken(runes) + case isOp(runes): + _, n, err = newOpToken(runes) + default: + _, n, err = newLitToken(runes) + } + + if err != nil { + return 0 + } + + count++ + runes = runes[n:] + } + + return count + 1 +} + +// Token indicates a metadata about a given value. +type Token struct { + t TokenType + ValueType ValueType + base int + raw []rune +} + +var emptyValue = Value{} + +func newToken(t TokenType, raw []rune, v ValueType) Token { + return Token{ + t: t, + raw: raw, + ValueType: v, + } +} + +// Raw return the raw runes that were consumed +func (tok Token) Raw() []rune { + return tok.raw +} + +// Type returns the token type +func (tok Token) Type() TokenType { + return tok.t +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_parser.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_parser.go new file mode 100644 index 000000000000..3bf43902850e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ini_parser.go @@ -0,0 +1,312 @@ +package ini + +import ( + "fmt" + "io" +) + +// State enums for the parse table +const ( + InvalidState = iota + // stmt -> value stmt' + StatementState + // stmt' -> MarkComplete | op stmt + StatementPrimeState + // value -> number | string | boolean | quoted_string + ValueState + // section -> [ section' + OpenScopeState + // section' -> value section_close + SectionState + // section_close -> ] + CloseScopeState + // SkipState will skip (NL WS)+ + SkipState + // SkipTokenState will skip any token and push the previous + // state onto the stack. + SkipTokenState + // comment -> # comment' | ; comment' | / comment_slash + // comment_slash -> / comment' + // comment' -> MarkComplete | value + CommentState + // MarkComplete state will complete statements and move that + // to the completed AST list + MarkCompleteState + // TerminalState signifies that the tokens have been fully parsed + TerminalState +) + +// parseTable is a state machine to dictate the grammar above. +var parseTable = map[ASTKind]map[TokenType]int{ + ASTKindStart: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: TerminalState, + }, + ASTKindCommentStatement: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindExpr: map[TokenType]int{ + TokenOp: StatementPrimeState, + TokenLit: ValueState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindEqualExpr: map[TokenType]int{ + TokenLit: ValueState, + TokenWS: SkipTokenState, + TokenNL: SkipState, + }, + ASTKindStatement: map[TokenType]int{ + TokenLit: SectionState, + TokenSep: CloseScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindExprStatement: map[TokenType]int{ + TokenLit: ValueState, + TokenSep: OpenScopeState, + TokenOp: ValueState, + TokenWS: ValueState, + TokenNL: MarkCompleteState, + TokenComment: CommentState, + TokenNone: TerminalState, + TokenComma: SkipState, + }, + ASTKindSectionStatement: map[TokenType]int{ + TokenLit: SectionState, + TokenSep: CloseScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + }, + ASTKindCompletedSectionStatement: map[TokenType]int{ + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindSkipStatement: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: TerminalState, + }, +} + +// ParseAST will parse input from an io.Reader using +// an LL(1) parser. +func ParseAST(r io.Reader) ([]AST, error) { + lexer := iniLexer{} + tokens, err := lexer.Tokenize(r) + if err != nil { + return []AST{}, err + } + + return parse(tokens) +} + +// ParseASTBytes will parse input from a byte slice using +// an LL(1) parser. +func ParseASTBytes(b []byte) ([]AST, error) { + lexer := iniLexer{} + tokens, err := lexer.tokenize(b) + if err != nil { + return []AST{}, err + } + + return parse(tokens) +} + +func parse(tokens []Token) ([]AST, error) { + start := Start + stack := newParseStack(3, len(tokens)) + + stack.Push(start) + s := newSkipper() + +loop: + for stack.Len() > 0 { + k := stack.Pop() + + var tok Token + if len(tokens) == 0 { + // this occurs when all the tokens have been processed + // but reduction of what's left on the stack needs to + // occur. + tok = emptyToken + } else { + tok = tokens[0] + } + + step := parseTable[k.Kind][tok.Type()] + if s.ShouldSkip(tok) { + step = SkipTokenState + } + + switch step { + case TerminalState: + // Finished parsing. Push what should be the last + // statement to the stack. If there is anything left + // on the stack, an error in parsing has occurred. + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + break loop + case SkipTokenState: + // When skipping a token, the previous state was popped off the stack. + // To maintain the correct state, the previous state will be pushed + // onto the stack. + stack.Push(k) + case StatementState: + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + expr := newExpression(tok) + stack.Push(expr) + case StatementPrimeState: + if tok.Type() != TokenOp { + stack.MarkComplete(k) + continue + } + + if k.Kind != ASTKindExpr { + return nil, NewParseError( + fmt.Sprintf("invalid expression: expected Expr type, but found %T type", k), + ) + } + + expr := newEqualExpr(k, tok) + stack.Push(expr) + case ValueState: + // ValueState requires the previous state to either be an equal expression + // or an expression statement. + // + // This grammar occurs when the RHS is a number, word, or quoted string. + // equal_expr -> lit op equal_expr' + // equal_expr' -> number | string | quoted_string + // quoted_string -> " quoted_string' + // quoted_string' -> string quoted_string_end + // quoted_string_end -> " + // + // otherwise + // expr_stmt -> equal_expr (expr_stmt')* + // expr_stmt' -> ws S | op S | MarkComplete + // S -> equal_expr' expr_stmt' + switch k.Kind { + case ASTKindEqualExpr: + // assiging a value to some key + k.AppendChild(newExpression(tok)) + stack.Push(newExprStatement(k)) + case ASTKindExprStatement: + root := k.GetRoot() + children := root.GetChildren() + if len(children) == 0 { + return nil, NewParseError( + fmt.Sprintf("invalid expression: AST contains no children %s", k.Kind), + ) + } + + rhs := children[len(children)-1] + + if rhs.Root.ValueType != QuotedStringType { + rhs.Root.ValueType = StringType + rhs.Root.raw = append(rhs.Root.raw, tok.Raw()...) + + } + + children[len(children)-1] = rhs + k.SetChildren(children) + + stack.Push(k) + } + case OpenScopeState: + if !runeCompare(tok.Raw(), openBrace) { + return nil, NewParseError("expected '['") + } + + stmt := newStatement() + stack.Push(stmt) + case CloseScopeState: + if !runeCompare(tok.Raw(), closeBrace) { + return nil, NewParseError("expected ']'") + } + + stack.Push(newCompletedSectionStatement(k)) + case SectionState: + var stmt AST + + switch k.Kind { + case ASTKindStatement: + // If there are multiple literals inside of a scope declaration, + // then the current token's raw value will be appended to the Name. + // + // This handles cases like [ profile default ] + // + // k will represent a SectionStatement with the children representing + // the label of the section + stmt = newSectionStatement(tok) + case ASTKindSectionStatement: + k.Root.raw = append(k.Root.raw, ' ') + k.Root.raw = append(k.Root.raw, tok.Raw()...) + stmt = k + default: + return nil, NewParseError( + fmt.Sprintf("invalid statement: expected statement: %v", k.Kind), + ) + } + + stack.Push(stmt) + case MarkCompleteState: + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + + if stack.Len() == 0 { + stack.Push(start) + } + case SkipState: + stack.Push(newSkipStatement(k)) + s.Skip() + case CommentState: + if k.Kind == ASTKindStart { + stack.Push(k) + } else { + stack.MarkComplete(k) + } + + stmt := newCommentStatement(tok) + stack.Push(stmt) + default: + return nil, NewParseError(fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", k, tok)) + } + + if len(tokens) > 0 { + tokens = tokens[1:] + } + } + + // this occurs when a statement has not been completed + if stack.top > 1 { + return nil, NewParseError(fmt.Sprintf("incomplete expression: %v", stack.container)) + } + + // returns a sublist which exludes the start symbol + return stack.List(), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/literal_tokens.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/literal_tokens.go new file mode 100644 index 000000000000..61754c88dae9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/literal_tokens.go @@ -0,0 +1,317 @@ +package ini + +import ( + "fmt" + "strconv" + "strings" +) + +var ( + runesTrue = []rune("true") + runesFalse = []rune("false") +) + +var literalValues = [][]rune{ + runesTrue, + runesFalse, +} + +func isBoolValue(b []rune) bool { + for _, lv := range literalValues { + if isLitValue(lv, b) { + return true + } + } + return false +} + +func isLitValue(want, have []rune) bool { + if len(have) < len(want) { + return false + } + + for i := 0; i < len(want); i++ { + if want[i] != have[i] { + return false + } + } + + return true +} + +// isNumberValue will return whether not the leading characters in +// a byte slice is a number. A number is delimited by whitespace or +// the newline token. +// +// A number is defined to be in a binary, octal, decimal (int | float), hex format, +// or in scientific notation. +func isNumberValue(b []rune) bool { + negativeIndex := 0 + helper := numberHelper{} + needDigit := false + + for i := 0; i < len(b); i++ { + negativeIndex++ + + switch b[i] { + case '-': + if helper.IsNegative() || negativeIndex != 1 { + return false + } + helper.Determine(b[i]) + needDigit = true + continue + case 'e', 'E': + if err := helper.Determine(b[i]); err != nil { + return false + } + negativeIndex = 0 + needDigit = true + continue + case 'b': + if helper.numberFormat == hex { + break + } + fallthrough + case 'o', 'x': + needDigit = true + if i == 0 { + return false + } + + fallthrough + case '.': + if err := helper.Determine(b[i]); err != nil { + return false + } + needDigit = true + continue + } + + if i > 0 && (isNewline(b[i:]) || isWhitespace(b[i])) { + return !needDigit + } + + if !helper.CorrectByte(b[i]) { + return false + } + needDigit = false + } + + return !needDigit +} + +func isValid(b []rune) (bool, int, error) { + if len(b) == 0 { + // TODO: should probably return an error + return false, 0, nil + } + + return isValidRune(b[0]), 1, nil +} + +func isValidRune(r rune) bool { + return r != ':' && r != '=' && r != '[' && r != ']' && r != ' ' && r != '\n' +} + +// ValueType is an enum that will signify what type +// the Value is +type ValueType int + +func (v ValueType) String() string { + switch v { + case NoneType: + return "NONE" + case DecimalType: + return "FLOAT" + case IntegerType: + return "INT" + case StringType: + return "STRING" + case BoolType: + return "BOOL" + } + + return "" +} + +// ValueType enums +const ( + NoneType = ValueType(iota) + DecimalType + IntegerType + StringType + QuotedStringType + BoolType +) + +// Value is a union container +type Value struct { + Type ValueType + raw []rune + + integer int64 + decimal float64 + boolean bool + str string +} + +func newValue(t ValueType, base int, raw []rune) (Value, error) { + v := Value{ + Type: t, + raw: raw, + } + var err error + + switch t { + case DecimalType: + v.decimal, err = strconv.ParseFloat(string(raw), 64) + if err != nil { + panic(err) + } + case IntegerType: + if base != 10 { + raw = raw[2:] + } + + v.integer, err = strconv.ParseInt(string(raw), base, 64) + case StringType: + v.str = string(raw) + case QuotedStringType: + v.str = string(raw[1 : len(raw)-1]) + case BoolType: + v.boolean = runeCompare(v.raw, runesTrue) + } + + return v, err +} + +// Append will append values and change the type to a string +// type. +func (v *Value) Append(tok Token) { + r := tok.Raw() + if v.Type != QuotedStringType { + v.Type = StringType + r = tok.raw[1 : len(tok.raw)-1] + } + if tok.Type() != TokenLit { + v.raw = append(v.raw, tok.Raw()...) + } else { + v.raw = append(v.raw, r...) + } +} + +func (v Value) String() string { + switch v.Type { + case DecimalType: + return fmt.Sprintf("decimal: %f", v.decimal) + case IntegerType: + return fmt.Sprintf("integer: %d", v.integer) + case StringType: + return fmt.Sprintf("string: %s", string(v.raw)) + case QuotedStringType: + return fmt.Sprintf("quoted string: %s", string(v.raw)) + case BoolType: + return fmt.Sprintf("bool: %t", v.boolean) + default: + return "union not set" + } +} + +func newLitToken(b []rune) (Token, int, error) { + n := 0 + var err error + + token := Token{} + if b[0] == '"' { + n, err = getStringValue(b) + if err != nil { + return token, n, err + } + + token = newToken(TokenLit, b[:n], QuotedStringType) + } else if isNumberValue(b) { + var base int + base, n, err = getNumericalValue(b) + if err != nil { + return token, 0, err + } + + value := b[:n] + vType := IntegerType + if contains(value, '.') || hasExponent(value) { + vType = DecimalType + } + token = newToken(TokenLit, value, vType) + token.base = base + } else if isBoolValue(b) { + n, err = getBoolValue(b) + + token = newToken(TokenLit, b[:n], BoolType) + } else { + n, err = getValue(b) + token = newToken(TokenLit, b[:n], StringType) + } + + return token, n, err +} + +// IntValue returns an integer value +func (v Value) IntValue() int64 { + return v.integer +} + +// FloatValue returns a float value +func (v Value) FloatValue() float64 { + return v.decimal +} + +// BoolValue returns a bool value +func (v Value) BoolValue() bool { + return v.boolean +} + +func isTrimmable(r rune) bool { + switch r { + case '\n', ' ': + return true + } + return false +} + +// StringValue returns the string value +func (v Value) StringValue() string { + switch v.Type { + case StringType: + return strings.TrimFunc(string(v.raw), isTrimmable) + case QuotedStringType: + // preserve all characters in the quotes + return string(removeEscapedCharacters(v.raw[1 : len(v.raw)-1])) + default: + return strings.TrimFunc(string(v.raw), isTrimmable) + } +} + +func contains(runes []rune, c rune) bool { + for i := 0; i < len(runes); i++ { + if runes[i] == c { + return true + } + } + + return false +} + +func runeCompare(v1 []rune, v2 []rune) bool { + if len(v1) != len(v2) { + return false + } + + for i := 0; i < len(v1); i++ { + if v1[i] != v2[i] { + return false + } + } + + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/newline_token.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/newline_token.go new file mode 100644 index 000000000000..e52ac399f17d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/newline_token.go @@ -0,0 +1,30 @@ +package ini + +func isNewline(b []rune) bool { + if len(b) == 0 { + return false + } + + if b[0] == '\n' { + return true + } + + if len(b) < 2 { + return false + } + + return b[0] == '\r' && b[1] == '\n' +} + +func newNewlineToken(b []rune) (Token, int, error) { + i := 1 + if b[0] == '\r' && isNewline(b[1:]) { + i++ + } + + if !isNewline([]rune(b[:i])) { + return emptyToken, 0, NewParseError("invalid new line token") + } + + return newToken(TokenNL, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/number_helper.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/number_helper.go new file mode 100644 index 000000000000..a45c0bc56622 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/number_helper.go @@ -0,0 +1,152 @@ +package ini + +import ( + "bytes" + "fmt" + "strconv" +) + +const ( + none = numberFormat(iota) + binary + octal + decimal + hex + exponent +) + +type numberFormat int + +// numberHelper is used to dictate what format a number is in +// and what to do for negative values. Since -1e-4 is a valid +// number, we cannot just simply check for duplicate negatives. +type numberHelper struct { + numberFormat numberFormat + + negative bool + negativeExponent bool +} + +func (b numberHelper) Exists() bool { + return b.numberFormat != none +} + +func (b numberHelper) IsNegative() bool { + return b.negative || b.negativeExponent +} + +func (b *numberHelper) Determine(c rune) error { + if b.Exists() { + return NewParseError(fmt.Sprintf("multiple number formats: 0%v", string(c))) + } + + switch c { + case 'b': + b.numberFormat = binary + case 'o': + b.numberFormat = octal + case 'x': + b.numberFormat = hex + case 'e', 'E': + b.numberFormat = exponent + case '-': + if b.numberFormat != exponent { + b.negative = true + } else { + b.negativeExponent = true + } + case '.': + b.numberFormat = decimal + default: + return NewParseError(fmt.Sprintf("invalid number character: %v", string(c))) + } + + return nil +} + +func (b numberHelper) CorrectByte(c rune) bool { + switch { + case b.numberFormat == binary: + if !isBinaryByte(c) { + return false + } + case b.numberFormat == octal: + if !isOctalByte(c) { + return false + } + case b.numberFormat == hex: + if !isHexByte(c) { + return false + } + case b.numberFormat == decimal: + if !isDigit(c) { + return false + } + case b.numberFormat == exponent: + if !isDigit(c) { + return false + } + case b.negativeExponent: + if !isDigit(c) { + return false + } + case b.negative: + if !isDigit(c) { + return false + } + default: + if !isDigit(c) { + return false + } + } + + return true +} + +func (b numberHelper) Base() int { + switch b.numberFormat { + case binary: + return 2 + case octal: + return 8 + case hex: + return 16 + default: + return 10 + } +} + +func (b numberHelper) String() string { + buf := bytes.Buffer{} + i := 0 + + switch b.numberFormat { + case binary: + i++ + buf.WriteString(strconv.Itoa(i) + ": binary format\n") + case octal: + i++ + buf.WriteString(strconv.Itoa(i) + ": octal format\n") + case hex: + i++ + buf.WriteString(strconv.Itoa(i) + ": hex format\n") + case exponent: + i++ + buf.WriteString(strconv.Itoa(i) + ": exponent format\n") + default: + i++ + buf.WriteString(strconv.Itoa(i) + ": integer format\n") + } + + if b.negative { + i++ + buf.WriteString(strconv.Itoa(i) + ": negative format\n") + } + + if b.negativeExponent { + i++ + buf.WriteString(strconv.Itoa(i) + ": negative exponent format\n") + } + + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/op_tokens.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/op_tokens.go new file mode 100644 index 000000000000..8a84c7cbe080 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/op_tokens.go @@ -0,0 +1,39 @@ +package ini + +import ( + "fmt" +) + +var ( + equalOp = []rune("=") + equalColonOp = []rune(":") +) + +func isOp(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case '=': + return true + case ':': + return true + default: + return false + } +} + +func newOpToken(b []rune) (Token, int, error) { + tok := Token{} + + switch b[0] { + case '=': + tok = newToken(TokenOp, equalOp, NoneType) + case ':': + tok = newToken(TokenOp, equalColonOp, NoneType) + default: + return tok, 0, NewParseError(fmt.Sprintf("unexpected op type, %v", b[0])) + } + return tok, 1, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_error.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_error.go new file mode 100644 index 000000000000..45728701931c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_error.go @@ -0,0 +1,43 @@ +package ini + +import "fmt" + +const ( + // ErrCodeParseError is returned when a parsing error + // has occurred. + ErrCodeParseError = "INIParseError" +) + +// ParseError is an error which is returned during any part of +// the parsing process. +type ParseError struct { + msg string +} + +// NewParseError will return a new ParseError where message +// is the description of the error. +func NewParseError(message string) *ParseError { + return &ParseError{ + msg: message, + } +} + +// Code will return the ErrCodeParseError +func (err *ParseError) Code() string { + return ErrCodeParseError +} + +// Message returns the error's message +func (err *ParseError) Message() string { + return err.msg +} + +// OrigError return nothing since there will never be any +// original error. +func (err *ParseError) OrigError() error { + return nil +} + +func (err *ParseError) Error() string { + return fmt.Sprintf("%s: %s", err.Code(), err.Message()) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_stack.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_stack.go new file mode 100644 index 000000000000..7f01cf7c7036 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/parse_stack.go @@ -0,0 +1,60 @@ +package ini + +import ( + "bytes" + "fmt" +) + +// ParseStack is a stack that contains a container, the stack portion, +// and the list which is the list of ASTs that have been successfully +// parsed. +type ParseStack struct { + top int + container []AST + list []AST + index int +} + +func newParseStack(sizeContainer, sizeList int) ParseStack { + return ParseStack{ + container: make([]AST, sizeContainer), + list: make([]AST, sizeList), + } +} + +// Pop will return and truncate the last container element. +func (s *ParseStack) Pop() AST { + s.top-- + return s.container[s.top] +} + +// Push will add the new AST to the container +func (s *ParseStack) Push(ast AST) { + s.container[s.top] = ast + s.top++ +} + +// MarkComplete will append the AST to the list of completed statements +func (s *ParseStack) MarkComplete(ast AST) { + s.list[s.index] = ast + s.index++ +} + +// List will return the completed statements +func (s ParseStack) List() []AST { + return s.list[:s.index] +} + +// Len will return the length of the container +func (s *ParseStack) Len() int { + return s.top +} + +func (s ParseStack) String() string { + buf := bytes.Buffer{} + for i, node := range s.list { + buf.WriteString(fmt.Sprintf("%d: %v\n", i+1, node)) + } + + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/sep_tokens.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/sep_tokens.go new file mode 100644 index 000000000000..f82095ba2594 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/sep_tokens.go @@ -0,0 +1,41 @@ +package ini + +import ( + "fmt" +) + +var ( + emptyRunes = []rune{} +) + +func isSep(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case '[', ']': + return true + default: + return false + } +} + +var ( + openBrace = []rune("[") + closeBrace = []rune("]") +) + +func newSepToken(b []rune) (Token, int, error) { + tok := Token{} + + switch b[0] { + case '[': + tok = newToken(TokenSep, openBrace, NoneType) + case ']': + tok = newToken(TokenSep, closeBrace, NoneType) + default: + return tok, 0, NewParseError(fmt.Sprintf("unexpected sep type, %v", b[0])) + } + return tok, 1, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/skipper.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/skipper.go new file mode 100644 index 000000000000..b72ea2fcee91 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/skipper.go @@ -0,0 +1,42 @@ +package ini + +// skipper is used to skip certain blocks of an ini file. +// Currently skipper is used to skip nested blocks of ini +// files. See example below +// +// [ foo ] +// nested = // this section will be skipped +// a=b +// c=d +// bar=baz // this will be included +type skipper struct { + shouldSkip bool + TokenSet bool + prevTok Token +} + +func newSkipper() skipper { + return skipper{ + prevTok: emptyToken, + } +} + +func (s *skipper) ShouldSkip(tok Token) bool { + if s.shouldSkip && s.prevTok.Type() == TokenNL && tok.Type() != TokenWS { + s.Continue() + return false + } + s.prevTok = tok + + return s.shouldSkip +} + +func (s *skipper) Skip() { + s.shouldSkip = true + s.prevTok = emptyToken +} + +func (s *skipper) Continue() { + s.shouldSkip = false + s.prevTok = emptyToken +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/statement.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/statement.go new file mode 100644 index 000000000000..ea86fea858b6 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/statement.go @@ -0,0 +1,36 @@ +package ini + +// Statement is an empty AST mostly used for transitioning states. +func newStatement() AST { + return newAST(ASTKindStatement, AST{}) +} + +// SectionStatement represents a section AST +func newSectionStatement(tok Token) AST { + return newASTWithRootToken(ASTKindSectionStatement, tok) +} + +// ExprStatement represents a completed expression AST +func newExprStatement(ast AST) AST { + return newAST(ASTKindExprStatement, ast) +} + +// CommentStatement represents a comment in the ini defintion. +// +// grammar: +// comment -> #comment' | ;comment' | /comment_slash +// comment_slash -> /comment' +// comment' -> value +func newCommentStatement(tok Token) AST { + return newAST(ASTKindCommentStatement, newExpression(tok)) +} + +// CompletedSectionStatement represents a completed section +func newCompletedSectionStatement(ast AST) AST { + return newAST(ASTKindCompletedSectionStatement, ast) +} + +// SkipStatement is used to skip whole statements +func newSkipStatement(ast AST) AST { + return newAST(ASTKindSkipStatement, ast) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/value_util.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/value_util.go new file mode 100644 index 000000000000..305999d29be0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/value_util.go @@ -0,0 +1,284 @@ +package ini + +import ( + "fmt" +) + +// getStringValue will return a quoted string and the amount +// of bytes read +// +// an error will be returned if the string is not properly formatted +func getStringValue(b []rune) (int, error) { + if b[0] != '"' { + return 0, NewParseError("strings must start with '\"'") + } + + endQuote := false + i := 1 + + for ; i < len(b) && !endQuote; i++ { + if escaped := isEscaped(b[:i], b[i]); b[i] == '"' && !escaped { + endQuote = true + break + } else if escaped { + /*c, err := getEscapedByte(b[i]) + if err != nil { + return 0, err + } + + b[i-1] = c + b = append(b[:i], b[i+1:]...) + i--*/ + + continue + } + } + + if !endQuote { + return 0, NewParseError("missing '\"' in string value") + } + + return i + 1, nil +} + +// getBoolValue will return a boolean and the amount +// of bytes read +// +// an error will be returned if the boolean is not of a correct +// value +func getBoolValue(b []rune) (int, error) { + if len(b) < 4 { + return 0, NewParseError("invalid boolean value") + } + + n := 0 + for _, lv := range literalValues { + if len(lv) > len(b) { + continue + } + + if isLitValue(lv, b) { + n = len(lv) + } + } + + if n == 0 { + return 0, NewParseError("invalid boolean value") + } + + return n, nil +} + +// getNumericalValue will return a numerical string, the amount +// of bytes read, and the base of the number +// +// an error will be returned if the number is not of a correct +// value +func getNumericalValue(b []rune) (int, int, error) { + if !isDigit(b[0]) { + return 0, 0, NewParseError("invalid digit value") + } + + i := 0 + helper := numberHelper{} + +loop: + for negativeIndex := 0; i < len(b); i++ { + negativeIndex++ + + if !isDigit(b[i]) { + switch b[i] { + case '-': + if helper.IsNegative() || negativeIndex != 1 { + return 0, 0, NewParseError("parse error '-'") + } + + n := getNegativeNumber(b[i:]) + i += (n - 1) + helper.Determine(b[i]) + continue + case '.': + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + case 'e', 'E': + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + + negativeIndex = 0 + case 'b': + if helper.numberFormat == hex { + break + } + fallthrough + case 'o', 'x': + if i == 0 && b[i] != '0' { + return 0, 0, NewParseError("incorrect base format, expected leading '0'") + } + + if i != 1 { + return 0, 0, NewParseError(fmt.Sprintf("incorrect base format found %s at %d index", string(b[i]), i)) + } + + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + default: + if isWhitespace(b[i]) { + break loop + } + + if isNewline(b[i:]) { + break loop + } + + if !(helper.numberFormat == hex && isHexByte(b[i])) { + if i+2 < len(b) && !isNewline(b[i:i+2]) { + return 0, 0, NewParseError("invalid numerical character") + } else if !isNewline([]rune{b[i]}) { + return 0, 0, NewParseError("invalid numerical character") + } + + break loop + } + } + } + } + + return helper.Base(), i, nil +} + +// isDigit will return whether or not something is an integer +func isDigit(b rune) bool { + return b >= '0' && b <= '9' +} + +func hasExponent(v []rune) bool { + return contains(v, 'e') || contains(v, 'E') +} + +func isBinaryByte(b rune) bool { + switch b { + case '0', '1': + return true + default: + return false + } +} + +func isOctalByte(b rune) bool { + switch b { + case '0', '1', '2', '3', '4', '5', '6', '7': + return true + default: + return false + } +} + +func isHexByte(b rune) bool { + if isDigit(b) { + return true + } + return (b >= 'A' && b <= 'F') || + (b >= 'a' && b <= 'f') +} + +func getValue(b []rune) (int, error) { + i := 0 + + for i < len(b) { + if isNewline(b[i:]) { + break + } + + if isOp(b[i:]) { + break + } + + valid, n, err := isValid(b[i:]) + if err != nil { + return 0, err + } + + if !valid { + break + } + + i += n + } + + return i, nil +} + +// getNegativeNumber will return a negative number from a +// byte slice. This will iterate through all characters until +// a non-digit has been found. +func getNegativeNumber(b []rune) int { + if b[0] != '-' { + return 0 + } + + i := 1 + for ; i < len(b); i++ { + if !isDigit(b[i]) { + return i + } + } + + return i +} + +// isEscaped will return whether or not the character is an escaped +// character. +func isEscaped(value []rune, b rune) bool { + if len(value) == 0 { + return false + } + + switch b { + case '\'': // single quote + case '"': // quote + case 'n': // newline + case 't': // tab + case '\\': // backslash + default: + return false + } + + return value[len(value)-1] == '\\' +} + +func getEscapedByte(b rune) (rune, error) { + switch b { + case '\'': // single quote + return '\'', nil + case '"': // quote + return '"', nil + case 'n': // newline + return '\n', nil + case 't': // table + return '\t', nil + case '\\': // backslash + return '\\', nil + default: + return b, NewParseError(fmt.Sprintf("invalid escaped character %c", b)) + } +} + +func removeEscapedCharacters(b []rune) []rune { + for i := 0; i < len(b); i++ { + if isEscaped(b[:i], b[i]) { + c, err := getEscapedByte(b[i]) + if err != nil { + return b + } + + b[i-1] = c + b = append(b[:i], b[i+1:]...) + i-- + } + } + + return b +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/visitor.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/visitor.go new file mode 100644 index 000000000000..c710170a0697 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/visitor.go @@ -0,0 +1,155 @@ +package ini + +import ( + "fmt" + "sort" +) + +// Visitor is an interface used by walkers that will +// traverse an array of ASTs. +type Visitor interface { + VisitExpr(AST) error + VisitStatement(AST) error +} + +// DefaultVisitor is used to visit statements and expressions +// and ensure that they are both of the correct format. +// In addition, upon visiting this will build sections and populate +// the Sections field which can be used to retrieve profile +// configuration. +type DefaultVisitor struct { + scope string + Sections Sections +} + +// NewDefaultVisitor return a DefaultVisitor +func NewDefaultVisitor() *DefaultVisitor { + return &DefaultVisitor{ + Sections: Sections{ + container: map[string]Section{}, + }, + } +} + +// VisitExpr visits expressions... +func (v *DefaultVisitor) VisitExpr(expr AST) error { + t := v.Sections.container[v.scope] + if t.values == nil { + t.values = values{} + } + + switch expr.Kind { + case ASTKindExprStatement: + opExpr := expr.GetRoot() + switch opExpr.Kind { + case ASTKindEqualExpr: + children := opExpr.GetChildren() + if len(children) <= 1 { + return NewParseError("unexpected token type") + } + + rhs := children[1] + + if rhs.Root.Type() != TokenLit { + return NewParseError("unexpected token type") + } + + key := EqualExprKey(opExpr) + v, err := newValue(rhs.Root.ValueType, rhs.Root.base, rhs.Root.Raw()) + if err != nil { + return err + } + + t.values[key] = v + default: + return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) + } + default: + return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) + } + + v.Sections.container[v.scope] = t + return nil +} + +// VisitStatement visits statements... +func (v *DefaultVisitor) VisitStatement(stmt AST) error { + switch stmt.Kind { + case ASTKindCompletedSectionStatement: + child := stmt.GetRoot() + if child.Kind != ASTKindSectionStatement { + return NewParseError(fmt.Sprintf("unsupported child statement: %T", child)) + } + + name := string(child.Root.Raw()) + v.Sections.container[name] = Section{} + v.scope = name + default: + return NewParseError(fmt.Sprintf("unsupported statement: %s", stmt.Kind)) + } + + return nil +} + +// Sections is a map of Section structures that represent +// a configuration. +type Sections struct { + container map[string]Section +} + +// GetSection will return section p. If section p does not exist, +// false will be returned in the second parameter. +func (t Sections) GetSection(p string) (Section, bool) { + v, ok := t.container[p] + return v, ok +} + +// values represents a map of union values. +type values map[string]Value + +// List will return a list of all sections that were successfully +// parsed. +func (t Sections) List() []string { + keys := make([]string, len(t.container)) + i := 0 + for k := range t.container { + keys[i] = k + i++ + } + + sort.Strings(keys) + return keys +} + +// Section contains a name and values. This represent +// a sectioned entry in a configuration file. +type Section struct { + Name string + values values +} + +// ValueType will returned what type the union is set to. If +// k was not found, the NoneType will be returned. +func (t Section) ValueType(k string) (ValueType, bool) { + v, ok := t.values[k] + return v.Type, ok +} + +// Int returns an integer value at k +func (t Section) Int(k string) int64 { + return t.values[k].IntValue() +} + +// Float64 returns a float value at k +func (t Section) Float64(k string) float64 { + return t.values[k].FloatValue() +} + +// String returns the string value at k +func (t Section) String(k string) string { + _, ok := t.values[k] + if !ok { + return "" + } + return t.values[k].StringValue() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/walker.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/walker.go new file mode 100644 index 000000000000..99915f7f777c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/walker.go @@ -0,0 +1,25 @@ +package ini + +// Walk will traverse the AST using the v, the Visitor. +func Walk(tree []AST, v Visitor) error { + for _, node := range tree { + switch node.Kind { + case ASTKindExpr, + ASTKindExprStatement: + + if err := v.VisitExpr(node); err != nil { + return err + } + case ASTKindStatement, + ASTKindCompletedSectionStatement, + ASTKindNestedSectionStatement, + ASTKindCompletedNestedSectionStatement: + + if err := v.VisitStatement(node); err != nil { + return err + } + } + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ws_token.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ws_token.go new file mode 100644 index 000000000000..7ffb4ae06ff0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/ws_token.go @@ -0,0 +1,24 @@ +package ini + +import ( + "unicode" +) + +// isWhitespace will return whether or not the character is +// a whitespace character. +// +// Whitespace is defined as a space or tab. +func isWhitespace(c rune) bool { + return unicode.IsSpace(c) && c != '\n' && c != '\r' +} + +func newWSToken(b []rune) (Token, int, error) { + i := 0 + for ; i < len(b); i++ { + if !isWhitespace(b[i]) { + break + } + } + + return newToken(TokenWS, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/interfaces.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/interfaces.go new file mode 100644 index 000000000000..2b42cbe6421a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/interfaces.go @@ -0,0 +1,9 @@ +package sdk + +// Invalidator provides access to a type's invalidate method to make it +// invalidate it cache. +// +// e.g aws.SafeCredentialsProvider's Invalidate method. +type Invalidator interface { + Invalidate() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/time.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/time.go new file mode 100644 index 000000000000..e5640abd876c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/sdk/time.go @@ -0,0 +1,44 @@ +package sdk + +import ( + "context" + "time" +) + +func init() { + NowTime = time.Now + Sleep = time.Sleep + SleepWithContext = DefaultSleepWithContext +} + +// NowTime is a value for getting the current time. This value can be overriden +// for testing mocking out current time. +var NowTime func() time.Time + +// Sleep is a value for sleeping for a duration. This value can be overriden +// for testing and mocking out sleep duration. +var Sleep func(time.Duration) + +// SleepWithContext will wait for the timer duration to expire, or the context +// is canceled. Which ever happens first. If the context is canceled the Context's +// error will be returned. +// +// This value can be overriden for testing and mocking out sleep duration. +var SleepWithContext func(context.Context, time.Duration) error + +// DefaultSleepWithContext will wait for the timer duration to expire, or the context +// is canceled. Which ever happens first. If the context is canceled the Context's +// error will be returned. +func DefaultSleepWithContext(ctx context.Context, dur time.Duration) error { + t := time.NewTimer(dur) + defer t.Stop() + + select { + case <-t.C: + break + case <-ctx.Done(): + return ctx.Err() + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/encode.go new file mode 100644 index 000000000000..dc3d1296cdbb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/encode.go @@ -0,0 +1,95 @@ +package protocol + +import ( + "io" +) + +// A FieldMarshaler interface is used to marshal struct fields when encoding. +type FieldMarshaler interface { + MarshalFields(FieldEncoder) error +} + +// FieldMarshalerFunc is a helper utility that wrapps a function and allows +// that function to be called as a FieldMarshaler. +type FieldMarshalerFunc func(FieldEncoder) error + +// MarshalFields will call the underlying function passing in the field encoder +// with the protocol field encoder. +func (fn FieldMarshalerFunc) MarshalFields(e FieldEncoder) error { + return fn(e) +} + +// ValueMarshaler provides a generic type for all encoding field values to be +// passed into a encoder's methods with. +type ValueMarshaler interface { + MarshalValue() (string, error) + MarshalValueBuf([]byte) ([]byte, error) +} + +// A StreamMarshaler interface is used to marshal a stream when encoding. +type StreamMarshaler interface { + MarshalStream() (io.ReadSeeker, error) +} + +// MarshalListValues is a marshaler for list encoders. +type MarshalListValues interface { + MarshalValues(enc ListEncoder) error +} + +// MapMarshaler is a marshaler for map encoders. +type MapMarshaler interface { + MarshalValues(enc MapEncoder) error +} + +// A ListEncoder provides the interface for encoders that will encode List elements. +type ListEncoder interface { + Start() + End() + + Map() MapEncoder + List() ListEncoder + + ListAddValue(v ValueMarshaler) + ListAddFields(m FieldMarshaler) +} + +// A MapEncoder provides the interface for encoders that will encode map elements. +type MapEncoder interface { + Start() + End() + + Map(k string) MapEncoder + List(k string) ListEncoder + + MapSetValue(k string, v ValueMarshaler) + MapSetFields(k string, m FieldMarshaler) +} + +// A FieldEncoder provides the interface for encoding struct field members. +type FieldEncoder interface { + SetValue(t Target, k string, m ValueMarshaler, meta Metadata) + SetStream(t Target, k string, m StreamMarshaler, meta Metadata) + SetFields(t Target, k string, m FieldMarshaler, meta Metadata) + + Map(t Target, k string, meta Metadata) MapEncoder + List(t Target, k string, meta Metadata) ListEncoder +} + +// A FieldBuffer provides buffering of fields so the number of +// allocations are reduced by providng a persistent buffer that is +// used between fields. +type FieldBuffer struct { + buf []byte +} + +// GetValue will retrieve the ValueMarshaler's value by appending the +// value to the buffer. Will return the buffer that was populated. +// +// This buffer is only valid until the next time GetValue is called. +func (b *FieldBuffer) GetValue(m ValueMarshaler) ([]byte, error) { + v, err := m.MarshalValueBuf(b.buf) + if len(v) > len(b.buf) { + b.buf = v + } + return v, err +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/fields.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/fields.go new file mode 100644 index 000000000000..b131e2249f4a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/fields.go @@ -0,0 +1,197 @@ +package protocol + +import ( + "bytes" + "encoding/base64" + "io" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// QuotedValue represents a type that should be quoted when encoding +// a string value. +type QuotedValue struct { + ValueMarshaler +} + +// BoolValue provies encoding of bool for AWS protocols. +type BoolValue bool + +// MarshalValue formats the value into a string for encoding. +func (v BoolValue) MarshalValue() (string, error) { + return strconv.FormatBool(bool(v)), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v BoolValue) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return strconv.AppendBool(b, bool(v)), nil +} + +// BytesValue provies encoding of string for AWS protocols. +type BytesValue string + +// MarshalValue formats the value into a string for encoding. +func (v BytesValue) MarshalValue() (string, error) { + return base64.StdEncoding.EncodeToString([]byte(v)), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +func (v BytesValue) MarshalValueBuf(b []byte) ([]byte, error) { + m := []byte(v) + + n := base64.StdEncoding.EncodedLen(len(m)) + if len(b) < n { + b = make([]byte, n) + } + base64.StdEncoding.Encode(b, m) + return b[:n], nil +} + +// StringValue provies encoding of string for AWS protocols. +type StringValue string + +// MarshalValue formats the value into a string for encoding. +func (v StringValue) MarshalValue() (string, error) { + return string(v), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v StringValue) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, v...), nil +} + +// Int64Value provies encoding of int64 for AWS protocols. +type Int64Value int64 + +// MarshalValue formats the value into a string for encoding. +func (v Int64Value) MarshalValue() (string, error) { + return strconv.FormatInt(int64(v), 10), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v Int64Value) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return strconv.AppendInt(b, int64(v), 10), nil +} + +// Float64Value provies encoding of float64 for AWS protocols. +type Float64Value float64 + +// MarshalValue formats the value into a string for encoding. +func (v Float64Value) MarshalValue() (string, error) { + return strconv.FormatFloat(float64(v), 'f', -1, 64), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v Float64Value) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return strconv.AppendFloat(b, float64(v), 'f', -1, 64), nil +} + +// JSONValue provies encoding of aws.JSONValues for AWS protocols. +type JSONValue struct { + V aws.JSONValue + EscapeMode EscapeMode +} + +// MarshalValue formats the value into a string for encoding. +func (v JSONValue) MarshalValue() (string, error) { + return EncodeJSONValue(v.V, v.EscapeMode) +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v JSONValue) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + + m, err := EncodeJSONValue(v.V, v.EscapeMode) + if err != nil { + return nil, err + } + + return append(b, []byte(m)...), nil +} + +// Time formats for protocol time fields. +const ( + ISO8601TimeFormat = "2006-01-02T15:04:05Z" // ISO 8601 formated time. + RFC822TimeFromat = "Mon, 2 Jan 2006 15:04:05 GMT" // RFC822 formatted time. + UnixTimeFormat = "unix time format" // Special case for Unix time +) + +// TimeValue provies encoding of time.Time for AWS protocols. +type TimeValue struct { + V time.Time + Format string +} + +// MarshalValue formats the value into a string givin a format for encoding. +func (v TimeValue) MarshalValue() (string, error) { + t := time.Time(v.V) + + if v.Format == UnixTimeFormat { + return strconv.FormatInt(t.UTC().Unix(), 10), nil + } + return t.UTC().Format(v.Format), nil +} + +// MarshalValueBuf formats the value into a byte slice for encoding. +// If there is enough room in the passed in slice v will be appended to it. +// +// Will reset the length of the passed in slice to 0. +func (v TimeValue) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + + m, err := v.MarshalValue() + if err != nil { + return nil, err + } + + return append(b, m...), nil +} + +// A ReadSeekerStream wrapps an io.ReadSeeker to be used as a StreamMarshaler. +type ReadSeekerStream struct { + V io.ReadSeeker +} + +// MarshalStream returns the wrapped io.ReadSeeker for encoding. +func (v ReadSeekerStream) MarshalStream() (io.ReadSeeker, error) { + return v.V, nil +} + +// A BytesStream aliases a byte slice to be used as a StreamMarshaler. +type BytesStream []byte + +// MarshalStream marshals a byte slice into an io.ReadSeeker for encoding. +func (v BytesStream) MarshalStream() (io.ReadSeeker, error) { + return bytes.NewReader([]byte(v)), nil +} + +// A StringStream aliases a string to be used as a StreamMarshaler. +type StringStream string + +// MarshalStream marshals a string into an io.ReadSeeker for encoding. +func (v StringStream) MarshalStream() (io.ReadSeeker, error) { + return strings.NewReader(string(v)), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/header_encoder.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/header_encoder.go new file mode 100644 index 000000000000..38bae691b790 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/header_encoder.go @@ -0,0 +1,116 @@ +package protocol + +import ( + "fmt" + "net/http" +) + +// HeaderMapEncoder builds a map valu +type HeaderMapEncoder struct { + Prefix string + Header http.Header + Err error +} + +// MapSetValue adds a single value to the header. +func (e *HeaderMapEncoder) MapSetValue(k string, v ValueMarshaler) { + if e.Err != nil { + return + } + + str, err := v.MarshalValue() + if err != nil { + e.Err = err + return + } + + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + e.Header.Set(k, str) +} + +// List executes the passed in callback with a list encoder based on +// the context of this HeaderMapEncoder. +func (e *HeaderMapEncoder) List(k string) ListEncoder { + if e.Err != nil { + return nil + } + + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + return &HeaderListEncoder{Key: k, Header: e.Header} +} + +// Map sets the header element with nested maps appending the +// passed in k to the prefix if one was set. +func (e *HeaderMapEncoder) Map(k string) MapEncoder { + if e.Err != nil { + return nil + } + + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + return &HeaderMapEncoder{Prefix: k, Header: e.Header} +} + +// Start does nothing for header encodings. +func (e *HeaderMapEncoder) Start() {} + +// End does nothing for header encodings. +func (e *HeaderMapEncoder) End() {} + +// MapSetFields Is not implemented, query map of FieldMarshaler is undefined. +func (e *HeaderMapEncoder) MapSetFields(k string, m FieldMarshaler) { + e.Err = fmt.Errorf("header map encoder MapSetFields not supported, %s", k) +} + +// HeaderListEncoder will encode list values nested into a header key. +type HeaderListEncoder struct { + Key string + Header http.Header + Err error +} + +// ListAddValue encodes an individual list value into the header. +func (e *HeaderListEncoder) ListAddValue(v ValueMarshaler) { + if e.Err != nil { + return + } + + str, err := v.MarshalValue() + if err != nil { + e.Err = err + return + } + + e.Header.Add(e.Key, str) +} + +// List Is not implemented, header list of list is undefined. +func (e *HeaderListEncoder) List() ListEncoder { + e.Err = fmt.Errorf("header list encoder ListAddList not supported, %s", e.Key) + return nil +} + +// Map Is not implemented, header list of map is undefined. +func (e *HeaderListEncoder) Map() MapEncoder { + e.Err = fmt.Errorf("header list encoder ListAddMap not supported, %s", e.Key) + return nil +} + +// Start does nothing for header list encodings. +func (e *HeaderListEncoder) Start() {} + +// End does nothing for header list encodings. +func (e *HeaderListEncoder) End() {} + +// ListAddFields Is not implemented, query list of FieldMarshaler is undefined. +func (e *HeaderListEncoder) ListAddFields(m FieldMarshaler) { + e.Err = fmt.Errorf("header list encoder ListAddFields not supported, %s", e.Key) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/idempotency.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/idempotency.go new file mode 100644 index 000000000000..53831dff9842 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/idempotency.go @@ -0,0 +1,75 @@ +package protocol + +import ( + "crypto/rand" + "fmt" + "reflect" +) + +// RandReader is the random reader the protocol package will use to read +// random bytes from. This is exported for testing, and should not be used. +var RandReader = rand.Reader + +const idempotencyTokenFillTag = `idempotencyToken` + +// CanSetIdempotencyToken returns true if the struct field should be +// automatically populated with a Idempotency token. +// +// Only *string and string type fields that are tagged with idempotencyToken +// which are not already set can be auto filled. +func CanSetIdempotencyToken(v reflect.Value, f reflect.StructField) bool { + switch u := v.Interface().(type) { + // To auto fill an Idempotency token the field must be a string, + // tagged for auto fill, and have a zero value. + case *string: + return u == nil && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 + case string: + return len(u) == 0 && len(f.Tag.Get(idempotencyTokenFillTag)) != 0 + } + + return false +} + +// GetIdempotencyToken returns a randomly generated idempotency token. +func GetIdempotencyToken() string { + b := make([]byte, 16) + RandReader.Read(b) + + return UUIDVersion4(b) +} + +// SetIdempotencyToken will set the value provided with a Idempotency Token. +// Given that the value can be set. Will panic if value is not setable. +func SetIdempotencyToken(v reflect.Value) { + if v.Kind() == reflect.Ptr { + if v.IsNil() && v.CanSet() { + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + v = reflect.Indirect(v) + + if !v.CanSet() { + panic(fmt.Sprintf("unable to set idempotnecy token %v", v)) + } + + b := make([]byte, 16) + _, err := rand.Read(b) + if err != nil { + // TODO handle error + return + } + + v.Set(reflect.ValueOf(UUIDVersion4(b))) +} + +// UUIDVersion4 returns a Version 4 random UUID from the byte slice provided +func UUIDVersion4(u []byte) string { + // https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29 + // 13th character is "4" + u[6] = (u[6] | 0x40) & 0x4F + // 17th character is "8", "9", "a", or "b" + u[8] = (u[8] | 0x80) & 0xBF + + return fmt.Sprintf(`%X-%X-%X-%X-%X`, u[0:4], u[4:6], u[6:8], u[8:10], u[10:]) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/encode.go new file mode 100644 index 000000000000..641b05f58579 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/encode.go @@ -0,0 +1,290 @@ +package json + +import ( + "bytes" + "fmt" + "io" + + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// An Encoder provides encoding of the AWS JSON protocol. This encoder will will +// write all content to JSON. Only supports body and payload targets. +type Encoder struct { + encoder + root bool +} + +// NewEncoder creates a new encoder for encoding AWS JSON protocol. Only encodes +// fields into the JSON body, and error is returned if target is anything other +// than Body or Payload. +func NewEncoder() *Encoder { + buf := bytes.NewBuffer([]byte{'{'}) + e := &Encoder{ + encoder: encoder{ + buf: buf, + parent: nil, + fieldBuf: &protocol.FieldBuffer{}, + }, + root: true, + } + + return e +} + +// Encode returns the encoded XMl reader. An error will be returned if one was +// encountered while building the JSON body. +func (e *Encoder) Encode() (io.ReadSeeker, error) { + b, err := e.encode() + if err != nil { + return nil, err + } + + if len(b) == 2 { + // Account for first starting object in buffer + return nil, nil + } + + return bytes.NewReader(b), nil +} + +// SetValue sets an individual value to the JSON body. +func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata) { + e.encoder.writeSep() + e.writeKey(k) + e.writeValue(v) +} + +// SetStream is not supported for JSON protocol marshaling. +func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + e.err = fmt.Errorf("json encoder SetStream not supported, %s, %s", t, k) +} + +// Map will return a new mapEncoder and create a new scope for the map encoding. +func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder { + temp := newScope(e.encoder, &e.encoder) + return &mapEncoder{temp, k} +} + +// List will return a new listEncoder and create a new scope for the list encoding. +func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder { + temp := newScope(e.encoder, &e.encoder) + return &listEncoder{temp, k} +} + +// SetFields sets the nested fields to the JSON body. +func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata) { + if t == protocol.PayloadTarget { + // Ignore payload key and only marshal body without wrapping in object first. + nested := Encoder{ + encoder: encoder{ + buf: e.encoder.buf, + fieldBuf: e.encoder.fieldBuf, + }, + } + m.MarshalFields(&nested) + e.err = nested.err + return + } + + e.writeSep() + e.writeKey(k) + e.writeObject(func(enc encoder) error { + temp := newScope(enc, &e.encoder) + nested := Encoder{encoder: temp} + m.MarshalFields(&nested) + return nested.err + }) +} + +// A listEncoder encodes elements within a list for the JSON encoder. +type listEncoder struct { + encoder + k string +} + +// Map return a new mapEncoder while creating a new scope for the encoder. +func (e *listEncoder) Map() protocol.MapEncoder { + temp := newScope(e.encoder, &e.encoder) + return &mapEncoder{temp, ""} +} + +// List return a new listEncoder while creating a new scope for the encoder. +func (e *listEncoder) List() protocol.ListEncoder { + temp := newScope(e.encoder, &e.encoder) + return &listEncoder{temp, ""} +} + +// Start will open a new scope for a list and write the given key. +func (e *listEncoder) Start() { + e.encoder.parent.writeSep() + e.writeKey(e.k) + e.WriteListStart() +} + +// End will close the list. +func (e *listEncoder) End() { + e.WriteListEnd() +} + +// ListAddValue will add the value to the list. +func (e *listEncoder) ListAddValue(v protocol.ValueMarshaler) { + e.encoder.writeSep() + e.writeValue(v) +} + +// ListAddFields will set the nested type's fields to the list. +func (e *listEncoder) ListAddFields(m protocol.FieldMarshaler) { + e.encoder.writeSep() + e.writeObject(func(enc encoder) error { + temp := newScope(enc, &e.encoder) + nested := Encoder{encoder: temp} + m.MarshalFields(&nested) + return nested.err + }) +} + +// A mapEncoder encodes key values pair map values for the JSON encoder. +type mapEncoder struct { + encoder encoder + k string +} + +// Start will open a new scope for a list and write the given key. +func (e *mapEncoder) Start() { + e.encoder.parent.writeSep() + e.encoder.writeKey(e.k) + e.encoder.WriteMapStart() +} + +// End will close the list. +func (e *mapEncoder) End() { + e.encoder.WriteMapEnd() +} + +// Map will create a new scope and return a mapEncoder. +func (e *mapEncoder) Map(k string) protocol.MapEncoder { + temp := newScope(e.encoder, &e.encoder) + return &mapEncoder{temp, k} +} + +// List will create a new scope and return a listEncoder +func (e *mapEncoder) List(k string) protocol.ListEncoder { + temp := newScope(e.encoder, &e.encoder) + return &listEncoder{temp, k} +} + +// MapSetValue sets a map value. +func (e *mapEncoder) MapSetValue(k string, v protocol.ValueMarshaler) { + e.encoder.writeSep() + e.encoder.writeKey(k) + e.encoder.writeValue(v) +} + +// MapSetFields will set the nested type's fields under the map. +func (e *mapEncoder) MapSetFields(k string, m protocol.FieldMarshaler) { + e.encoder.writeSep() + e.encoder.writeKey(k) + e.encoder.writeObject(func(enc encoder) error { + temp := newScope(enc, &e.encoder) + nested := Encoder{encoder: temp} + m.MarshalFields(&nested) + return nested.err + }) +} + +type encoder struct { + buf *bytes.Buffer + fieldBuf *protocol.FieldBuffer + started bool + parent *encoder + err error +} + +func (e encoder) encode() ([]byte, error) { + if e.err != nil { + return nil, e.err + } + + // Close the root object + e.buf.WriteByte('}') + + return e.buf.Bytes(), nil +} + +func (e *encoder) writeKey(k string) { + e.buf.WriteByte('"') + e.buf.WriteString(k) + e.buf.WriteByte('"') + e.buf.WriteByte(':') +} + +func (e *encoder) writeValue(v protocol.ValueMarshaler) { + if e.err != nil { + return + } + + b, err := e.fieldBuf.GetValue(v) + if err != nil { + e.err = err + return + } + + var asStr bool + switch v.(type) { + case protocol.QuotedValue: + asStr = true + } + + if asStr { + escapeStringBytes(e.buf, b) + } else { + e.buf.Write(b) + } +} + +func (e *encoder) writeObject(fn func(encoder) error) { + if e.err != nil { + return + } + + e.buf.WriteByte('{') + e.err = fn(*e) + e.buf.WriteByte('}') +} + +func (e *encoder) WriteListStart() { + e.buf.WriteByte('[') +} + +func (e *encoder) WriteListEnd() { + e.buf.WriteByte(']') +} + +func (e *encoder) WriteMapStart() { + e.buf.WriteByte('{') +} + +func (e *encoder) WriteMapEnd() { + e.buf.WriteByte('}') +} + +func (e *encoder) writeSep() { + if e.started { + e.buf.WriteByte(',') + } else { + e.started = true + } + +} + +// newScope will return a new encoder with the correct parent and started to false. +func newScope(e encoder, parent *encoder) encoder { + temp := e + temp.started = false + temp.parent = parent + return temp +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/escape.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/escape.go new file mode 100644 index 000000000000..d984d0cdca12 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/escape.go @@ -0,0 +1,198 @@ +// Copyright 2016 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. + +// Copied and modified from Go 1.8 stdlib's encoding/json/#safeSet + +package json + +import ( + "bytes" + "unicode/utf8" +) + +// safeSet holds the value true if the ASCII character with the given array +// position can be represented inside a JSON string without any further +// escaping. +// +// All values are true except for the ASCII control characters (0-31), the +// double quote ("), and the backslash character ("\"). +var safeSet = [utf8.RuneSelf]bool{ + ' ': true, + '!': true, + '"': false, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + ',': true, + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + ';': true, + '<': true, + '=': true, + '>': true, + '?': true, + '@': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + '[': true, + '\\': false, + ']': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '{': true, + '|': true, + '}': true, + '~': true, + '\u007f': true, +} + +// copied from Go 1.8 stdlib's encoding/json/#hex +var hex = "0123456789abcdef" + +// escapeStringBytes escapes and writes the passed in string bytes to the dst +// buffer +// +// Copied and modifed from Go 1.8 stdlib's encodeing/json/#encodeState.stringBytes +func escapeStringBytes(e *bytes.Buffer, s []byte) { + e.WriteByte('"') + start := 0 + for i := 0; i < len(s); { + if b := s[i]; b < utf8.RuneSelf { + if safeSet[b] { + i++ + continue + } + if start < i { + e.Write(s[start:i]) + } + switch b { + case '\\', '"': + e.WriteByte('\\') + e.WriteByte(b) + case '\n': + e.WriteByte('\\') + e.WriteByte('n') + case '\r': + e.WriteByte('\\') + e.WriteByte('r') + case '\t': + e.WriteByte('\\') + e.WriteByte('t') + default: + // This encodes bytes < 0x20 except for \t, \n and \r. + // If escapeHTML is set, it also escapes <, >, and & + // because they can lead to security holes when + // user-controlled strings are rendered into JSON + // and served to some browsers. + e.WriteString(`\u00`) + e.WriteByte(hex[b>>4]) + e.WriteByte(hex[b&0xF]) + } + i++ + start = i + continue + } + c, size := utf8.DecodeRune(s[i:]) + if c == utf8.RuneError && size == 1 { + if start < i { + e.Write(s[start:i]) + } + e.WriteString(`\ufffd`) + i += size + start = i + continue + } + // U+2028 is LINE SEPARATOR. + // U+2029 is PARAGRAPH SEPARATOR. + // They are both technically valid characters in JSON strings, + // but don't work in JSONP, which has to be evaluated as JavaScript, + // and can lead to security holes there. It is valid JSON to + // escape them, so we do so unconditionally. + // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion. + if c == '\u2028' || c == '\u2029' { + if start < i { + e.Write(s[start:i]) + } + e.WriteString(`\u202`) + e.WriteByte(hex[c&0xF]) + i += size + start = i + continue + } + i += size + } + if start < len(s) { + e.Write(s[start:]) + } + e.WriteByte('"') +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/build.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/build.go new file mode 100644 index 000000000000..029be321604b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/build.go @@ -0,0 +1,293 @@ +// Package jsonutil provides JSON serialization of AWS requests and responses. +package jsonutil + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "math" + "reflect" + "sort" + "strconv" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +var timeType = reflect.ValueOf(time.Time{}).Type() +var byteSliceType = reflect.ValueOf([]byte{}).Type() + +// BuildJSON builds a JSON string for a given object v. +func BuildJSON(v interface{}) ([]byte, error) { + var buf bytes.Buffer + + err := buildAny(reflect.ValueOf(v), &buf, "", false) + return buf.Bytes(), err +} + +func buildAny(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag, parentCollection bool) error { + origVal := value + value = reflect.Indirect(value) + if !value.IsValid() { + return nil + } + + vtype := value.Type() + + t := tag.Get("type") + if t == "" { + switch vtype.Kind() { + case reflect.Struct: + // also it can't be a time object + if value.Type() != timeType { + t = "structure" + } + case reflect.Slice: + // also it can't be a byte slice + if _, ok := value.Interface().([]byte); !ok { + t = "list" + } + case reflect.Map: + // cannot be a JSONValue map + if _, ok := value.Interface().(aws.JSONValue); !ok { + t = "map" + } + } + } + + switch t { + case "structure": + if field, ok := vtype.FieldByName("_"); ok { + tag = field.Tag + } + return buildStruct(value, buf, tag) + case "list": + return buildList(value, buf, tag) + case "map": + return buildMap(value, buf, tag) + default: + return buildScalar(origVal, buf, tag, parentCollection) + } +} + +func buildStruct(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { + if !value.IsValid() { + return nil + } + + // unwrap payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := value.Type().FieldByName(payload) + tag = field.Tag + value = elemOf(value.FieldByName(payload)) + + if !value.IsValid() { + return nil + } + } + + buf.WriteByte('{') + + t := value.Type() + first := true + for i := 0; i < t.NumField(); i++ { + member := value.Field(i) + + // This allocates the most memory. + // Additionally, we cannot skip nil fields due to + // idempotency auto filling. + field := t.Field(i) + + if field.PkgPath != "" { + continue // ignore unexported fields + } + if field.Tag.Get("json") == "-" { + continue + } + if field.Tag.Get("location") != "" { + continue // ignore non-body elements + } + if field.Tag.Get("ignore") != "" { + continue + } + + if protocol.CanSetIdempotencyToken(member, field) { + token := protocol.GetIdempotencyToken() + member = reflect.ValueOf(&token) + } + + if (member.Kind() == reflect.Ptr || member.Kind() == reflect.Slice || member.Kind() == reflect.Map) && member.IsNil() { + continue // ignore unset fields + } else if member.Kind() == reflect.String && member.Len() == 0 { + continue + } + + if first { + first = false + } else { + buf.WriteByte(',') + } + + // figure out what this field is called + name := field.Name + if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + + writeString(name, buf) + buf.WriteString(`:`) + + err := buildAny(member, buf, field.Tag, false) + if err != nil { + return err + } + + } + + buf.WriteString("}") + + return nil +} + +func buildList(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { + buf.WriteString("[") + + for i := 0; i < value.Len(); i++ { + elem := value.Index(i) + buildAny(elem, buf, "", true) + + if i < value.Len()-1 { + buf.WriteString(",") + } + } + + buf.WriteString("]") + + return nil +} + +type sortedValues []reflect.Value + +func (sv sortedValues) Len() int { return len(sv) } +func (sv sortedValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv sortedValues) Less(i, j int) bool { return sv[i].String() < sv[j].String() } + +func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error { + buf.WriteString("{") + + sv := sortedValues(value.MapKeys()) + sort.Sort(sv) + + for i, k := range sv { + if i > 0 { + buf.WriteByte(',') + } + + writeString(k.String(), buf) + buf.WriteString(`:`) + + buildAny(value.MapIndex(k), buf, "", true) + } + + buf.WriteString("}") + + return nil +} + +func buildScalar(v reflect.Value, buf *bytes.Buffer, tag reflect.StructTag, parentCollection bool) error { + // prevents allocation on the heap. + scratch := [64]byte{} + switch value := reflect.Indirect(v); value.Kind() { + case reflect.String: + str := value.String() + isEnum := len(tag.Get("enum")) != 0 + if parentCollection || (len(str) > 0 && isEnum) || !isEnum { + writeString(str, buf) + } + case reflect.Bool: + if value.Bool() { + buf.WriteString("true") + } else { + buf.WriteString("false") + } + case reflect.Int64: + buf.Write(strconv.AppendInt(scratch[:0], value.Int(), 10)) + case reflect.Float64: + f := value.Float() + if math.IsInf(f, 0) || math.IsNaN(f) { + return &json.UnsupportedValueError{Value: v, Str: strconv.FormatFloat(f, 'f', -1, 64)} + } + buf.Write(strconv.AppendFloat(scratch[:0], f, 'f', -1, 64)) + default: + switch converted := value.Interface().(type) { + case time.Time: + buf.Write(strconv.AppendInt(scratch[:0], converted.UTC().Unix(), 10)) + case []byte: + if !value.IsNil() { + buf.WriteByte('"') + if len(converted) < 1024 { + // for small buffers, using Encode directly is much faster. + dst := make([]byte, base64.StdEncoding.EncodedLen(len(converted))) + base64.StdEncoding.Encode(dst, converted) + buf.Write(dst) + } else { + // for large buffers, avoid unnecessary extra temporary + // buffer space. + enc := base64.NewEncoder(base64.StdEncoding, buf) + enc.Write(converted) + enc.Close() + } + buf.WriteByte('"') + } + case aws.JSONValue: + str, err := protocol.EncodeJSONValue(converted, protocol.QuotedEscape) + if err != nil { + return fmt.Errorf("unable to encode JSONValue, %v", err) + } + buf.WriteString(str) + default: + return fmt.Errorf("unsupported JSON value %v (%s)", value.Interface(), value.Type()) + } + } + return nil +} + +var hex = "0123456789abcdef" + +func writeString(s string, buf *bytes.Buffer) { + buf.WriteByte('"') + for i := 0; i < len(s); i++ { + if s[i] == '"' { + buf.WriteString(`\"`) + } else if s[i] == '\\' { + buf.WriteString(`\\`) + } else if s[i] == '\b' { + buf.WriteString(`\b`) + } else if s[i] == '\f' { + buf.WriteString(`\f`) + } else if s[i] == '\r' { + buf.WriteString(`\r`) + } else if s[i] == '\t' { + buf.WriteString(`\t`) + } else if s[i] == '\n' { + buf.WriteString(`\n`) + } else if s[i] < 32 { + buf.WriteString("\\u00") + buf.WriteByte(hex[s[i]>>4]) + buf.WriteByte(hex[s[i]&0xF]) + } else { + buf.WriteByte(s[i]) + } + } + buf.WriteByte('"') +} + +// Returns the reflection element of a value, if it is a pointer. +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/unmarshal.go new file mode 100644 index 000000000000..dce3a67b1c09 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil/unmarshal.go @@ -0,0 +1,242 @@ +package jsonutil + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "reflect" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// UnmarshalJSON reads a stream and unmarshals the results in object v. +func UnmarshalJSON(v interface{}, stream io.Reader) error { + var out interface{} + + b, err := ioutil.ReadAll(stream) + if err != nil { + return err + } + + if len(b) == 0 { + return nil + } + + if err := json.Unmarshal(b, &out); err != nil { + return err + } + + return unmarshalAny(reflect.ValueOf(v), out, "") +} + +func unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag) error { + vtype := value.Type() + if vtype.Kind() == reflect.Ptr { + vtype = vtype.Elem() // check kind of actual element type + } + + t := tag.Get("type") + if t == "" { + switch vtype.Kind() { + case reflect.Struct: + // also it can't be a time object + _, tok := value.Interface().(*time.Time) + if _, ok := value.Interface().(time.Time); !(ok || tok) { + t = "structure" + } + case reflect.Slice: + // also it can't be a byte slice + if _, ok := value.Interface().([]byte); !ok { + t = "list" + } + case reflect.Map: + // cannot be a JSONValue map + if _, ok := value.Interface().(aws.JSONValue); !ok { + t = "map" + } + } + } + + switch t { + case "structure": + if field, ok := vtype.FieldByName("_"); ok { + tag = field.Tag + } + return unmarshalStruct(value, data, tag) + case "list": + return unmarshalList(value, data, tag) + case "map": + return unmarshalMap(value, data, tag) + default: + return unmarshalScalar(value, data, tag) + } +} + +func unmarshalStruct(value reflect.Value, data interface{}, tag reflect.StructTag) error { + if data == nil { + return nil + } + + mapData, ok := data.(map[string]interface{}) + if !ok { + return fmt.Errorf("JSON value is not a structure (%#v)", data) + } + + t := value.Type() + if value.Kind() == reflect.Ptr { + if value.IsNil() { // create the structure if it's nil + s := reflect.New(value.Type().Elem()) + value.Set(s) + value = s + } + + value = value.Elem() + t = t.Elem() + } + + // unwrap any payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := t.FieldByName(payload) + return unmarshalAny(value.FieldByName(payload), data, field.Tag) + } + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + if field.PkgPath != "" { + continue // ignore unexported fields + } + + // figure out what this field is called + name := field.Name + if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + + member := value.FieldByIndex(field.Index) + err := unmarshalAny(member, mapData[name], field.Tag) + if err != nil { + return err + } + } + return nil +} + +func unmarshalList(value reflect.Value, data interface{}, tag reflect.StructTag) error { + if data == nil { + return nil + } + listData, ok := data.([]interface{}) + if !ok { + return fmt.Errorf("JSON value is not a list (%#v)", data) + } + + if value.IsNil() { + l := len(listData) + value.Set(reflect.MakeSlice(value.Type(), l, l)) + } + + for i, c := range listData { + err := unmarshalAny(value.Index(i), c, "") + if err != nil { + return err + } + } + + return nil +} + +func unmarshalMap(value reflect.Value, data interface{}, tag reflect.StructTag) error { + if data == nil { + return nil + } + mapData, ok := data.(map[string]interface{}) + if !ok { + return fmt.Errorf("JSON value is not a map (%#v)", data) + } + + if value.IsNil() { + value.Set(reflect.MakeMap(value.Type())) + } + + for k, v := range mapData { + kvalue := reflect.ValueOf(k) + vvalue := reflect.New(value.Type().Elem()).Elem() + unmarshalAny(vvalue, v, "") + value.SetMapIndex(kvalue, vvalue) + } + + return nil +} + +func unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTag) error { + errf := func() error { + return fmt.Errorf("unsupported value: %v (%s)", value.Interface(), value.Type()) + } + + switch d := data.(type) { + case nil: + return nil // nothing to do here + case string: + if value.Kind() == reflect.String { + value.SetString(d) + return nil + } + + switch value.Interface().(type) { + case *string: + value.Set(reflect.ValueOf(&d)) + case string: + value.Set(reflect.ValueOf(d)) + case []byte: + b, err := base64.StdEncoding.DecodeString(d) + if err != nil { + return err + } + value.Set(reflect.ValueOf(b)) + case aws.JSONValue: + // No need to use escaping as the value is a non-quoted string. + v, err := protocol.DecodeJSONValue(d, protocol.NoEscape) + if err != nil { + return err + } + value.Set(reflect.ValueOf(v)) + default: + return errf() + } + case float64: + switch value.Interface().(type) { + case *int64: + di := int64(d) + value.Set(reflect.ValueOf(&di)) + case int64: + di := int64(d) + value.Set(reflect.ValueOf(di)) + case *float64: + value.Set(reflect.ValueOf(&d)) + case float64: + value.Set(reflect.ValueOf(d)) + case *time.Time: + t := time.Unix(int64(d), 0).UTC() + value.Set(reflect.ValueOf(&t)) + case time.Time: + t := time.Unix(int64(d), 0).UTC() + value.Set(reflect.ValueOf(t)) + default: + return errf() + } + case bool: + switch value.Interface().(type) { + case *bool: + value.Set(reflect.ValueOf(&d)) + default: + return errf() + } + default: + return fmt.Errorf("unsupported JSON value (%v)", data) + } + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc/jsonrpc.go new file mode 100644 index 000000000000..d2d4f8290063 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc/jsonrpc.go @@ -0,0 +1,109 @@ +// Package jsonrpc provides JSON RPC utilities for serialization of AWS +// requests and responses. +package jsonrpc + +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/json.json build_test.go +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go + +import ( + "encoding/json" + "io/ioutil" + "strings" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" +) + +var emptyJSON = []byte("{}") + +// BuildHandler is a named request handler for building jsonrpc protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling jsonrpc protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.jsonrpc.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling jsonrpc protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling jsonrpc protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.jsonrpc.UnmarshalError", Fn: UnmarshalError} + +// Build builds a JSON payload for a JSON RPC request. +func Build(req *request.Request) { + var buf []byte + var err error + if req.ParamsFilled() { + buf, err = jsonutil.BuildJSON(req.Params) + if err != nil { + req.Error = awserr.New("SerializationError", "failed encoding JSON RPC request", err) + return + } + } else { + buf = emptyJSON + } + + if req.Metadata.TargetPrefix != "" || string(buf) != "{}" { + req.SetBufferBody(buf) + } + + if req.Metadata.TargetPrefix != "" { + target := req.Metadata.TargetPrefix + "." + req.Operation.Name + req.HTTPRequest.Header.Add("X-Amz-Target", target) + } + if req.Metadata.JSONVersion != "" { + jsonVersion := req.Metadata.JSONVersion + req.HTTPRequest.Header.Add("Content-Type", "application/x-amz-json-"+jsonVersion) + } +} + +// Unmarshal unmarshals a response for a JSON RPC service. +func Unmarshal(req *request.Request) { + defer req.HTTPResponse.Body.Close() + err := jsonutil.UnmarshalJSON(req.Data, req.HTTPResponse.Body) + if err != nil { + req.Error = awserr.New("SerializationError", "failed decoding JSON RPC response", err) + } + return +} + +// UnmarshalMeta unmarshals headers from a response for a JSON RPC service. +func UnmarshalMeta(req *request.Request) { + rest.UnmarshalMeta(req) +} + +// UnmarshalError unmarshals an error response for a JSON RPC service. +func UnmarshalError(req *request.Request) { + defer req.HTTPResponse.Body.Close() + bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) + if err != nil { + req.Error = awserr.New("SerializationError", "failed reading JSON RPC error response", err) + return + } + if len(bodyBytes) == 0 { + req.Error = awserr.NewRequestFailure( + awserr.New("SerializationError", req.HTTPResponse.Status, nil), + req.HTTPResponse.StatusCode, + "", + ) + return + } + var jsonErr jsonErrorResponse + if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { + req.Error = awserr.New("SerializationError", "failed decoding JSON RPC error response", err) + return + } + + codes := strings.SplitN(jsonErr.Code, "#", 2) + req.Error = awserr.NewRequestFailure( + awserr.New(codes[len(codes)-1], jsonErr.Message, nil), + req.HTTPResponse.StatusCode, + req.RequestID, + ) +} + +type jsonErrorResponse struct { + Code string `json:"__type"` + Message string `json:"message"` +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonvalue.go new file mode 100644 index 000000000000..8a270434d53d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/jsonvalue.go @@ -0,0 +1,76 @@ +package protocol + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "strconv" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// EscapeMode is the mode that should be use for escaping a value +type EscapeMode uint + +// The modes for escaping a value before it is marshaled, and unmarshaled. +const ( + NoEscape EscapeMode = iota + Base64Escape + QuotedEscape +) + +// EncodeJSONValue marshals the value into a JSON string, and optionally base64 +// encodes the string before returning it. +// +// Will panic if the escape mode is unknown. +func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) { + b, err := json.Marshal(v) + if err != nil { + return "", err + } + + switch escape { + case NoEscape: + return string(b), nil + case Base64Escape: + return base64.StdEncoding.EncodeToString(b), nil + case QuotedEscape: + return strconv.Quote(string(b)), nil + } + + panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape)) +} + +// DecodeJSONValue will attempt to decode the string input as a JSONValue. +// Optionally decoding base64 the value first before JSON unmarshaling. +// +// Will panic if the escape mode is unknown. +func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) { + var b []byte + var err error + + switch escape { + case NoEscape: + b = []byte(v) + case Base64Escape: + b, err = base64.StdEncoding.DecodeString(v) + case QuotedEscape: + var u string + u, err = strconv.Unquote(v) + b = []byte(u) + default: + panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape)) + } + + if err != nil { + return nil, err + } + + m := aws.JSONValue{} + err = json.Unmarshal(b, &m) + if err != nil { + return nil, err + } + + return m, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/metadata.go new file mode 100644 index 000000000000..3a94fd02f0fb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/metadata.go @@ -0,0 +1,24 @@ +package protocol + +// An Attribute is a FieldValue that resides within the imediant context of +// another field. Such as XML attribute for tags. +type Attribute struct { + Name string + Value ValueMarshaler + Meta Metadata +} + +// Metadata is a collection of configuration flags for encoders to render the +// output. +type Metadata struct { + Attributes []Attribute + + Flatten bool + + ListLocationName string + MapLocationNameKey string + MapLocationNameValue string + + XMLNamespacePrefix string + XMLNamespaceURI string +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/path_replace.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/path_replace.go new file mode 100644 index 000000000000..ae64a17dbf84 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/path_replace.go @@ -0,0 +1,136 @@ +package protocol + +import ( + "bytes" + "fmt" +) + +const ( + uriTokenStart = '{' + uriTokenStop = '}' + uriTokenSkip = '+' +) + +func bufCap(b []byte, n int) []byte { + if cap(b) < n { + return make([]byte, 0, n) + } + + return b[0:0] +} + +// PathReplace replaces path elements using field buffers +type PathReplace struct { + // May mutate path slice + path []byte + rawPath []byte + fieldBuf []byte +} + +// NewPathReplace creats a built PathReplace value that can be used to replace +// path elements. +func NewPathReplace(path string) PathReplace { + return PathReplace{ + path: []byte(path), + rawPath: []byte(path), + } +} + +// Encode returns an unescaped path, and escaped path. +func (r *PathReplace) Encode() (path string, rawPath string) { + return string(r.path), string(r.rawPath) +} + +// ReplaceElement replaces a single element in the path string. +func (r *PathReplace) ReplaceElement(key, val string) (err error) { + r.path, r.fieldBuf, err = replacePathElement(r.path, r.fieldBuf, key, val, false) + r.rawPath, r.fieldBuf, err = replacePathElement(r.rawPath, r.fieldBuf, key, val, true) + return err +} + +func replacePathElement(path, fieldBuf []byte, key, val string, escape bool) ([]byte, []byte, error) { + fieldBuf = bufCap(fieldBuf, len(key)+3) // { [+] } + fieldBuf = append(fieldBuf, uriTokenStart) + fieldBuf = append(fieldBuf, key...) + + start := bytes.Index(path, fieldBuf) + end := start + len(fieldBuf) + if start < 0 || len(path[end:]) == 0 { + // TODO what to do about error? + return path, fieldBuf, fmt.Errorf("invalid path index, start=%d,end=%d. %s", start, end, path) + } + + encodeSep := true + if path[end] == uriTokenSkip { + // '+' token means do not escape slashes + encodeSep = false + end++ + } + + if escape { + val = escapePath(val, encodeSep) + } + + if path[end] != uriTokenStop { + return path, fieldBuf, fmt.Errorf("invalid path element, does not contain token stop, %s", path) + } + end++ + + fieldBuf = bufCap(fieldBuf, len(val)) + fieldBuf = append(fieldBuf, val...) + + keyLen := end - start + valLen := len(fieldBuf) + + if keyLen == valLen { + copy(path[start:], fieldBuf) + return path, fieldBuf, nil + } + + newLen := len(path) + (valLen - keyLen) + if len(path) < newLen { + path = path[:cap(path)] + } + if cap(path) < newLen { + newURI := make([]byte, newLen) + copy(newURI, path) + path = newURI + } + + // shift + copy(path[start+valLen:], path[end:]) + path = path[:newLen] + copy(path[start:], fieldBuf) + + return path, fieldBuf, nil +} + +// copied from rest.EscapePath +// escapes part of a URL path in Amazon style +func escapePath(path string, encodeSep bool) string { + var buf bytes.Buffer + for i := 0; i < len(path); i++ { + c := path[i] + if noEscape[c] || (c == '/' && !encodeSep) { + buf.WriteByte(c) + } else { + fmt.Fprintf(&buf, "%%%02X", c) + } + } + return buf.String() +} + +var noEscape [256]bool + +func init() { + for i := 0; i < len(noEscape); i++ { + // AWS expects every character except these to be escaped + noEscape[i] = (i >= 'A' && i <= 'Z') || + (i >= 'a' && i <= 'z') || + (i >= '0' && i <= '9') || + i == '-' || + i == '.' || + i == '_' || + i == '~' + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/build.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/build.go new file mode 100644 index 000000000000..3905c4bc6f59 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/build.go @@ -0,0 +1,36 @@ +// Package query provides serialization of AWS query requests, and responses. +package query + +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go + +import ( + "net/url" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol/query/queryutil" +) + +// BuildHandler is a named request handler for building query protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.query.Build", Fn: Build} + +// Build builds a request for an AWS Query service. +func Build(r *request.Request) { + body := url.Values{ + "Action": {r.Operation.Name}, + "Version": {r.Metadata.APIVersion}, + } + if err := queryutil.Parse(body, r.Params, false); err != nil { + r.Error = awserr.New("SerializationError", "failed encoding Query request", err) + return + } + + if r.ExpireTime == 0 { + r.HTTPRequest.Method = "POST" + r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8") + r.SetBufferBody([]byte(body.Encode())) + } else { // This is a pre-signed request + r.HTTPRequest.Method = "GET" + r.HTTPRequest.URL.RawQuery = body.Encode() + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/queryutil/queryutil.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/queryutil/queryutil.go new file mode 100644 index 000000000000..01de5ca945b9 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/queryutil/queryutil.go @@ -0,0 +1,261 @@ +package queryutil + +import ( + "encoding/base64" + "fmt" + "net/url" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// Parse parses an object i and fills a url.Values object. The isEC2 flag +// indicates if this is the EC2 Query sub-protocol. +func Parse(body url.Values, i interface{}, isEC2 bool) error { + q := queryParser{isEC2: isEC2} + return q.parseValue(body, reflect.ValueOf(i), "", "", false) +} + +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +type queryParser struct { + isEC2 bool +} + +func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag, parentCollection bool) error { + value = elemOf(value) + + // no need to handle zero values + if !value.IsValid() { + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + var err error + switch t { + case "structure": + err = q.parseStruct(v, value, prefix) + case "list": + err = q.parseList(v, value, prefix, tag) + case "map": + err = q.parseMap(v, value, prefix, tag) + default: + err = q.parseScalar(v, value, prefix, tag, parentCollection) + } + + if protocol.IsNotSetError(err) { + return nil + } + return err +} + +func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { + if !value.IsValid() { + return nil + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + elemValue := elemOf(value.Field(i)) + field := t.Field(i) + + if field.PkgPath != "" { + continue // ignore unexported fields + } + if field.Tag.Get("ignore") != "" { + continue + } + + if protocol.CanSetIdempotencyToken(value.Field(i), field) { + token := protocol.GetIdempotencyToken() + elemValue = reflect.ValueOf(token) + } + + var name string + if q.isEC2 { + name = field.Tag.Get("queryName") + } + if name == "" { + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + if name != "" && q.isEC2 { + name = strings.ToUpper(name[0:1]) + name[1:] + } + } + if name == "" { + name = field.Name + } + + if prefix != "" { + name = prefix + "." + name + } + + if err := q.parseValue(v, elemValue, name, field.Tag, false); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + if _, ok := value.Interface().([]byte); ok { + return q.parseScalar(v, value, prefix, tag, true) + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + if listName := tag.Get("locationNameList"); listName == "" { + prefix += ".member" + } else { + prefix += "." + listName + } + } + + for i := 0; i < value.Len(); i++ { + slicePrefix := prefix + if slicePrefix == "" { + slicePrefix = strconv.Itoa(i + 1) + } else { + slicePrefix = slicePrefix + "." + strconv.Itoa(i+1) + } + if err := q.parseValue(v, value.Index(i), slicePrefix, "", true); err != nil { + return err + } + } + return nil +} + +func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { + // If it's empty, generate an empty value + if !value.IsNil() && value.Len() == 0 { + v.Set(prefix, "") + return nil + } + + // check for unflattened list member + if !q.isEC2 && tag.Get("flattened") == "" { + prefix += ".entry" + } + + // sort keys for improved serialization consistency. + // this is not strictly necessary for protocol support. + mapKeyValues := value.MapKeys() + mapKeys := map[string]reflect.Value{} + mapKeyNames := make([]string, len(mapKeyValues)) + for i, mapKey := range mapKeyValues { + name := mapKey.String() + mapKeys[name] = mapKey + mapKeyNames[i] = name + } + sort.Strings(mapKeyNames) + + for i, mapKeyName := range mapKeyNames { + mapKey := mapKeys[mapKeyName] + mapValue := value.MapIndex(mapKey) + + kname := tag.Get("locationNameKey") + if kname == "" { + kname = "key" + } + vname := tag.Get("locationNameValue") + if vname == "" { + vname = "value" + } + + // serialize key + var keyName string + if prefix == "" { + keyName = strconv.Itoa(i+1) + "." + kname + } else { + keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname + } + + if err := q.parseValue(v, mapKey, keyName, "", true); err != nil { + return err + } + + // serialize value + var valueName string + if prefix == "" { + valueName = strconv.Itoa(i+1) + "." + vname + } else { + valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname + } + + if err := q.parseValue(v, mapValue, valueName, "", true); err != nil { + return err + } + } + + return nil +} + +func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag, parentCollection bool) error { + if r.Kind() == reflect.String { + val, err := protocol.GetValue(r) + isEnum := len(tag.Get("enum")) != 0 + + if err == nil || parentCollection { + v.Set(name, val) + } else if isEnum && len(val) > 0 { + v.Set(name, val) + } else if !isEnum { + v.Set(name, val) + } + return err + } + + switch value := r.Interface().(type) { + case string: + v.Set(name, value) + case []byte: + if !r.IsNil() { + v.Set(name, base64.StdEncoding.EncodeToString(value)) + } + case bool: + v.Set(name, strconv.FormatBool(value)) + case int64: + v.Set(name, strconv.FormatInt(value, 10)) + case int: + v.Set(name, strconv.Itoa(value)) + case float64: + v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) + case float32: + v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + v.Set(name, value.UTC().Format(ISO8601UTC)) + default: + return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) + } + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal.go new file mode 100644 index 000000000000..36c0e12e47cb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal.go @@ -0,0 +1,33 @@ +package query + +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go + +import ( + "encoding/xml" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil" +) + +// UnmarshalHandler is a named request handler for unmarshaling query protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.query.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling query protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalMeta", Fn: UnmarshalMeta} + +// Unmarshal unmarshals a response for an AWS Query service. +func Unmarshal(r *request.Request) { + defer r.HTTPResponse.Body.Close() + decoder := xml.NewDecoder(r.HTTPResponse.Body) + err := xmlutil.UnmarshalXML(r.Data, decoder, r.Operation.Name+"Result") + if err != nil { + r.Error = awserr.New("SerializationError", "failed decoding Query response", err) + return + } +} + +// UnmarshalMeta unmarshals header response values for an AWS Query service. +func UnmarshalMeta(r *request.Request) { + r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal_error.go new file mode 100644 index 000000000000..2af00c32675f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query/unmarshal_error.go @@ -0,0 +1,66 @@ +package query + +import ( + "encoding/xml" + "io/ioutil" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +type xmlErrorResponse struct { + XMLName xml.Name `xml:"ErrorResponse"` + Code string `xml:"Error>Code"` + Message string `xml:"Error>Message"` + RequestID string `xml:"RequestId"` +} + +type xmlServiceUnavailableResponse struct { + XMLName xml.Name `xml:"ServiceUnavailableException"` +} + +// UnmarshalErrorHandler is a name request handler to unmarshal request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError} + +// UnmarshalError unmarshals an error response for an AWS Query service. +func UnmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + + bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to read from query HTTP response body", err) + return + } + + // First check for specific error + resp := xmlErrorResponse{} + decodeErr := xml.Unmarshal(bodyBytes, &resp) + if decodeErr == nil { + reqID := resp.RequestID + if reqID == "" { + reqID = r.RequestID + } + r.Error = awserr.NewRequestFailure( + awserr.New(resp.Code, resp.Message, nil), + r.HTTPResponse.StatusCode, + reqID, + ) + return + } + + // Check for unhandled error + servUnavailResp := xmlServiceUnavailableResponse{} + unavailErr := xml.Unmarshal(bodyBytes, &servUnavailResp) + if unavailErr == nil { + r.Error = awserr.NewRequestFailure( + awserr.New("ServiceUnavailableException", "service is unavailable", nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) + return + } + + // Failed to retrieve any error message from the response body + r.Error = awserr.New("SerializationError", + "failed to decode query XML error response", decodeErr) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query_encoder.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query_encoder.go new file mode 100644 index 000000000000..baebc99442c2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/query_encoder.go @@ -0,0 +1,105 @@ +package protocol + +import ( + "fmt" + "net/url" +) + +// QueryMapEncoder builds a query string. +type QueryMapEncoder struct { + Prefix string + Query url.Values + Err error +} + +// List will return a new QueryListEncoder. +func (e *QueryMapEncoder) List(k string) ListEncoder { + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + return &QueryListEncoder{k, e.Query, nil} +} + +// Map will return a new QueryMapEncoder. +func (e *QueryMapEncoder) Map(k string) MapEncoder { + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + return &QueryMapEncoder{k, e.Query, nil} +} + +// Start does nothing. +func (e *QueryMapEncoder) Start() {} + +// End does nothing. +func (e *QueryMapEncoder) End() {} + +// MapSetValue adds a single value to the query. +func (e *QueryMapEncoder) MapSetValue(k string, v ValueMarshaler) { + if e.Err != nil { + return + } + + str, err := v.MarshalValue() + if err != nil { + e.Err = err + return + } + + if len(e.Prefix) > 0 { + k = e.Prefix + k + } + + e.Query.Add(k, str) +} + +// MapSetFields Is not implemented, query map of map is undefined. +func (e *QueryMapEncoder) MapSetFields(k string, m FieldMarshaler) { + e.Err = fmt.Errorf("query map encoder MapSetFields not supported, %s", e.Prefix) +} + +// QueryListEncoder will encode list values nested into a query key. +type QueryListEncoder struct { + Key string + Query url.Values + Err error +} + +// List will return a new QueryListEncoder. +func (e *QueryListEncoder) List() ListEncoder { + return &QueryListEncoder{e.Key, e.Query, nil} +} + +// Start does nothing for the query protocol. +func (e *QueryListEncoder) Start() {} + +// End does nothing for the query protocol. +func (e *QueryListEncoder) End() {} + +// Map will return a new QueryMapEncoder. +func (e *QueryListEncoder) Map() MapEncoder { + k := e.Key + return &QueryMapEncoder{k, e.Query, nil} +} + +// ListAddValue encodes an individual list value into the querystring. +func (e *QueryListEncoder) ListAddValue(v ValueMarshaler) { + if e.Err != nil { + return + } + + str, err := v.MarshalValue() + if err != nil { + e.Err = err + return + } + + e.Query.Add(e.Key, str) +} + +// ListAddFields Is not implemented, query list of FieldMarshaler is undefined. +func (e *QueryListEncoder) ListAddFields(m FieldMarshaler) { + e.Err = fmt.Errorf("query list encoder ListAddFields not supported, %s", e.Key) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/build.go new file mode 100644 index 000000000000..14c9f474ece8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/build.go @@ -0,0 +1,339 @@ +// Package rest provides RESTful serialization of AWS requests and responses. +package rest + +import ( + "bytes" + "encoding/base64" + "fmt" + "io" + "net/http" + "net/url" + "path" + "reflect" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// RFC822 returns an RFC822 formatted timestamp for AWS protocols +const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT" + +// Whether the byte value can be sent without escaping in AWS URLs +var noEscape [256]bool + +func init() { + for i := 0; i < len(noEscape); i++ { + // AWS expects every character except these to be escaped + noEscape[i] = (i >= 'A' && i <= 'Z') || + (i >= 'a' && i <= 'z') || + (i >= '0' && i <= '9') || + i == '-' || + i == '.' || + i == '_' || + i == '~' + } +} + +// BuildHandler is a named request handler for building rest protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.rest.Build", Fn: Build} + +// Build builds the REST component of a service request. +func Build(r *request.Request) { + if r.ParamsFilled() { + v := reflect.ValueOf(r.Params).Elem() + buildLocationElements(r, v, false) + buildBody(r, v) + } +} + +// BuildAsGET builds the REST component of a service request with the ability to hoist +// data from the body. +func BuildAsGET(r *request.Request) { + if r.ParamsFilled() { + v := reflect.ValueOf(r.Params).Elem() + buildLocationElements(r, v, true) + buildBody(r, v) + } +} + +func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bool) { + query := r.HTTPRequest.URL.Query() + + // Setup the raw path to match the base path pattern. This is needed + // so that when the path is mutated a custom escaped version can be + // stored in RawPath that will be used by the Go client. + r.HTTPRequest.URL.RawPath = r.HTTPRequest.URL.Path + + for i := 0; i < v.NumField(); i++ { + m := v.Field(i) + if n := v.Type().Field(i).Name; n[0:1] == strings.ToLower(n[0:1]) { + continue + } + + if m.IsValid() { + field := v.Type().Field(i) + name := field.Tag.Get("locationName") + if name == "" { + name = field.Name + } + + switch m.Kind() { + case reflect.Ptr, reflect.Interface: + if !m.Elem().IsValid() { + continue + } + } + + if field.Tag.Get("ignore") != "" { + continue + } + + var err error + switch field.Tag.Get("location") { + case "headers": // header maps + err = buildHeaderMap(&r.HTTPRequest.Header, m, field.Tag) + case "header": + err = buildHeader(&r.HTTPRequest.Header, m, name, field.Tag) + case "uri": + err = buildURI(r.HTTPRequest.URL, m, name, field.Tag) + case "querystring": + err = buildQueryString(query, m, name, field.Tag) + default: + if buildGETQuery { + err = buildQueryString(query, m, name, field.Tag) + } + } + + if protocol.IsNotSetError(err) { + err = nil + } + r.Error = err + } + if r.Error != nil { + return + } + } + + r.HTTPRequest.URL.RawQuery = query.Encode() + if !r.Config.DisableRestProtocolURICleaning { + cleanPath(r.HTTPRequest.URL) + } +} + +func buildBody(r *request.Request, v reflect.Value) { + if field, ok := v.Type().FieldByName("_"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + pfield, _ := v.Type().FieldByName(payloadName) + if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { + payload := reflect.Indirect(v.FieldByName(payloadName)) + if payload.IsValid() && payload.Interface() != nil { + switch reader := payload.Interface().(type) { + case io.ReadSeeker: + r.SetReaderBody(reader) + case []byte: + r.SetBufferBody(reader) + case string: + r.SetStringBody(reader) + default: + r.Error = awserr.New("SerializationError", + "failed to encode REST request", + fmt.Errorf("unknown payload type %s", payload.Type())) + } + } + } + } + } +} + +func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect.StructTag) error { + var err error + str := "" + + if v.Kind() == reflect.String { + str, err = protocol.GetValue(v) + } else { + str, err = convertType(v, tag) + } + + if protocol.IsNotSetError(err) { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + + header.Add(name, str) + + return nil +} + +func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) error { + prefix := tag.Get("locationName") + for _, key := range v.MapKeys() { + str, err := convertType(v.MapIndex(key), tag) + if protocol.IsNotSetError(err) { + continue + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + + } + + header.Add(prefix+key.String(), str) + } + return nil +} + +func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) error { + value := "" + var err error + if v.Kind() == reflect.String { + value, err = protocol.GetValue(v) + } else { + value, err = convertType(v, tag) + } + + if protocol.IsNotSetError(err) { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + + u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) + u.Path = strings.Replace(u.Path, "{"+name+"+}", value, -1) + + u.RawPath = strings.Replace(u.RawPath, "{"+name+"}", EscapePath(value, true), -1) + u.RawPath = strings.Replace(u.RawPath, "{"+name+"+}", EscapePath(value, false), -1) + + return nil +} + +func buildQueryString(query url.Values, v reflect.Value, name string, tag reflect.StructTag) error { + if kind := v.Kind(); kind == reflect.String { + value, err := protocol.GetValue(v) + if err == nil { + query.Add(name, value) + } + return err + } else if kind == reflect.Ptr { + v = v.Elem() + } + + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.String { + for i := 0; i < v.Len(); i++ { + query.Add(name, v.Index(i).String()) + } + return nil + } + + switch value := v.Interface().(type) { + case []*string: + for _, item := range value { + query.Add(name, *item) + } + case []string: + for _, item := range value { + query.Add(name, item) + } + case map[string]*string: + for key, item := range value { + query.Add(key, *item) + } + case map[string]string: + for key, item := range value { + query.Add(key, item) + } + case map[string][]*string: + for key, items := range value { + for _, item := range items { + query.Add(key, *item) + } + } + case map[string][]string: + for key, items := range value { + for _, item := range items { + query.Add(key, item) + } + } + default: + str, err := convertType(v, tag) + if protocol.IsNotSetError(err) { + return nil + } else if err != nil { + return awserr.New("SerializationError", "failed to encode REST request", err) + } + + query.Set(name, str) + } + + return nil +} + +func cleanPath(u *url.URL) { + hasSlash := strings.HasSuffix(u.Path, "/") + + // clean up path, removing duplicate `/` + u.Path = path.Clean(u.Path) + u.RawPath = path.Clean(u.RawPath) + + if hasSlash && !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + u.RawPath += "/" + } +} + +// EscapePath escapes part of a URL path in Amazon style +func EscapePath(path string, encodeSep bool) string { + var buf bytes.Buffer + for i := 0; i < len(path); i++ { + c := path[i] + if noEscape[c] || (c == '/' && !encodeSep) { + buf.WriteByte(c) + } else { + fmt.Fprintf(&buf, "%%%02X", c) + } + } + return buf.String() +} + +func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error) { + v = reflect.Indirect(v) + if !v.IsValid() { + return "", &protocol.ErrValueNotSet{} + } + + switch value := v.Interface().(type) { + case string: + str = value + case []byte: + str = base64.StdEncoding.EncodeToString(value) + case bool: + str = strconv.FormatBool(value) + case int64: + str = strconv.FormatInt(value, 10) + case float64: + str = strconv.FormatFloat(value, 'f', -1, 64) + case time.Time: + str = value.UTC().Format(RFC822) + case aws.JSONValue: + if len(value) == 0 { + return "", &protocol.ErrValueNotSet{} + } + escaping := protocol.NoEscape + if tag.Get("location") == "header" { + escaping = protocol.Base64Escape + } + str, err = protocol.EncodeJSONValue(value, escaping) + if err != nil { + return "", fmt.Errorf("unable to encode JSONValue, %v", err) + } + + default: + err := fmt.Errorf("unsupported value for param %v (%s)", v.Interface(), v.Type()) + return "", err + } + return str, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/encode.go new file mode 100644 index 000000000000..ff1ce9493dd5 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/encode.go @@ -0,0 +1,144 @@ +package rest + +import ( + "fmt" + "io" + "net/http" + "net/url" + + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// An Encoder provides encoding of REST URI path, query, and header components +// of an HTTP request. Can also encode a stream as the payload. +// +// Does not support SetFields. +type Encoder struct { + req *http.Request + + path protocol.PathReplace + + query url.Values + header http.Header + + payload io.ReadSeeker + + err error +} + +// NewEncoder creates a new encoder from the passed in request. All query and +// header values will be added on top of the request's existing values. Overwriting +// duplicate values. +func NewEncoder(req *http.Request) *Encoder { + e := &Encoder{ + req: req, + + path: protocol.NewPathReplace(req.URL.Path), + query: req.URL.Query(), + header: req.Header, + } + + return e +} + +// Encode will return the request and body if one was set. If the body +// payload was not set the io.ReadSeeker will be nil. +// +// returns any error if one occured while encoding the API's parameters. +func (e *Encoder) Encode() (*http.Request, io.ReadSeeker, error) { + if e.err != nil { + return nil, nil, e.err + } + + e.req.URL.Path, e.req.URL.RawPath = e.path.Encode() + e.req.URL.RawQuery = e.query.Encode() + e.req.Header = e.header + + return e.req, e.payload, nil +} + +// SetValue will set a value to the header, path, query. +// +// If the request's method is GET all BodyTarget values will be written to +// the query string. +func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + var str string + str, e.err = v.MarshalValue() + if e.err != nil { + return + } + + switch t { + case protocol.HeaderTarget: + e.header.Set(k, str) + case protocol.PathTarget: + e.path.ReplaceElement(k, str) + case protocol.QueryTarget: + e.query.Set(k, str) + case protocol.BodyTarget: + if e.req.Method != "GET" { + e.err = fmt.Errorf("body target not supported for rest non-GET methods %s, %s", t, k) + return + } + e.query.Set(k, str) + default: + e.err = fmt.Errorf("unknown SetValue rest encode target, %s, %s", t, k) + } +} + +// SetStream will set the stream to the payload of the request. +func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PayloadTarget: + e.payload, e.err = v.MarshalStream() + default: + e.err = fmt.Errorf("unknown SetStream rest encode target, %s, %s", t, k) + } +} + +// List will set the nested list values to the header or query. +func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder { + if e.err != nil { + return nil + } + + switch t { + case protocol.QueryTarget: + return &protocol.QueryListEncoder{Key: k, Query: e.query} + case protocol.HeaderTarget: + return &protocol.HeaderListEncoder{Key: k, Header: e.header} + default: + e.err = fmt.Errorf("unknown SetList rest encode target, %s, %s", t, k) + return nil + } +} + +// Map will set the nested map values to the header or query. +func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder { + if e.err != nil { + return nil + } + + switch t { + case protocol.QueryTarget: + return &protocol.QueryMapEncoder{Query: e.query} + case protocol.HeadersTarget: + return &protocol.HeaderMapEncoder{Prefix: k, Header: e.header} + default: + e.err = fmt.Errorf("unknown SetMap rest encode target, %s, %s", t, k) + return nil + } +} + +// SetFields is not supported for REST encoder. +func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata) { + e.err = fmt.Errorf("rest encoder SetFields not supported, %s, %s", t, k) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/payload.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/payload.go new file mode 100644 index 000000000000..4366de2e1e8f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/payload.go @@ -0,0 +1,45 @@ +package rest + +import "reflect" + +// PayloadMember returns the payload field member of i if there is one, or nil. +func PayloadMember(i interface{}) interface{} { + if i == nil { + return nil + } + + v := reflect.ValueOf(i).Elem() + if !v.IsValid() { + return nil + } + if field, ok := v.Type().FieldByName("_"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + field, _ := v.Type().FieldByName(payloadName) + if field.Tag.Get("type") != "structure" { + return nil + } + + payload := v.FieldByName(payloadName) + if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { + return payload.Interface() + } + } + } + return nil +} + +// PayloadType returns the type of a payload field member of i if there is one, or "". +func PayloadType(i interface{}) string { + v := reflect.Indirect(reflect.ValueOf(i)) + if !v.IsValid() { + return "" + } + if field, ok := v.Type().FieldByName("_"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + if member, ok := v.Type().FieldByName(payloadName); ok { + return member.Tag.Get("type") + } + } + } + return "" +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/unmarshal.go new file mode 100644 index 000000000000..a9f141546453 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/rest/unmarshal.go @@ -0,0 +1,251 @@ +package rest + +import ( + "bytes" + "encoding/base64" + "fmt" + "io" + "io/ioutil" + "net/http" + "reflect" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.rest.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling rest protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.rest.UnmarshalMeta", Fn: UnmarshalMeta} + +// Unmarshal unmarshals the REST component of a response in a REST service. +func Unmarshal(r *request.Request) { + v := reflect.Indirect(reflect.ValueOf(r.Data)) + unmarshalBody(r, v) +} + +// UnmarshalMeta unmarshals the REST metadata of a response in a REST service +func UnmarshalMeta(r *request.Request) { + r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid") + if r.RequestID == "" { + // Alternative version of request id in the header + r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id") + } + v := reflect.Indirect(reflect.ValueOf(r.Data)) + unmarshalLocationElements(r, v) +} + +func unmarshalBody(r *request.Request, v reflect.Value) { + if field, ok := v.Type().FieldByName("_"); ok { + if payloadName := field.Tag.Get("payload"); payloadName != "" { + pfield, _ := v.Type().FieldByName(payloadName) + if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { + payload := v.FieldByName(payloadName) + if payload.IsValid() { + switch payload.Interface().(type) { + case []byte: + defer r.HTTPResponse.Body.Close() + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + } else { + payload.Set(reflect.ValueOf(b)) + } + case *string: + defer r.HTTPResponse.Body.Close() + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + } else { + str := string(b) + payload.Set(reflect.ValueOf(&str)) + } + default: + switch payload.Type().String() { + case "io.ReadCloser": + payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) + case "io.ReadSeeker": + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", + "failed to read response body", err) + return + } + payload.Set(reflect.ValueOf(ioutil.NopCloser(bytes.NewReader(b)))) + default: + io.Copy(ioutil.Discard, r.HTTPResponse.Body) + defer r.HTTPResponse.Body.Close() + r.Error = awserr.New("SerializationError", + "failed to decode REST response", + fmt.Errorf("unknown payload type %s", payload.Type())) + } + } + } + } + } + } +} + +func unmarshalLocationElements(r *request.Request, v reflect.Value) { + for i := 0; i < v.NumField(); i++ { + m, field := v.Field(i), v.Type().Field(i) + if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) { + continue + } + + if m.IsValid() { + name := field.Tag.Get("locationName") + if name == "" { + name = field.Name + } + + switch field.Tag.Get("location") { + case "statusCode": + unmarshalStatusCode(m, r.HTTPResponse.StatusCode) + case "header": + err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name), field.Tag) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + break + } + case "headers": + prefix := field.Tag.Get("locationName") + err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST response", err) + break + } + } + } + if r.Error != nil { + return + } + } +} + +func unmarshalStatusCode(v reflect.Value, statusCode int) { + if !v.IsValid() { + return + } + + switch v.Interface().(type) { + case *int64: + s := int64(statusCode) + v.Set(reflect.ValueOf(&s)) + case int64: + s := int64(statusCode) + v.Set(reflect.ValueOf(s)) + } +} + +func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error { + switch r.Interface().(type) { + case map[string]string: // we only support string map value types + out := map[string]string{} + for k, v := range headers { + k = http.CanonicalHeaderKey(k) + if strings.HasPrefix(strings.ToLower(k), strings.ToLower(prefix)) { + out[k[len(prefix):]] = v[0] + } + } + r.Set(reflect.ValueOf(out)) + } + return nil +} + +func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) error { + isJSONValue := tag.Get("type") == "jsonvalue" + if isJSONValue { + if len(header) == 0 { + return nil + } + } else if v.Kind() == reflect.String { + if len(header) > 0 { + v.SetString(header) + } + return nil + } else if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { + return nil + } + + switch v.Interface().(type) { + case *string: + v.Set(reflect.ValueOf(&header)) + case string: + v.Set(reflect.ValueOf(header)) + case []byte: + b, err := base64.StdEncoding.DecodeString(header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&b)) + case *bool: + b, err := strconv.ParseBool(header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&b)) + case bool: + b, err := strconv.ParseBool(header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(b)) + case *int64: + i, err := strconv.ParseInt(header, 10, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&i)) + case int64: + i, err := strconv.ParseInt(header, 10, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(i)) + case *float64: + f, err := strconv.ParseFloat(header, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&f)) + case float64: + f, err := strconv.ParseFloat(header, 64) + if err != nil { + return err + } + v.Set(reflect.ValueOf(f)) + case *time.Time: + t, err := time.Parse(RFC822, header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(&t)) + case time.Time: + t, err := time.Parse(RFC822, header) + if err != nil { + return err + } + v.Set(reflect.ValueOf(t)) + case aws.JSONValue: + escaping := protocol.NoEscape + if tag.Get("location") == "header" { + escaping = protocol.Base64Escape + } + m, err := protocol.DecodeJSONValue(header, escaping) + if err != nil { + return err + } + v.Set(reflect.ValueOf(m)) + default: + err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) + return err + } + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/encode.go new file mode 100644 index 000000000000..84c6dc8097e4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/encode.go @@ -0,0 +1,165 @@ +package restjson + +import ( + "fmt" + "io" + "net/http" + + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/json" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" +) + +// An Encoder provides encoding of the AWS RESTJSON protocol. This encoder combindes +// the JSON and REST encoders deligating to them for their associated targets. +// +// It is invalid to set a JSON and stream payload on the same encoder. +type Encoder struct { + method string + reqEncoder *rest.Encoder + bodyEncoder *json.Encoder + t protocol.Target + + err error +} + +// NewEncoder creates a new encoder for encoding the AWS RESTJSON protocol. +// The request passed in will be the base the path, query, and headers encoded +// will be set on top of. +func NewEncoder(req *http.Request) *Encoder { + e := &Encoder{ + method: req.Method, + reqEncoder: rest.NewEncoder(req), + bodyEncoder: json.NewEncoder(), + } + + return e +} + +// Encode returns the encoded request, and body payload. If no payload body was +// set nil will be returned. If an error occurred while encoding the API an +// error will be returned. +func (e *Encoder) Encode() (*http.Request, io.ReadSeeker, error) { + req, payloadBody, err := e.reqEncoder.Encode() + if err != nil { + return nil, nil, err + } + + jsonBody, err := e.bodyEncoder.Encode() + if err != nil { + return nil, nil, err + } + + havePayload := payloadBody != nil + haveJSON := jsonBody != nil + + if havePayload == haveJSON && haveJSON { + return nil, nil, fmt.Errorf("unexpected JSON body and request payload for AWSMarshaler") + } + + body := payloadBody + if body == nil { + body = jsonBody + } + + return req, body, err +} + +// SetValue will set a value to the header, path, query, or body. +// +// If the request's method is GET all BodyTarget values will be written to +// the query string. +func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PathTarget: + fallthrough + case protocol.QueryTarget: + fallthrough + case protocol.HeaderTarget: + e.reqEncoder.SetValue(t, k, v, meta) + case protocol.BodyTarget: + fallthrough + case protocol.PayloadTarget: + if e.method == "GET" { + e.reqEncoder.SetValue(t, k, v, meta) + } else { + e.bodyEncoder.SetValue(t, k, v, meta) + } + default: + e.err = fmt.Errorf("unknown SetValue restjson encode target, %s, %s", t, k) + } +} + +// SetStream will set the stream to the payload of the request. +func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PayloadTarget: + e.reqEncoder.SetStream(t, k, v, meta) + default: + e.err = fmt.Errorf("invalid target %s, for SetStream, must be PayloadTarget", t) + } +} + +// List will return the proper list encoder based on the given protocol.Target. +func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder { + if e.err != nil { + return nil + } + e.t = t + + switch t { + case protocol.HeaderTarget: + fallthrough + case protocol.QueryTarget: + return e.reqEncoder.List(t, k, meta) + case protocol.BodyTarget: + return e.bodyEncoder.List(t, k, meta) + default: + e.err = fmt.Errorf("unknown SetList restjson encode target, %s, %s", t, k) + return nil + } +} + +// Map will return the proper map encoder based on the given protocol Target. +func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder { + if e.err != nil { + return nil + } + + e.t = t + switch t { + case protocol.QueryTarget: + fallthrough + case protocol.HeadersTarget: + return e.reqEncoder.Map(t, k, meta) + case protocol.BodyTarget: + return e.bodyEncoder.Map(t, k, meta) + default: + e.err = fmt.Errorf("unknown SetMap restjson encode target, %s, %s", t, k) + return nil + } +} + +// SetFields will set the nested type's fields to the body. +func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PayloadTarget: + fallthrough + case protocol.BodyTarget: + e.bodyEncoder.SetFields(t, k, m, meta) + default: + e.err = fmt.Errorf("unknown SetMarshaler restjson encode target, %s, %s", t, k) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/restjson.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/restjson.go new file mode 100644 index 000000000000..2e7aff23674c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restjson/restjson.go @@ -0,0 +1,112 @@ +// Package restjson provides RESTful JSON serialization of AWS +// requests and responses. +package restjson + +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-json.json build_test.go +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go + +import ( + "encoding/json" + "io" + "io/ioutil" + "strings" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" +) + +// BuildHandler is a named request handler for building restjson protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.restjson.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling restjson protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restjson.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling restjson protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling restjson protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restjson.UnmarshalError", Fn: UnmarshalError} + +// Build builds a request for the REST JSON protocol. +func Build(r *request.Request) { + if m, ok := r.Params.(protocol.FieldMarshaler); ok { + e := NewEncoder(r.HTTPRequest) + + m.MarshalFields(e) + + var body io.ReadSeeker + var err error + r.HTTPRequest, body, err = e.Encode() + if err != nil { + r.Error = awserr.New(request.ErrCodeSerialization, "failed to encode rest JSON request", err) + return + } + if body != nil { + r.SetReaderBody(body) + } + return + } + + rest.Build(r) + + if t := rest.PayloadType(r.Params); t == "structure" || t == "" { + jsonrpc.Build(r) + } +} + +// Unmarshal unmarshals a response body for the REST JSON protocol. +func Unmarshal(r *request.Request) { + if t := rest.PayloadType(r.Data); t == "structure" || t == "" { + jsonrpc.Unmarshal(r) + } else { + rest.Unmarshal(r) + } +} + +// UnmarshalMeta unmarshals response headers for the REST JSON protocol. +func UnmarshalMeta(r *request.Request) { + rest.UnmarshalMeta(r) +} + +// UnmarshalError unmarshals a response error for the REST JSON protocol. +func UnmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + code := r.HTTPResponse.Header.Get("X-Amzn-Errortype") + bodyBytes, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed reading REST JSON error response", err) + return + } + if len(bodyBytes) == 0 { + r.Error = awserr.NewRequestFailure( + awserr.New("SerializationError", r.HTTPResponse.Status, nil), + r.HTTPResponse.StatusCode, + "", + ) + return + } + var jsonErr jsonErrorResponse + if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { + r.Error = awserr.New("SerializationError", "failed decoding REST JSON error response", err) + return + } + + if code == "" { + code = jsonErr.Code + } + + code = strings.SplitN(code, ":", 2)[0] + r.Error = awserr.NewRequestFailure( + awserr.New(code, jsonErr.Message, nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ) +} + +type jsonErrorResponse struct { + Code string `json:"code"` + Message string `json:"message"` +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/encode.go new file mode 100644 index 000000000000..501e79acf8c6 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/encode.go @@ -0,0 +1,162 @@ +package restxml + +import ( + "bytes" + "fmt" + "io" + "net/http" + + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" + "github.com/aws/aws-sdk-go-v2/private/protocol/xml" +) + +// An Encoder provides encoding of the AWS RESTXML protocol. This encoder combindes +// the XML and REST encoders deligating to them for their associated targets. +// +// It is invalid to set a XML and stream payload on the same encoder. +type Encoder struct { + method string + reqEncoder *rest.Encoder + bodyEncoder *xml.Encoder + + buf *bytes.Buffer + err error +} + +// NewEncoder creates a new encoder for encoding the AWS RESTXML protocol. +// The request passed in will be the base the path, query, and headers encoded +// will be set on top of. +func NewEncoder(req *http.Request) *Encoder { + e := &Encoder{ + method: req.Method, + reqEncoder: rest.NewEncoder(req), + bodyEncoder: xml.NewEncoder(), + } + + return e +} + +// Encode returns the encoded request, and body payload. If no payload body was +// set nil will be returned. If an error occurred while encoding the API an +// error will be returned. +func (e *Encoder) Encode() (*http.Request, io.ReadSeeker, error) { + req, payloadBody, err := e.reqEncoder.Encode() + if err != nil { + return nil, nil, err + } + + xmlBody, err := e.bodyEncoder.Encode() + if err != nil { + return nil, nil, err + } + + havePayload := payloadBody != nil + haveXML := xmlBody != nil + + if havePayload == haveXML && haveXML { + return nil, nil, fmt.Errorf("unexpected XML body and request payload for AWSMarshaler") + } + + body := payloadBody + if body == nil { + body = xmlBody + } + + return req, body, err +} + +// List will return a new list encoder based on the Target. +func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder { + if e.err != nil { + return nil + } + + switch t { + case protocol.HeaderTarget: + fallthrough + case protocol.QueryTarget: + return e.reqEncoder.List(t, k, meta) + case protocol.BodyTarget: + return e.bodyEncoder.List(t, k, meta) + default: + e.err = fmt.Errorf("unknown SetList restxml encode target, %s, %s", t, k) + return nil + } +} + +// Map will return a new map encoder based on the Target. +func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder { + if e.err != nil { + return nil + } + + switch t { + case protocol.HeadersTarget: + fallthrough + case protocol.QueryTarget: + return e.reqEncoder.Map(t, k, meta) + case protocol.BodyTarget: + return e.bodyEncoder.Map(t, k, meta) + default: + e.err = fmt.Errorf("unknown SetMap restxml encode target, %s, %s", t, k) + return nil + } +} + +// SetValue will set a value to the header, path, query, or body. +// +// If the request's method is GET all BodyTarget values will be written to +// the query string. +func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PathTarget: + fallthrough + case protocol.QueryTarget: + fallthrough + case protocol.HeaderTarget: + e.reqEncoder.SetValue(t, k, v, meta) + case protocol.BodyTarget: + if e.method == "GET" { + e.reqEncoder.SetValue(t, k, v, meta) + } else { + e.bodyEncoder.SetValue(t, k, v, meta) + } + default: + e.err = fmt.Errorf("unknown SetValue restxml encode target, %s, %s", t, k) + } +} + +// SetStream will set the stream to the payload of the request. +func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PayloadTarget: + e.reqEncoder.SetStream(t, k, v, meta) + default: + e.err = fmt.Errorf("invalid target %s, for SetStream, must be PayloadTarget", t) + } +} + +// SetFields will set the nested type's fields to the body. +func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + + switch t { + case protocol.PayloadTarget: + fallthrough + case protocol.BodyTarget: + e.bodyEncoder.SetFields(t, k, m, meta) + default: + e.err = fmt.Errorf("unknown SetMarshaler restxml encode target, %s, %s", t, k) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/restxml.go new file mode 100644 index 000000000000..65faeae30b98 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/restxml/restxml.go @@ -0,0 +1,90 @@ +// Package restxml provides RESTful XML serialization of AWS +// requests and responses. +package restxml + +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-xml.json build_test.go +//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go + +import ( + "bytes" + "encoding/xml" + "io" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/query" + "github.com/aws/aws-sdk-go-v2/private/protocol/rest" + "github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil" +) + +// BuildHandler is a named request handler for building restxml protocol requests +var BuildHandler = request.NamedHandler{Name: "awssdk.restxml.Build", Fn: Build} + +// UnmarshalHandler is a named request handler for unmarshaling restxml protocol requests +var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restxml.Unmarshal", Fn: Unmarshal} + +// UnmarshalMetaHandler is a named request handler for unmarshaling restxml protocol request metadata +var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalMeta", Fn: UnmarshalMeta} + +// UnmarshalErrorHandler is a named request handler for unmarshaling restxml protocol request errors +var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalError", Fn: UnmarshalError} + +// Build builds a request payload for the REST XML protocol. +func Build(r *request.Request) { + if m, ok := r.Params.(protocol.FieldMarshaler); ok { + e := NewEncoder(r.HTTPRequest) + + m.MarshalFields(e) + + var body io.ReadSeeker + var err error + r.HTTPRequest, body, err = e.Encode() + if err != nil { + r.Error = awserr.New(request.ErrCodeSerialization, "failed to encode rest XML request", err) + return + } + if body != nil { + r.SetReaderBody(body) + } + return + } + + // Fall back to old reflection based marshaler + rest.Build(r) + + if t := rest.PayloadType(r.Params); t == "structure" || t == "" { + var buf bytes.Buffer + err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) + if err != nil { + r.Error = awserr.New("SerializationError", "failed to encode rest XML request", err) + return + } + r.SetBufferBody(buf.Bytes()) + } +} + +// Unmarshal unmarshals a payload response for the REST XML protocol. +func Unmarshal(r *request.Request) { + if t := rest.PayloadType(r.Data); t == "structure" || t == "" { + defer r.HTTPResponse.Body.Close() + decoder := xml.NewDecoder(r.HTTPResponse.Body) + err := xmlutil.UnmarshalXML(r.Data, decoder, "") + if err != nil { + r.Error = awserr.New("SerializationError", "failed to decode REST XML response", err) + return + } + } else { + rest.Unmarshal(r) + } +} + +// UnmarshalMeta unmarshals response headers for the REST XML protocol. +func UnmarshalMeta(r *request.Request) { + rest.UnmarshalMeta(r) +} + +// UnmarshalError unmarshals a response error for the REST XML protocol. +func UnmarshalError(r *request.Request) { + query.UnmarshalError(r) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/target.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/target.go new file mode 100644 index 000000000000..36e65d32a3bd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/target.go @@ -0,0 +1,38 @@ +package protocol + +import "fmt" + +// Target is the encode and decode targets of protocol marshaling. +type Target int + +// The protocol marshaling targets. +const ( + PathTarget Target = iota + QueryTarget + HeaderTarget + HeadersTarget + StatusCodeTarget + BodyTarget + PayloadTarget +) + +func (e Target) String() string { + switch e { + case PathTarget: + return "Path" + case QueryTarget: + return "Query" + case HeaderTarget: + return "Header" + case HeadersTarget: + return "Headers" + case StatusCodeTarget: + return "StatusCode" + case BodyTarget: + return "Body" + case PayloadTarget: + return "Payload" + default: + panic(fmt.Sprintf("// unknown encoding target, %d", e)) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/unmarshal.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/unmarshal.go new file mode 100644 index 000000000000..de0483489a6b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/unmarshal.go @@ -0,0 +1,21 @@ +package protocol + +import ( + "io" + "io/ioutil" + + request "github.com/aws/aws-sdk-go-v2/aws" +) + +// UnmarshalDiscardBodyHandler is a named request handler to empty and close a response's body +var UnmarshalDiscardBodyHandler = request.NamedHandler{Name: "awssdk.shared.UnmarshalDiscardBody", Fn: UnmarshalDiscardBody} + +// UnmarshalDiscardBody is a request handler to empty a response's body and closing it. +func UnmarshalDiscardBody(r *request.Request) { + if r.HTTPResponse == nil || r.HTTPResponse.Body == nil { + return + } + + io.Copy(ioutil.Discard, r.HTTPResponse.Body) + r.HTTPResponse.Body.Close() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/value.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/value.go new file mode 100644 index 000000000000..892b286e5114 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/value.go @@ -0,0 +1,30 @@ +package protocol + +import ( + "reflect" +) + +// ErrValueNotSet is an error that is returned when the value +// has not been set. +type ErrValueNotSet struct{} + +func (err *ErrValueNotSet) Error() string { + return "value not set" +} + +// IsNotSetError will return true if the error is of ErrValueNotSet +func IsNotSetError(err error) bool { + _, ok := err.(*ErrValueNotSet) + return ok +} + +// GetValue will return the value that is associated with the reflect.Value. +// If that value is not set, this will return an ErrValueNotSet +func GetValue(r reflect.Value) (string, error) { + val := r.String() + if len(val) == 0 { + return "", &ErrValueNotSet{} + } + + return val, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/encode.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/encode.go new file mode 100644 index 000000000000..7d8ea051d5a1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/encode.go @@ -0,0 +1,415 @@ +package xml + +import ( + "bytes" + "encoding/xml" + "fmt" + "io" + + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// An Encoder provides encoding of the AWS XML protocol. This encoder will will +// write all content to XML. Only supports body and payload targets. +type Encoder struct { + encoder *xml.Encoder + encodedBuf *bytes.Buffer + fieldBuf protocol.FieldBuffer + err error +} + +// NewEncoder creates a new encoder for encoding AWS XML protocol. Only encodes +// fields into the XML body, and error is returned if target is anything other +// than Body or Payload. +func NewEncoder() *Encoder { + encodedBuf := bytes.NewBuffer(nil) + return &Encoder{ + encodedBuf: encodedBuf, + encoder: xml.NewEncoder(encodedBuf), + } +} + +// Encode returns the encoded XMl reader. An error will be returned if one was +// encountered while building the XML body. +func (e *Encoder) Encode() (io.ReadSeeker, error) { + if e.err != nil { + return nil, e.err + } + + if err := e.encoder.Flush(); err != nil { + return nil, fmt.Errorf("unable to marshal XML, %v", err) + } + + if e.encodedBuf.Len() == 0 { + return nil, nil + } + + return bytes.NewReader(e.encodedBuf.Bytes()), e.err +} + +// SetValue sets an individual value to the XML body. +func (e *Encoder) SetValue(t protocol.Target, k string, v protocol.ValueMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + if t != protocol.BodyTarget && t != protocol.PayloadTarget { + e.err = fmt.Errorf(" invalid target %s for xml encoder SetValue, %s", t, k) + return + } + + e.err = addValueToken(e.encoder, &e.fieldBuf, k, v, meta) +} + +// SetStream is not supported for XML protocol marshaling. +func (e *Encoder) SetStream(t protocol.Target, k string, v protocol.StreamMarshaler, meta protocol.Metadata) { + e.err = fmt.Errorf("xml encoder SetStream not supported, %s, %s", t, k) +} + +// List creates an XML list and calls the passed in fn callback with a list encoder. +func (e *Encoder) List(t protocol.Target, k string, meta protocol.Metadata) protocol.ListEncoder { + if e.err != nil { + return nil + } + if t != protocol.BodyTarget && t != protocol.PayloadTarget { + e.err = fmt.Errorf(" invalid target %s for xml encoder SetValue, %s", t, k) + return nil + } + + if v := meta.ListLocationName; len(v) == 0 { + if meta.Flatten { + meta.ListLocationName = k + } else { + meta.ListLocationName = "member" + } + } + + return &ListEncoder{ + Base: e, + Key: k, + Metadata: meta, + } +} + +// Map creates an XML map and calls the passed in fn callback with a map encoder. +func (e *Encoder) Map(t protocol.Target, k string, meta protocol.Metadata) protocol.MapEncoder { + if e.err != nil { + return nil + } + if t != protocol.BodyTarget && t != protocol.PayloadTarget { + e.err = fmt.Errorf(" invalid target %s for xml encoder SetValue, %s", t, k) + return nil + } + + me := MapEncoder{Base: e, + // TODO: Get rid of these fields as we need the metadata structure now + Flatten: meta.Flatten, + KeyName: meta.MapLocationNameKey, + ValueName: meta.MapLocationNameValue, + Metadata: meta, + Key: k, + } + + return &me + +} + +// SetFields sets the nested fields to the XML body. +func (e *Encoder) SetFields(t protocol.Target, k string, m protocol.FieldMarshaler, meta protocol.Metadata) { + if e.err != nil { + return + } + if t != protocol.BodyTarget && t != protocol.PayloadTarget { + e.err = fmt.Errorf(" invalid target %s for xml encoder SetFields, %s", t, k) + return + } + + tok, err := xmlStartElem(k, meta) + if err != nil { + e.err = err + return + } + + e.encoder.EncodeToken(tok) + m.MarshalFields(e) + e.encoder.EncodeToken(xml.EndElement{Name: tok.Name}) +} + +// A ListEncoder encodes elements within a list for the XML encoder. +type ListEncoder struct { + Base *Encoder + Key string + Metadata protocol.Metadata + Token xml.StartElement + err error +} + +// Map will return an error since nested collections are not support by this protocol. +func (e *ListEncoder) Map() protocol.MapEncoder { + e.err = fmt.Errorf("xml list encoder ListSetMap not supported") + return nil +} + +// List will return an error since nested collections are not support by this protocol. +func (e *ListEncoder) List() protocol.ListEncoder { + e.err = fmt.Errorf("xml list encoder ListSetList not supported") + return nil +} + +// Start will write the start element and set the token for closing +func (e *ListEncoder) Start() { + var tok xml.StartElement + var err error + if !e.Metadata.Flatten { + tok, err = xmlStartElem(e.Key, e.Metadata) + if err != nil { + e.err = err + return + } + + e.Base.encoder.EncodeToken(tok) + } + + e.Token = tok +} + +// End will write the end element if the list is not flat. +func (e *ListEncoder) End() { + if !e.Metadata.Flatten { + e.err = e.Base.encoder.EncodeToken(xml.EndElement{Name: e.Token.Name}) + } +} + +// ListAddValue will add the value to the list. +func (e *ListEncoder) ListAddValue(v protocol.ValueMarshaler) { + if e.err != nil { + return + } + + e.err = addValueToken(e.Base.encoder, &e.Base.fieldBuf, e.Metadata.ListLocationName, v, protocol.Metadata{}) +} + +// ListAddFields will set the nested type's fields to the list. +func (e *ListEncoder) ListAddFields(m protocol.FieldMarshaler) { + if e.err != nil { + return + } + + var tok xml.StartElement + tok, e.err = xmlStartElem(e.Metadata.ListLocationName, protocol.Metadata{}) + if e.err != nil { + return + } + + e.Base.encoder.EncodeToken(tok) + m.MarshalFields(e.Base) + e.Base.encoder.EncodeToken(xml.EndElement{Name: tok.Name}) +} + +// A MapEncoder encodes key values pair map values for the XML encoder. +type MapEncoder struct { + Base *Encoder + Flatten bool + Key string + KeyName string + ValueName string + err error + + Token xml.StartElement + Metadata protocol.Metadata +} + +// Start will open a new scope by creating a new XML start element tag. +func (e *MapEncoder) Start() { + tok, err := xmlStartElem(e.Key, e.Metadata) + if err != nil { + e.err = err + return + } + + e.Token = tok + e.Base.encoder.EncodeToken(tok) +} + +// End will close the associated tag. +func (e *MapEncoder) End() { + e.Base.encoder.EncodeToken(xml.EndElement{Name: e.Token.Name}) +} + +// Map will set err as nested collections are not supported in this protocol. +func (e *MapEncoder) Map(k string) protocol.MapEncoder { + e.err = fmt.Errorf("xml map encoder MapSetList not supported, %s", k) + return nil +} + +// List will set err as nested collections are not supported in this protocol. +func (e *MapEncoder) List(k string) protocol.ListEncoder { + e.err = fmt.Errorf("xml map encoder ListSetList not supported, %s", k) + return nil +} + +// MapSetValue sets a map value. +func (e *MapEncoder) MapSetValue(k string, v protocol.ValueMarshaler) { + if e.err != nil { + return + } + + var tok xml.StartElement + if !e.Flatten { + tok, e.err = xmlStartElem("entry", protocol.Metadata{}) + if e.err != nil { + return + } + e.Base.encoder.EncodeToken(tok) + } + + keyName, valueName := e.KeyName, e.ValueName + if len(keyName) == 0 { + keyName = "key" + } + if len(valueName) == 0 { + valueName = "value" + } + + e.err = addValueToken(e.Base.encoder, &e.Base.fieldBuf, keyName, protocol.StringValue(k), protocol.Metadata{}) + if e.err != nil { + return + } + + e.err = addValueToken(e.Base.encoder, &e.Base.fieldBuf, valueName, v, protocol.Metadata{}) + if e.err != nil { + return + } + + if !e.Flatten { + e.Base.encoder.EncodeToken(xml.EndElement{Name: tok.Name}) + } +} + +// MapSetList is not supported. +func (e *MapEncoder) MapSetList(k string, fn func(le protocol.ListEncoder)) { + e.err = fmt.Errorf("xml map encoder MapSetList not supported, %s", k) +} + +// MapSetMap is not supported. +func (e *MapEncoder) MapSetMap(k string, fn func(me protocol.MapEncoder)) { + e.err = fmt.Errorf("xml map encoder MapSetMap not supported, %s", k) +} + +// MapSetFields will set the nested type's fields under the map. +func (e *MapEncoder) MapSetFields(k string, m protocol.FieldMarshaler) { + if e.err != nil { + return + } + + var tok xml.StartElement + if !e.Flatten { + tok, e.err = xmlStartElem("entry", protocol.Metadata{}) + if e.err != nil { + return + } + e.Base.encoder.EncodeToken(tok) + } + + keyName, valueName := e.KeyName, e.ValueName + if len(keyName) == 0 { + keyName = "key" + } + if len(valueName) == 0 { + valueName = "value" + } + + e.err = addValueToken(e.Base.encoder, &e.Base.fieldBuf, keyName, protocol.StringValue(k), protocol.Metadata{}) + if e.err != nil { + return + } + + valTok, err := xmlStartElem(valueName, protocol.Metadata{}) + if err != nil { + e.err = err + return + } + e.Base.encoder.EncodeToken(valTok) + + m.MarshalFields(e.Base) + + e.Base.encoder.EncodeToken(xml.EndElement{Name: valTok.Name}) + + if !e.Flatten { + e.Base.encoder.EncodeToken(xml.EndElement{Name: tok.Name}) + } +} + +func addValueToken(e *xml.Encoder, fieldBuf *protocol.FieldBuffer, k string, v protocol.ValueMarshaler, meta protocol.Metadata) error { + b, err := fieldBuf.GetValue(v) + if err != nil { + return err + } + + tok, err := xmlStartElem(k, meta) + if err != nil { + return err + } + + e.EncodeToken(tok) + e.EncodeToken(xml.CharData(b)) + e.EncodeToken(xml.EndElement{Name: tok.Name}) + + return nil +} + +func xmlStartElem(k string, meta protocol.Metadata) (xml.StartElement, error) { + tok := xml.StartElement{Name: xmlName(k, meta)} + attrs, err := buildAttributes(meta) + if err != nil { + return xml.StartElement{}, err + } + tok.Attr = attrs + + return tok, nil +} + +func xmlName(k string, meta protocol.Metadata) xml.Name { + name := xml.Name{Local: k} + + // TODO need to do something with namespace? + // if len(meta.XMLNamespacePrefix) > 0 && len(meta.XMLNamespaceURI) { + // name.Space = prefix + // } + + return name +} + +func buildAttributes(meta protocol.Metadata) ([]xml.Attr, error) { + n := len(meta.Attributes) + if len(meta.XMLNamespaceURI) > 0 { + n++ + } + + if n == 0 { + return nil, nil + } + + attrs := make([]xml.Attr, n) + + for _, a := range meta.Attributes { + str, err := a.Value.MarshalValue() + if err != nil { + return nil, err + } + + attrs = append(attrs, xml.Attr{Name: xmlName(a.Name, a.Meta), Value: str}) + } + + if uri := meta.XMLNamespaceURI; len(uri) > 0 { + attr := xml.Attr{ + Name: xml.Name{Local: "xmlns"}, + Value: uri, + } + if p := meta.XMLNamespacePrefix; len(p) > 0 { + attr.Name.Local += ":" + p + } + attrs = append(attrs, attr) + } + + return attrs, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/build.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/build.go new file mode 100644 index 000000000000..ab4f1e4e82ff --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/build.go @@ -0,0 +1,302 @@ +// Package xmlutil provides XML serialization of AWS requests and responses. +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "reflect" + "sort" + "strconv" + "time" + + "github.com/aws/aws-sdk-go-v2/private/protocol" +) + +// BuildXML will serialize params into an xml.Encoder. +// Error will be returned if the serialization of any of the params or nested values fails. +func BuildXML(params interface{}, e *xml.Encoder) error { + b := xmlBuilder{encoder: e, namespaces: map[string]string{}} + root := NewXMLElement(xml.Name{}) + if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { + return err + } + for _, c := range root.Children { + for _, v := range c { + return StructToXML(e, v, false) + } + } + return nil +} + +// Returns the reflection element of a value, if it is a pointer. +func elemOf(value reflect.Value) reflect.Value { + for value.Kind() == reflect.Ptr { + value = value.Elem() + } + return value +} + +// A xmlBuilder serializes values from Go code to XML +type xmlBuilder struct { + encoder *xml.Encoder + namespaces map[string]string +} + +// buildValue generic XMLNode builder for any type. Will build value for their specific type +// struct, list, map, scalar. +// +// Also takes a "type" tag value to set what type a value should be converted to XMLNode as. If +// type is not provided reflect will be used to determine the value's type. +func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + value = elemOf(value) + if !value.IsValid() { // no need to handle zero values + return nil + } else if tag.Get("location") != "" { // don't handle non-body location values + return nil + } + + t := tag.Get("type") + if t == "" { + switch value.Kind() { + case reflect.Struct: + t = "structure" + case reflect.Slice: + t = "list" + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := value.Type().FieldByName("_"); ok { + tag = tag + reflect.StructTag(" ") + field.Tag + } + return b.buildStruct(value, current, tag) + case "list": + return b.buildList(value, current, tag) + case "map": + return b.buildMap(value, current, tag) + default: + return b.buildScalar(value, current, tag) + } +} + +// buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested +// types are converted to XMLNodes also. +func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if !value.IsValid() { + return nil + } + + fieldAdded := false + + // unwrap payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := value.Type().FieldByName(payload) + tag = field.Tag + value = elemOf(value.FieldByName(payload)) + + if !value.IsValid() { + return nil + } + } + + child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + + // there is an xmlNamespace associated with this struct + if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { + ns := xml.Attr{ + Name: xml.Name{Local: "xmlns"}, + Value: uri, + } + if prefix != "" { + b.namespaces[prefix] = uri // register the namespace + ns.Name.Local = "xmlns:" + prefix + } + + child.Attr = append(child.Attr, ns) + } + + t := value.Type() + for i := 0; i < value.NumField(); i++ { + member := elemOf(value.Field(i)) + field := t.Field(i) + + if field.PkgPath != "" { + continue // ignore unexported fields + } + if field.Tag.Get("ignore") != "" { + continue + } + + mTag := field.Tag + if mTag.Get("location") != "" { // skip non-body members + continue + } + + if protocol.CanSetIdempotencyToken(value.Field(i), field) { + token := protocol.GetIdempotencyToken() + member = reflect.ValueOf(token) + } + + memberName := mTag.Get("locationName") + if memberName == "" { + memberName = field.Name + mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) + } + if err := b.buildValue(member, child, mTag); err != nil { + return err + } + + fieldAdded = true + } + + if fieldAdded { // only append this child if we have one ore more valid members + current.AddChild(child) + } + + return nil +} + +// buildList adds the value's list items to the current XMLNode as children nodes. All +// nested values in the list are converted to XMLNodes also. +func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted lists + return nil + } + + // check for unflattened list member + flattened := tag.Get("flattened") != "" + + xname := xml.Name{Local: tag.Get("locationName")} + if flattened { + for i := 0; i < value.Len(); i++ { + child := NewXMLElement(xname) + current.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } else { + list := NewXMLElement(xname) + current.AddChild(list) + + for i := 0; i < value.Len(); i++ { + iname := tag.Get("locationNameList") + if iname == "" { + iname = "member" + } + + child := NewXMLElement(xml.Name{Local: iname}) + list.AddChild(child) + if err := b.buildValue(value.Index(i), child, ""); err != nil { + return err + } + } + } + + return nil +} + +// buildMap adds the value's key/value pairs to the current XMLNode as children nodes. All +// nested values in the map are converted to XMLNodes also. +// +// Error will be returned if it is unable to build the map's values into XMLNodes +func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + if value.IsNil() { // don't build omitted maps + return nil + } + + maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) + current.AddChild(maproot) + current = maproot + + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + // sorting is not required for compliance, but it makes testing easier + keys := make([]string, value.Len()) + for i, k := range value.MapKeys() { + keys[i] = k.String() + } + sort.Strings(keys) + + for _, k := range keys { + v := value.MapIndex(reflect.ValueOf(k)) + + mapcur := current + if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps + child := NewXMLElement(xml.Name{Local: "entry"}) + mapcur.AddChild(child) + mapcur = child + } + + kchild := NewXMLElement(xml.Name{Local: kname}) + kchild.Text = k + vchild := NewXMLElement(xml.Name{Local: vname}) + mapcur.AddChild(kchild) + mapcur.AddChild(vchild) + + if err := b.buildValue(v, vchild, ""); err != nil { + return err + } + } + + return nil +} + +// buildScalar will convert the value into a string and append it as a attribute or child +// of the current XMLNode. +// +// The value will be added as an attribute if tag contains a "xmlAttribute" attribute value. +// +// Error will be returned if the value type is unsupported. +func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { + var str string + switch converted := value.Interface().(type) { + case string: + str = converted + case []byte: + if !value.IsNil() { + str = base64.StdEncoding.EncodeToString(converted) + } + case bool: + str = strconv.FormatBool(converted) + case int64: + str = strconv.FormatInt(converted, 10) + case int: + str = strconv.Itoa(converted) + case float64: + str = strconv.FormatFloat(converted, 'f', -1, 64) + case float32: + str = strconv.FormatFloat(float64(converted), 'f', -1, 32) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + str = converted.UTC().Format(ISO8601UTC) + default: + if value.Kind() != reflect.String { + return fmt.Errorf("unsupported value for param %s: %v (%s)", + tag.Get("locationName"), value.Interface(), value.Type().Name()) + } + str = value.Convert(reflect.TypeOf("")).String() + } + + if len(str) == 0 { + return nil + } + xname := xml.Name{Local: tag.Get("locationName")} + if tag.Get("xmlAttribute") != "" { // put into current node's attribute list + attr := xml.Attr{Name: xname, Value: str} + current.Attr = append(current.Attr, attr) + } else { // regular text node + current.AddChild(&XMLNode{Name: xname, Text: str}) + } + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/unmarshal.go new file mode 100644 index 000000000000..2b95c35e6687 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/unmarshal.go @@ -0,0 +1,278 @@ +package xmlutil + +import ( + "encoding/base64" + "encoding/xml" + "fmt" + "io" + "reflect" + "strconv" + "strings" + "time" +) + +// UnmarshalXML deserializes an xml.Decoder into the container v. V +// needs to match the shape of the XML expected to be decoded. +// If the shape doesn't match unmarshaling will fail. +func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { + n, err := XMLToStruct(d, nil) + if err != nil { + return err + } + if n.Children != nil { + for _, root := range n.Children { + for _, c := range root { + if wrappedChild, ok := c.Children[wrapper]; ok { + c = wrappedChild[0] // pull out wrapped element + } + + err = parse(reflect.ValueOf(v), c, "") + if err != nil { + if err == io.EOF { + return nil + } + return err + } + } + } + return nil + } + return nil +} + +// parse deserializes any value from the XMLNode. The type tag is used to infer the type, or reflect +// will be used to determine the type from r. +func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + rtype := r.Type() + if rtype.Kind() == reflect.Ptr { + rtype = rtype.Elem() // check kind of actual element type + } + + t := tag.Get("type") + if t == "" { + switch rtype.Kind() { + case reflect.Struct: + // also it can't be a time object + _, tok := r.Interface().(*time.Time) + if _, ok := r.Interface().(time.Time); !(ok || tok) { + t = "structure" + } + case reflect.Slice: + // also it can't be a byte slice + if _, ok := r.Interface().([]byte); !ok { + t = "list" + } + case reflect.Map: + t = "map" + } + } + + switch t { + case "structure": + if field, ok := rtype.FieldByName("_"); ok { + tag = field.Tag + } + return parseStruct(r, node, tag) + case "list": + return parseList(r, node, tag) + case "map": + return parseMap(r, node, tag) + default: + return parseScalar(r, node, tag) + } +} + +// parseStruct deserializes a structure and its fields from an XMLNode. Any nested +// types in the structure will also be deserialized. +func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + if r.Kind() == reflect.Ptr { + if r.IsNil() { // create the structure if it's nil + s := reflect.New(r.Type().Elem()) + r.Set(s) + r = s + } + + r = r.Elem() + t = t.Elem() + } + + // unwrap any payloads + if payload := tag.Get("payload"); payload != "" { + field, _ := t.FieldByName(payload) + return parseStruct(r.FieldByName(payload), node, field.Tag) + } + + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + if c := field.Name[0:1]; strings.ToLower(c) == c { + continue // ignore unexported fields + } + + // figure out what this field is called + name := field.Name + if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { + name = field.Tag.Get("locationNameList") + } else if locName := field.Tag.Get("locationName"); locName != "" { + name = locName + } + + // try to find the field by name in elements + elems := node.Children[name] + + if elems == nil { // try to find the field in attributes + if val, ok := node.findElem(name); ok { + elems = []*XMLNode{{Text: val}} + } + } + + member := r.FieldByName(field.Name) + for _, elem := range elems { + err := parse(member, elem, field.Tag) + if err != nil { + return err + } + } + } + return nil +} + +// parseList deserializes a list of values from an XML node. Each list entry +// will also be deserialized. +func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + t := r.Type() + + if tag.Get("flattened") == "" { // look at all item entries + mname := "member" + if name := tag.Get("locationNameList"); name != "" { + mname = name + } + + if Children, ok := node.Children[mname]; ok { + if r.IsNil() { + r.Set(reflect.MakeSlice(t, len(Children), len(Children))) + } + + for i, c := range Children { + err := parse(r.Index(i), c, "") + if err != nil { + return err + } + } + } + } else { // flattened list means this is a single element + if r.IsNil() { + r.Set(reflect.MakeSlice(t, 0, 0)) + } + + childR := reflect.Zero(t.Elem()) + r.Set(reflect.Append(r, childR)) + err := parse(r.Index(r.Len()-1), node, "") + if err != nil { + return err + } + } + + return nil +} + +// parseMap deserializes a map from an XMLNode. The direct children of the XMLNode +// will also be deserialized as map entries. +func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + if r.IsNil() { + r.Set(reflect.MakeMap(r.Type())) + } + + if tag.Get("flattened") == "" { // look at all child entries + for _, entry := range node.Children["entry"] { + parseMapEntry(r, entry, tag) + } + } else { // this element is itself an entry + parseMapEntry(r, node, tag) + } + + return nil +} + +// parseMapEntry deserializes a map entry from a XML node. +func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + kname, vname := "key", "value" + if n := tag.Get("locationNameKey"); n != "" { + kname = n + } + if n := tag.Get("locationNameValue"); n != "" { + vname = n + } + + keys, ok := node.Children[kname] + values := node.Children[vname] + if ok { + for i, key := range keys { + keyR := reflect.ValueOf(key.Text) + value := values[i] + valueR := reflect.New(r.Type().Elem()).Elem() + + parse(valueR, value, "") + r.SetMapIndex(keyR, valueR) + } + } + return nil +} + +// parseScaller deserializes an XMLNode value into a concrete type based on the +// interface type of r. +// +// Error is returned if the deserialization fails due to invalid type conversion, +// or unsupported interface type. +func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { + if r.Kind() == reflect.String { + r.SetString(node.Text) + return nil + } + + if r.Kind() == reflect.Ptr { + if r.IsNil() { + r.Set(reflect.New(r.Type().Elem())) + } + r = r.Elem() + } + + switch r.Interface().(type) { + case string: + r.Set(reflect.ValueOf(node.Text)) + case []byte: + b, err := base64.StdEncoding.DecodeString(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(b)) + case bool: + v, err := strconv.ParseBool(node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(v)) + case int64: + v, err := strconv.ParseInt(node.Text, 10, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(v)) + case float64: + v, err := strconv.ParseFloat(node.Text, 64) + if err != nil { + return err + } + r.Set(reflect.ValueOf(v)) + case time.Time: + const ISO8601UTC = "2006-01-02T15:04:05Z" + t, err := time.Parse(ISO8601UTC, node.Text) + if err != nil { + return err + } + r.Set(reflect.ValueOf(t)) + default: + return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) + } + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/xml_to_struct.go b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/xml_to_struct.go new file mode 100644 index 000000000000..3e970b629dae --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil/xml_to_struct.go @@ -0,0 +1,147 @@ +package xmlutil + +import ( + "encoding/xml" + "fmt" + "io" + "sort" +) + +// A XMLNode contains the values to be encoded or decoded. +type XMLNode struct { + Name xml.Name `json:",omitempty"` + Children map[string][]*XMLNode `json:",omitempty"` + Text string `json:",omitempty"` + Attr []xml.Attr `json:",omitempty"` + + namespaces map[string]string + parent *XMLNode +} + +// NewXMLElement returns a pointer to a new XMLNode initialized to default values. +func NewXMLElement(name xml.Name) *XMLNode { + return &XMLNode{ + Name: name, + Children: map[string][]*XMLNode{}, + Attr: []xml.Attr{}, + } +} + +// AddChild adds child to the XMLNode. +func (n *XMLNode) AddChild(child *XMLNode) { + if _, ok := n.Children[child.Name.Local]; !ok { + n.Children[child.Name.Local] = []*XMLNode{} + } + n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) +} + +// XMLToStruct converts a xml.Decoder stream to XMLNode with nested values. +func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { + out := &XMLNode{} + for { + tok, err := d.Token() + if err != nil { + if err == io.EOF { + break + } else { + return out, err + } + } + + if tok == nil { + break + } + + switch typed := tok.(type) { + case xml.CharData: + out.Text = string(typed.Copy()) + case xml.StartElement: + el := typed.Copy() + out.Attr = el.Attr + if out.Children == nil { + out.Children = map[string][]*XMLNode{} + } + + name := typed.Name.Local + slice := out.Children[name] + if slice == nil { + slice = []*XMLNode{} + } + node, e := XMLToStruct(d, &el) + out.findNamespaces() + if e != nil { + return out, e + } + node.Name = typed.Name + node.findNamespaces() + tempOut := *out + // Save into a temp variable, simply because out gets squashed during + // loop iterations + node.parent = &tempOut + slice = append(slice, node) + out.Children[name] = slice + case xml.EndElement: + if s != nil && s.Name.Local == typed.Name.Local { // matching end token + return out, nil + } + out = &XMLNode{} + } + } + return out, nil +} + +func (n *XMLNode) findNamespaces() { + ns := map[string]string{} + for _, a := range n.Attr { + if a.Name.Space == "xmlns" { + ns[a.Value] = a.Name.Local + } + } + + n.namespaces = ns +} + +func (n *XMLNode) findElem(name string) (string, bool) { + for node := n; node != nil; node = node.parent { + for _, a := range node.Attr { + namespace := a.Name.Space + if v, ok := node.namespaces[namespace]; ok { + namespace = v + } + if name == fmt.Sprintf("%s:%s", namespace, a.Name.Local) { + return a.Value, true + } + } + } + return "", false +} + +// StructToXML writes an XMLNode to a xml.Encoder as tokens. +func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { + e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) + + if node.Text != "" { + e.EncodeToken(xml.CharData([]byte(node.Text))) + } else if sorted { + sortedNames := []string{} + for k := range node.Children { + sortedNames = append(sortedNames, k) + } + sort.Strings(sortedNames) + + for _, k := range sortedNames { + for _, v := range node.Children[k] { + StructToXML(e, v, sorted) + } + } + } else { + for _, c := range node.Children { + for _, v := range c { + StructToXML(e, v, sorted) + } + } + } + + e.EncodeToken(xml.EndElement{Name: node.Name}) + return e.Flush() +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/api.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/api.go new file mode 100644 index 000000000000..2ed81b6d8384 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/api.go @@ -0,0 +1,8822 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudformation + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/query" +) + +const opCancelUpdateStack = "CancelUpdateStack" + +// CancelUpdateStackRequest is a API request type for the CancelUpdateStack API operation. +type CancelUpdateStackRequest struct { + *aws.Request + Input *CancelUpdateStackInput + Copy func(*CancelUpdateStackInput) CancelUpdateStackRequest +} + +// Send marshals and sends the CancelUpdateStack API request. +func (r CancelUpdateStackRequest) Send() (*CancelUpdateStackOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CancelUpdateStackOutput), nil +} + +// CancelUpdateStackRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Cancels an update on the specified stack. If the call completes successfully, +// the stack rolls back the update and reverts to the previous stack configuration. +// +// You can cancel only stacks that are in the UPDATE_IN_PROGRESS state. +// +// // Example sending a request using the CancelUpdateStackRequest method. +// req := client.CancelUpdateStackRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CancelUpdateStack +func (c *CloudFormation) CancelUpdateStackRequest(input *CancelUpdateStackInput) CancelUpdateStackRequest { + op := &aws.Operation{ + Name: opCancelUpdateStack, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CancelUpdateStackInput{} + } + + output := &CancelUpdateStackOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return CancelUpdateStackRequest{Request: req, Input: input, Copy: c.CancelUpdateStackRequest} +} + +const opContinueUpdateRollback = "ContinueUpdateRollback" + +// ContinueUpdateRollbackRequest is a API request type for the ContinueUpdateRollback API operation. +type ContinueUpdateRollbackRequest struct { + *aws.Request + Input *ContinueUpdateRollbackInput + Copy func(*ContinueUpdateRollbackInput) ContinueUpdateRollbackRequest +} + +// Send marshals and sends the ContinueUpdateRollback API request. +func (r ContinueUpdateRollbackRequest) Send() (*ContinueUpdateRollbackOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ContinueUpdateRollbackOutput), nil +} + +// ContinueUpdateRollbackRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// For a specified stack that is in the UPDATE_ROLLBACK_FAILED state, continues +// rolling it back to the UPDATE_ROLLBACK_COMPLETE state. Depending on the cause +// of the failure, you can manually fix the error (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html#troubleshooting-errors-update-rollback-failed) +// and continue the rollback. By continuing the rollback, you can return your +// stack to a working state (the UPDATE_ROLLBACK_COMPLETE state), and then try +// to update the stack again. +// +// A stack goes into the UPDATE_ROLLBACK_FAILED state when AWS CloudFormation +// cannot roll back all changes after a failed stack update. For example, you +// might have a stack that is rolling back to an old database instance that +// was deleted outside of AWS CloudFormation. Because AWS CloudFormation doesn't +// know the database was deleted, it assumes that the database instance still +// exists and attempts to roll back to it, causing the update rollback to fail. +// +// // Example sending a request using the ContinueUpdateRollbackRequest method. +// req := client.ContinueUpdateRollbackRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ContinueUpdateRollback +func (c *CloudFormation) ContinueUpdateRollbackRequest(input *ContinueUpdateRollbackInput) ContinueUpdateRollbackRequest { + op := &aws.Operation{ + Name: opContinueUpdateRollback, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ContinueUpdateRollbackInput{} + } + + output := &ContinueUpdateRollbackOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ContinueUpdateRollbackRequest{Request: req, Input: input, Copy: c.ContinueUpdateRollbackRequest} +} + +const opCreateChangeSet = "CreateChangeSet" + +// CreateChangeSetRequest is a API request type for the CreateChangeSet API operation. +type CreateChangeSetRequest struct { + *aws.Request + Input *CreateChangeSetInput + Copy func(*CreateChangeSetInput) CreateChangeSetRequest +} + +// Send marshals and sends the CreateChangeSet API request. +func (r CreateChangeSetRequest) Send() (*CreateChangeSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateChangeSetOutput), nil +} + +// CreateChangeSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Creates a list of changes that will be applied to a stack so that you can +// review the changes before executing them. You can create a change set for +// a stack that doesn't exist or an existing stack. If you create a change set +// for a stack that doesn't exist, the change set shows all of the resources +// that AWS CloudFormation will create. If you create a change set for an existing +// stack, AWS CloudFormation compares the stack's information with the information +// that you submit in the change set and lists the differences. Use change sets +// to understand which resources AWS CloudFormation will create or change, and +// how it will change resources in an existing stack, before you create or update +// a stack. +// +// To create a change set for a stack that doesn't exist, for the ChangeSetType +// parameter, specify CREATE. To create a change set for an existing stack, +// specify UPDATE for the ChangeSetType parameter. After the CreateChangeSet +// call successfully completes, AWS CloudFormation starts creating the change +// set. To check the status of the change set or to review it, use the DescribeChangeSet +// action. +// +// When you are satisfied with the changes the change set will make, execute +// the change set by using the ExecuteChangeSet action. AWS CloudFormation doesn't +// make changes until you execute the change set. +// +// // Example sending a request using the CreateChangeSetRequest method. +// req := client.CreateChangeSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateChangeSet +func (c *CloudFormation) CreateChangeSetRequest(input *CreateChangeSetInput) CreateChangeSetRequest { + op := &aws.Operation{ + Name: opCreateChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateChangeSetInput{} + } + + output := &CreateChangeSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateChangeSetRequest{Request: req, Input: input, Copy: c.CreateChangeSetRequest} +} + +const opCreateStack = "CreateStack" + +// CreateStackRequest is a API request type for the CreateStack API operation. +type CreateStackRequest struct { + *aws.Request + Input *CreateStackInput + Copy func(*CreateStackInput) CreateStackRequest +} + +// Send marshals and sends the CreateStack API request. +func (r CreateStackRequest) Send() (*CreateStackOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateStackOutput), nil +} + +// CreateStackRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Creates a stack as specified in the template. After the call completes successfully, +// the stack creation starts. You can check the status of the stack via the +// DescribeStacks API. +// +// // Example sending a request using the CreateStackRequest method. +// req := client.CreateStackRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStack +func (c *CloudFormation) CreateStackRequest(input *CreateStackInput) CreateStackRequest { + op := &aws.Operation{ + Name: opCreateStack, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateStackInput{} + } + + output := &CreateStackOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateStackRequest{Request: req, Input: input, Copy: c.CreateStackRequest} +} + +const opCreateStackInstances = "CreateStackInstances" + +// CreateStackInstancesRequest is a API request type for the CreateStackInstances API operation. +type CreateStackInstancesRequest struct { + *aws.Request + Input *CreateStackInstancesInput + Copy func(*CreateStackInstancesInput) CreateStackInstancesRequest +} + +// Send marshals and sends the CreateStackInstances API request. +func (r CreateStackInstancesRequest) Send() (*CreateStackInstancesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateStackInstancesOutput), nil +} + +// CreateStackInstancesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Creates stack instances for the specified accounts, within the specified +// regions. A stack instance refers to a stack in a specific account and region. +// Accounts and Regions are required parameters—you must specify at least one +// account and one region. +// +// // Example sending a request using the CreateStackInstancesRequest method. +// req := client.CreateStackInstancesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackInstances +func (c *CloudFormation) CreateStackInstancesRequest(input *CreateStackInstancesInput) CreateStackInstancesRequest { + op := &aws.Operation{ + Name: opCreateStackInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateStackInstancesInput{} + } + + output := &CreateStackInstancesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateStackInstancesRequest{Request: req, Input: input, Copy: c.CreateStackInstancesRequest} +} + +const opCreateStackSet = "CreateStackSet" + +// CreateStackSetRequest is a API request type for the CreateStackSet API operation. +type CreateStackSetRequest struct { + *aws.Request + Input *CreateStackSetInput + Copy func(*CreateStackSetInput) CreateStackSetRequest +} + +// Send marshals and sends the CreateStackSet API request. +func (r CreateStackSetRequest) Send() (*CreateStackSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateStackSetOutput), nil +} + +// CreateStackSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Creates a stack set. +// +// // Example sending a request using the CreateStackSetRequest method. +// req := client.CreateStackSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackSet +func (c *CloudFormation) CreateStackSetRequest(input *CreateStackSetInput) CreateStackSetRequest { + op := &aws.Operation{ + Name: opCreateStackSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateStackSetInput{} + } + + output := &CreateStackSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateStackSetRequest{Request: req, Input: input, Copy: c.CreateStackSetRequest} +} + +const opDeleteChangeSet = "DeleteChangeSet" + +// DeleteChangeSetRequest is a API request type for the DeleteChangeSet API operation. +type DeleteChangeSetRequest struct { + *aws.Request + Input *DeleteChangeSetInput + Copy func(*DeleteChangeSetInput) DeleteChangeSetRequest +} + +// Send marshals and sends the DeleteChangeSet API request. +func (r DeleteChangeSetRequest) Send() (*DeleteChangeSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteChangeSetOutput), nil +} + +// DeleteChangeSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Deletes the specified change set. Deleting change sets ensures that no one +// executes the wrong change set. +// +// If the call successfully completes, AWS CloudFormation successfully deleted +// the change set. +// +// // Example sending a request using the DeleteChangeSetRequest method. +// req := client.DeleteChangeSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteChangeSet +func (c *CloudFormation) DeleteChangeSetRequest(input *DeleteChangeSetInput) DeleteChangeSetRequest { + op := &aws.Operation{ + Name: opDeleteChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteChangeSetInput{} + } + + output := &DeleteChangeSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteChangeSetRequest{Request: req, Input: input, Copy: c.DeleteChangeSetRequest} +} + +const opDeleteStack = "DeleteStack" + +// DeleteStackRequest is a API request type for the DeleteStack API operation. +type DeleteStackRequest struct { + *aws.Request + Input *DeleteStackInput + Copy func(*DeleteStackInput) DeleteStackRequest +} + +// Send marshals and sends the DeleteStack API request. +func (r DeleteStackRequest) Send() (*DeleteStackOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteStackOutput), nil +} + +// DeleteStackRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Deletes a specified stack. Once the call completes successfully, stack deletion +// starts. Deleted stacks do not show up in the DescribeStacks API if the deletion +// has been completed successfully. +// +// // Example sending a request using the DeleteStackRequest method. +// req := client.DeleteStackRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStack +func (c *CloudFormation) DeleteStackRequest(input *DeleteStackInput) DeleteStackRequest { + op := &aws.Operation{ + Name: opDeleteStack, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteStackInput{} + } + + output := &DeleteStackOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteStackRequest{Request: req, Input: input, Copy: c.DeleteStackRequest} +} + +const opDeleteStackInstances = "DeleteStackInstances" + +// DeleteStackInstancesRequest is a API request type for the DeleteStackInstances API operation. +type DeleteStackInstancesRequest struct { + *aws.Request + Input *DeleteStackInstancesInput + Copy func(*DeleteStackInstancesInput) DeleteStackInstancesRequest +} + +// Send marshals and sends the DeleteStackInstances API request. +func (r DeleteStackInstancesRequest) Send() (*DeleteStackInstancesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteStackInstancesOutput), nil +} + +// DeleteStackInstancesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Deletes stack instances for the specified accounts, in the specified regions. +// +// // Example sending a request using the DeleteStackInstancesRequest method. +// req := client.DeleteStackInstancesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackInstances +func (c *CloudFormation) DeleteStackInstancesRequest(input *DeleteStackInstancesInput) DeleteStackInstancesRequest { + op := &aws.Operation{ + Name: opDeleteStackInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteStackInstancesInput{} + } + + output := &DeleteStackInstancesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteStackInstancesRequest{Request: req, Input: input, Copy: c.DeleteStackInstancesRequest} +} + +const opDeleteStackSet = "DeleteStackSet" + +// DeleteStackSetRequest is a API request type for the DeleteStackSet API operation. +type DeleteStackSetRequest struct { + *aws.Request + Input *DeleteStackSetInput + Copy func(*DeleteStackSetInput) DeleteStackSetRequest +} + +// Send marshals and sends the DeleteStackSet API request. +func (r DeleteStackSetRequest) Send() (*DeleteStackSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteStackSetOutput), nil +} + +// DeleteStackSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Deletes a stack set. Before you can delete a stack set, all of its member +// stack instances must be deleted. For more information about how to do this, +// see DeleteStackInstances. +// +// // Example sending a request using the DeleteStackSetRequest method. +// req := client.DeleteStackSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackSet +func (c *CloudFormation) DeleteStackSetRequest(input *DeleteStackSetInput) DeleteStackSetRequest { + op := &aws.Operation{ + Name: opDeleteStackSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteStackSetInput{} + } + + output := &DeleteStackSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteStackSetRequest{Request: req, Input: input, Copy: c.DeleteStackSetRequest} +} + +const opDescribeAccountLimits = "DescribeAccountLimits" + +// DescribeAccountLimitsRequest is a API request type for the DescribeAccountLimits API operation. +type DescribeAccountLimitsRequest struct { + *aws.Request + Input *DescribeAccountLimitsInput + Copy func(*DescribeAccountLimitsInput) DescribeAccountLimitsRequest +} + +// Send marshals and sends the DescribeAccountLimits API request. +func (r DescribeAccountLimitsRequest) Send() (*DescribeAccountLimitsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeAccountLimitsOutput), nil +} + +// DescribeAccountLimitsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Retrieves your account's AWS CloudFormation limits, such as the maximum number +// of stacks that you can create in your account. +// +// // Example sending a request using the DescribeAccountLimitsRequest method. +// req := client.DescribeAccountLimitsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeAccountLimits +func (c *CloudFormation) DescribeAccountLimitsRequest(input *DescribeAccountLimitsInput) DescribeAccountLimitsRequest { + op := &aws.Operation{ + Name: opDescribeAccountLimits, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeAccountLimitsInput{} + } + + output := &DescribeAccountLimitsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeAccountLimitsRequest{Request: req, Input: input, Copy: c.DescribeAccountLimitsRequest} +} + +const opDescribeChangeSet = "DescribeChangeSet" + +// DescribeChangeSetRequest is a API request type for the DescribeChangeSet API operation. +type DescribeChangeSetRequest struct { + *aws.Request + Input *DescribeChangeSetInput + Copy func(*DescribeChangeSetInput) DescribeChangeSetRequest +} + +// Send marshals and sends the DescribeChangeSet API request. +func (r DescribeChangeSetRequest) Send() (*DescribeChangeSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeChangeSetOutput), nil +} + +// DescribeChangeSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the inputs for the change set and a list of changes that AWS CloudFormation +// will make if you execute the change set. For more information, see Updating +// Stacks Using Change Sets (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-changesets.html) +// in the AWS CloudFormation User Guide. +// +// // Example sending a request using the DescribeChangeSetRequest method. +// req := client.DescribeChangeSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeChangeSet +func (c *CloudFormation) DescribeChangeSetRequest(input *DescribeChangeSetInput) DescribeChangeSetRequest { + op := &aws.Operation{ + Name: opDescribeChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeChangeSetInput{} + } + + output := &DescribeChangeSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeChangeSetRequest{Request: req, Input: input, Copy: c.DescribeChangeSetRequest} +} + +const opDescribeStackEvents = "DescribeStackEvents" + +// DescribeStackEventsRequest is a API request type for the DescribeStackEvents API operation. +type DescribeStackEventsRequest struct { + *aws.Request + Input *DescribeStackEventsInput + Copy func(*DescribeStackEventsInput) DescribeStackEventsRequest +} + +// Send marshals and sends the DescribeStackEvents API request. +func (r DescribeStackEventsRequest) Send() (*DescribeStackEventsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackEventsOutput), nil +} + +// DescribeStackEventsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns all stack related events for a specified stack in reverse chronological +// order. For more information about a stack's event history, go to Stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/concept-stack.html) +// in the AWS CloudFormation User Guide. +// +// You can list events for stacks that have failed to create or have been deleted +// by specifying the unique stack identifier (stack ID). +// +// // Example sending a request using the DescribeStackEventsRequest method. +// req := client.DescribeStackEventsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackEvents +func (c *CloudFormation) DescribeStackEventsRequest(input *DescribeStackEventsInput) DescribeStackEventsRequest { + op := &aws.Operation{ + Name: opDescribeStackEvents, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeStackEventsInput{} + } + + output := &DescribeStackEventsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackEventsRequest{Request: req, Input: input, Copy: c.DescribeStackEventsRequest} +} + +// Paginate pages iterates over the pages of a DescribeStackEventsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeStackEvents operation. +// req := client.DescribeStackEventsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeStackEventsRequest) Paginate(opts ...aws.Option) DescribeStackEventsPager { + return DescribeStackEventsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeStackEventsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeStackEventsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeStackEventsPager struct { + aws.Pager +} + +func (p *DescribeStackEventsPager) CurrentPage() *DescribeStackEventsOutput { + return p.Pager.CurrentPage().(*DescribeStackEventsOutput) +} + +const opDescribeStackInstance = "DescribeStackInstance" + +// DescribeStackInstanceRequest is a API request type for the DescribeStackInstance API operation. +type DescribeStackInstanceRequest struct { + *aws.Request + Input *DescribeStackInstanceInput + Copy func(*DescribeStackInstanceInput) DescribeStackInstanceRequest +} + +// Send marshals and sends the DescribeStackInstance API request. +func (r DescribeStackInstanceRequest) Send() (*DescribeStackInstanceOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackInstanceOutput), nil +} + +// DescribeStackInstanceRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the stack instance that's associated with the specified stack set, +// AWS account, and region. +// +// For a list of stack instances that are associated with a specific stack set, +// use ListStackInstances. +// +// // Example sending a request using the DescribeStackInstanceRequest method. +// req := client.DescribeStackInstanceRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackInstance +func (c *CloudFormation) DescribeStackInstanceRequest(input *DescribeStackInstanceInput) DescribeStackInstanceRequest { + op := &aws.Operation{ + Name: opDescribeStackInstance, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStackInstanceInput{} + } + + output := &DescribeStackInstanceOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackInstanceRequest{Request: req, Input: input, Copy: c.DescribeStackInstanceRequest} +} + +const opDescribeStackResource = "DescribeStackResource" + +// DescribeStackResourceRequest is a API request type for the DescribeStackResource API operation. +type DescribeStackResourceRequest struct { + *aws.Request + Input *DescribeStackResourceInput + Copy func(*DescribeStackResourceInput) DescribeStackResourceRequest +} + +// Send marshals and sends the DescribeStackResource API request. +func (r DescribeStackResourceRequest) Send() (*DescribeStackResourceOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackResourceOutput), nil +} + +// DescribeStackResourceRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns a description of the specified resource in the specified stack. +// +// For deleted stacks, DescribeStackResource returns resource information for +// up to 90 days after the stack has been deleted. +// +// // Example sending a request using the DescribeStackResourceRequest method. +// req := client.DescribeStackResourceRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResource +func (c *CloudFormation) DescribeStackResourceRequest(input *DescribeStackResourceInput) DescribeStackResourceRequest { + op := &aws.Operation{ + Name: opDescribeStackResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStackResourceInput{} + } + + output := &DescribeStackResourceOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackResourceRequest{Request: req, Input: input, Copy: c.DescribeStackResourceRequest} +} + +const opDescribeStackResources = "DescribeStackResources" + +// DescribeStackResourcesRequest is a API request type for the DescribeStackResources API operation. +type DescribeStackResourcesRequest struct { + *aws.Request + Input *DescribeStackResourcesInput + Copy func(*DescribeStackResourcesInput) DescribeStackResourcesRequest +} + +// Send marshals and sends the DescribeStackResources API request. +func (r DescribeStackResourcesRequest) Send() (*DescribeStackResourcesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackResourcesOutput), nil +} + +// DescribeStackResourcesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns AWS resource descriptions for running and deleted stacks. If StackName +// is specified, all the associated resources that are part of the stack are +// returned. If PhysicalResourceId is specified, the associated resources of +// the stack that the resource belongs to are returned. +// +// Only the first 100 resources will be returned. If your stack has more resources +// than this, you should use ListStackResources instead. +// +// For deleted stacks, DescribeStackResources returns resource information for +// up to 90 days after the stack has been deleted. +// +// You must specify either StackName or PhysicalResourceId, but not both. In +// addition, you can specify LogicalResourceId to filter the returned result. +// For more information about resources, the LogicalResourceId and PhysicalResourceId, +// go to the AWS CloudFormation User Guide (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/). +// +// A ValidationError is returned if you specify both StackName and PhysicalResourceId +// in the same request. +// +// // Example sending a request using the DescribeStackResourcesRequest method. +// req := client.DescribeStackResourcesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResources +func (c *CloudFormation) DescribeStackResourcesRequest(input *DescribeStackResourcesInput) DescribeStackResourcesRequest { + op := &aws.Operation{ + Name: opDescribeStackResources, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStackResourcesInput{} + } + + output := &DescribeStackResourcesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackResourcesRequest{Request: req, Input: input, Copy: c.DescribeStackResourcesRequest} +} + +const opDescribeStackSet = "DescribeStackSet" + +// DescribeStackSetRequest is a API request type for the DescribeStackSet API operation. +type DescribeStackSetRequest struct { + *aws.Request + Input *DescribeStackSetInput + Copy func(*DescribeStackSetInput) DescribeStackSetRequest +} + +// Send marshals and sends the DescribeStackSet API request. +func (r DescribeStackSetRequest) Send() (*DescribeStackSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackSetOutput), nil +} + +// DescribeStackSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the description of the specified stack set. +// +// // Example sending a request using the DescribeStackSetRequest method. +// req := client.DescribeStackSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSet +func (c *CloudFormation) DescribeStackSetRequest(input *DescribeStackSetInput) DescribeStackSetRequest { + op := &aws.Operation{ + Name: opDescribeStackSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStackSetInput{} + } + + output := &DescribeStackSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackSetRequest{Request: req, Input: input, Copy: c.DescribeStackSetRequest} +} + +const opDescribeStackSetOperation = "DescribeStackSetOperation" + +// DescribeStackSetOperationRequest is a API request type for the DescribeStackSetOperation API operation. +type DescribeStackSetOperationRequest struct { + *aws.Request + Input *DescribeStackSetOperationInput + Copy func(*DescribeStackSetOperationInput) DescribeStackSetOperationRequest +} + +// Send marshals and sends the DescribeStackSetOperation API request. +func (r DescribeStackSetOperationRequest) Send() (*DescribeStackSetOperationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStackSetOperationOutput), nil +} + +// DescribeStackSetOperationRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the description of the specified stack set operation. +// +// // Example sending a request using the DescribeStackSetOperationRequest method. +// req := client.DescribeStackSetOperationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSetOperation +func (c *CloudFormation) DescribeStackSetOperationRequest(input *DescribeStackSetOperationInput) DescribeStackSetOperationRequest { + op := &aws.Operation{ + Name: opDescribeStackSetOperation, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeStackSetOperationInput{} + } + + output := &DescribeStackSetOperationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStackSetOperationRequest{Request: req, Input: input, Copy: c.DescribeStackSetOperationRequest} +} + +const opDescribeStacks = "DescribeStacks" + +// DescribeStacksRequest is a API request type for the DescribeStacks API operation. +type DescribeStacksRequest struct { + *aws.Request + Input *DescribeStacksInput + Copy func(*DescribeStacksInput) DescribeStacksRequest +} + +// Send marshals and sends the DescribeStacks API request. +func (r DescribeStacksRequest) Send() (*DescribeStacksOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeStacksOutput), nil +} + +// DescribeStacksRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the description for the specified stack; if no stack name was specified, +// then it returns the description for all the stacks created. +// +// If the stack does not exist, an AmazonCloudFormationException is returned. +// +// // Example sending a request using the DescribeStacksRequest method. +// req := client.DescribeStacksRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStacks +func (c *CloudFormation) DescribeStacksRequest(input *DescribeStacksInput) DescribeStacksRequest { + op := &aws.Operation{ + Name: opDescribeStacks, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeStacksInput{} + } + + output := &DescribeStacksOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeStacksRequest{Request: req, Input: input, Copy: c.DescribeStacksRequest} +} + +// Paginate pages iterates over the pages of a DescribeStacksRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeStacks operation. +// req := client.DescribeStacksRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeStacksRequest) Paginate(opts ...aws.Option) DescribeStacksPager { + return DescribeStacksPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeStacksInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeStacksPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeStacksPager struct { + aws.Pager +} + +func (p *DescribeStacksPager) CurrentPage() *DescribeStacksOutput { + return p.Pager.CurrentPage().(*DescribeStacksOutput) +} + +const opEstimateTemplateCost = "EstimateTemplateCost" + +// EstimateTemplateCostRequest is a API request type for the EstimateTemplateCost API operation. +type EstimateTemplateCostRequest struct { + *aws.Request + Input *EstimateTemplateCostInput + Copy func(*EstimateTemplateCostInput) EstimateTemplateCostRequest +} + +// Send marshals and sends the EstimateTemplateCost API request. +func (r EstimateTemplateCostRequest) Send() (*EstimateTemplateCostOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*EstimateTemplateCostOutput), nil +} + +// EstimateTemplateCostRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the estimated monthly cost of a template. The return value is an +// AWS Simple Monthly Calculator URL with a query string that describes the +// resources required to run the template. +// +// // Example sending a request using the EstimateTemplateCostRequest method. +// req := client.EstimateTemplateCostRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/EstimateTemplateCost +func (c *CloudFormation) EstimateTemplateCostRequest(input *EstimateTemplateCostInput) EstimateTemplateCostRequest { + op := &aws.Operation{ + Name: opEstimateTemplateCost, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &EstimateTemplateCostInput{} + } + + output := &EstimateTemplateCostOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return EstimateTemplateCostRequest{Request: req, Input: input, Copy: c.EstimateTemplateCostRequest} +} + +const opExecuteChangeSet = "ExecuteChangeSet" + +// ExecuteChangeSetRequest is a API request type for the ExecuteChangeSet API operation. +type ExecuteChangeSetRequest struct { + *aws.Request + Input *ExecuteChangeSetInput + Copy func(*ExecuteChangeSetInput) ExecuteChangeSetRequest +} + +// Send marshals and sends the ExecuteChangeSet API request. +func (r ExecuteChangeSetRequest) Send() (*ExecuteChangeSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ExecuteChangeSetOutput), nil +} + +// ExecuteChangeSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Updates a stack using the input information that was provided when the specified +// change set was created. After the call successfully completes, AWS CloudFormation +// starts updating the stack. Use the DescribeStacks action to view the status +// of the update. +// +// When you execute a change set, AWS CloudFormation deletes all other change +// sets associated with the stack because they aren't valid for the updated +// stack. +// +// If a stack policy is associated with the stack, AWS CloudFormation enforces +// the policy during the update. You can't specify a temporary stack policy +// that overrides the current policy. +// +// // Example sending a request using the ExecuteChangeSetRequest method. +// req := client.ExecuteChangeSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ExecuteChangeSet +func (c *CloudFormation) ExecuteChangeSetRequest(input *ExecuteChangeSetInput) ExecuteChangeSetRequest { + op := &aws.Operation{ + Name: opExecuteChangeSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ExecuteChangeSetInput{} + } + + output := &ExecuteChangeSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ExecuteChangeSetRequest{Request: req, Input: input, Copy: c.ExecuteChangeSetRequest} +} + +const opGetStackPolicy = "GetStackPolicy" + +// GetStackPolicyRequest is a API request type for the GetStackPolicy API operation. +type GetStackPolicyRequest struct { + *aws.Request + Input *GetStackPolicyInput + Copy func(*GetStackPolicyInput) GetStackPolicyRequest +} + +// Send marshals and sends the GetStackPolicy API request. +func (r GetStackPolicyRequest) Send() (*GetStackPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetStackPolicyOutput), nil +} + +// GetStackPolicyRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the stack policy for a specified stack. If a stack doesn't have a +// policy, a null value is returned. +// +// // Example sending a request using the GetStackPolicyRequest method. +// req := client.GetStackPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetStackPolicy +func (c *CloudFormation) GetStackPolicyRequest(input *GetStackPolicyInput) GetStackPolicyRequest { + op := &aws.Operation{ + Name: opGetStackPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetStackPolicyInput{} + } + + output := &GetStackPolicyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetStackPolicyRequest{Request: req, Input: input, Copy: c.GetStackPolicyRequest} +} + +const opGetTemplate = "GetTemplate" + +// GetTemplateRequest is a API request type for the GetTemplate API operation. +type GetTemplateRequest struct { + *aws.Request + Input *GetTemplateInput + Copy func(*GetTemplateInput) GetTemplateRequest +} + +// Send marshals and sends the GetTemplate API request. +func (r GetTemplateRequest) Send() (*GetTemplateOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetTemplateOutput), nil +} + +// GetTemplateRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the template body for a specified stack. You can get the template +// for running or deleted stacks. +// +// For deleted stacks, GetTemplate returns the template for up to 90 days after +// the stack has been deleted. +// +// If the template does not exist, a ValidationError is returned. +// +// // Example sending a request using the GetTemplateRequest method. +// req := client.GetTemplateRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplate +func (c *CloudFormation) GetTemplateRequest(input *GetTemplateInput) GetTemplateRequest { + op := &aws.Operation{ + Name: opGetTemplate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetTemplateInput{} + } + + output := &GetTemplateOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetTemplateRequest{Request: req, Input: input, Copy: c.GetTemplateRequest} +} + +const opGetTemplateSummary = "GetTemplateSummary" + +// GetTemplateSummaryRequest is a API request type for the GetTemplateSummary API operation. +type GetTemplateSummaryRequest struct { + *aws.Request + Input *GetTemplateSummaryInput + Copy func(*GetTemplateSummaryInput) GetTemplateSummaryRequest +} + +// Send marshals and sends the GetTemplateSummary API request. +func (r GetTemplateSummaryRequest) Send() (*GetTemplateSummaryOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetTemplateSummaryOutput), nil +} + +// GetTemplateSummaryRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns information about a new or existing template. The GetTemplateSummary +// action is useful for viewing parameter information, such as default parameter +// values and parameter types, before you create or update a stack or stack +// set. +// +// You can use the GetTemplateSummary action when you submit a template, or +// you can get template information for a stack set, or a running or deleted +// stack. +// +// For deleted stacks, GetTemplateSummary returns the template information for +// up to 90 days after the stack has been deleted. If the template does not +// exist, a ValidationError is returned. +// +// // Example sending a request using the GetTemplateSummaryRequest method. +// req := client.GetTemplateSummaryRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateSummary +func (c *CloudFormation) GetTemplateSummaryRequest(input *GetTemplateSummaryInput) GetTemplateSummaryRequest { + op := &aws.Operation{ + Name: opGetTemplateSummary, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetTemplateSummaryInput{} + } + + output := &GetTemplateSummaryOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetTemplateSummaryRequest{Request: req, Input: input, Copy: c.GetTemplateSummaryRequest} +} + +const opListChangeSets = "ListChangeSets" + +// ListChangeSetsRequest is a API request type for the ListChangeSets API operation. +type ListChangeSetsRequest struct { + *aws.Request + Input *ListChangeSetsInput + Copy func(*ListChangeSetsInput) ListChangeSetsRequest +} + +// Send marshals and sends the ListChangeSets API request. +func (r ListChangeSetsRequest) Send() (*ListChangeSetsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListChangeSetsOutput), nil +} + +// ListChangeSetsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the ID and status of each active change set for a stack. For example, +// AWS CloudFormation lists change sets that are in the CREATE_IN_PROGRESS or +// CREATE_PENDING state. +// +// // Example sending a request using the ListChangeSetsRequest method. +// req := client.ListChangeSetsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListChangeSets +func (c *CloudFormation) ListChangeSetsRequest(input *ListChangeSetsInput) ListChangeSetsRequest { + op := &aws.Operation{ + Name: opListChangeSets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListChangeSetsInput{} + } + + output := &ListChangeSetsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListChangeSetsRequest{Request: req, Input: input, Copy: c.ListChangeSetsRequest} +} + +const opListExports = "ListExports" + +// ListExportsRequest is a API request type for the ListExports API operation. +type ListExportsRequest struct { + *aws.Request + Input *ListExportsInput + Copy func(*ListExportsInput) ListExportsRequest +} + +// Send marshals and sends the ListExports API request. +func (r ListExportsRequest) Send() (*ListExportsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListExportsOutput), nil +} + +// ListExportsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Lists all exported output values in the account and region in which you call +// this action. Use this action to see the exported output values that you can +// import into other stacks. To import values, use the Fn::ImportValue (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html) +// function. +// +// For more information, see AWS CloudFormation Export Stack Output Values +// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html). +// +// // Example sending a request using the ListExportsRequest method. +// req := client.ListExportsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListExports +func (c *CloudFormation) ListExportsRequest(input *ListExportsInput) ListExportsRequest { + op := &aws.Operation{ + Name: opListExports, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListExportsInput{} + } + + output := &ListExportsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListExportsRequest{Request: req, Input: input, Copy: c.ListExportsRequest} +} + +// Paginate pages iterates over the pages of a ListExportsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListExports operation. +// req := client.ListExportsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListExportsRequest) Paginate(opts ...aws.Option) ListExportsPager { + return ListExportsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListExportsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListExportsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListExportsPager struct { + aws.Pager +} + +func (p *ListExportsPager) CurrentPage() *ListExportsOutput { + return p.Pager.CurrentPage().(*ListExportsOutput) +} + +const opListImports = "ListImports" + +// ListImportsRequest is a API request type for the ListImports API operation. +type ListImportsRequest struct { + *aws.Request + Input *ListImportsInput + Copy func(*ListImportsInput) ListImportsRequest +} + +// Send marshals and sends the ListImports API request. +func (r ListImportsRequest) Send() (*ListImportsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListImportsOutput), nil +} + +// ListImportsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Lists all stacks that are importing an exported output value. To modify or +// remove an exported output value, first use this action to see which stacks +// are using it. To see the exported output values in your account, see ListExports. +// +// For more information about importing an exported output value, see the Fn::ImportValue +// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html) +// function. +// +// // Example sending a request using the ListImportsRequest method. +// req := client.ListImportsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListImports +func (c *CloudFormation) ListImportsRequest(input *ListImportsInput) ListImportsRequest { + op := &aws.Operation{ + Name: opListImports, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListImportsInput{} + } + + output := &ListImportsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListImportsRequest{Request: req, Input: input, Copy: c.ListImportsRequest} +} + +// Paginate pages iterates over the pages of a ListImportsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListImports operation. +// req := client.ListImportsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListImportsRequest) Paginate(opts ...aws.Option) ListImportsPager { + return ListImportsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListImportsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListImportsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListImportsPager struct { + aws.Pager +} + +func (p *ListImportsPager) CurrentPage() *ListImportsOutput { + return p.Pager.CurrentPage().(*ListImportsOutput) +} + +const opListStackInstances = "ListStackInstances" + +// ListStackInstancesRequest is a API request type for the ListStackInstances API operation. +type ListStackInstancesRequest struct { + *aws.Request + Input *ListStackInstancesInput + Copy func(*ListStackInstancesInput) ListStackInstancesRequest +} + +// Send marshals and sends the ListStackInstances API request. +func (r ListStackInstancesRequest) Send() (*ListStackInstancesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStackInstancesOutput), nil +} + +// ListStackInstancesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns summary information about stack instances that are associated with +// the specified stack set. You can filter for stack instances that are associated +// with a specific AWS account name or region. +// +// // Example sending a request using the ListStackInstancesRequest method. +// req := client.ListStackInstancesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackInstances +func (c *CloudFormation) ListStackInstancesRequest(input *ListStackInstancesInput) ListStackInstancesRequest { + op := &aws.Operation{ + Name: opListStackInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListStackInstancesInput{} + } + + output := &ListStackInstancesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStackInstancesRequest{Request: req, Input: input, Copy: c.ListStackInstancesRequest} +} + +const opListStackResources = "ListStackResources" + +// ListStackResourcesRequest is a API request type for the ListStackResources API operation. +type ListStackResourcesRequest struct { + *aws.Request + Input *ListStackResourcesInput + Copy func(*ListStackResourcesInput) ListStackResourcesRequest +} + +// Send marshals and sends the ListStackResources API request. +func (r ListStackResourcesRequest) Send() (*ListStackResourcesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStackResourcesOutput), nil +} + +// ListStackResourcesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns descriptions of all resources of the specified stack. +// +// For deleted stacks, ListStackResources returns resource information for up +// to 90 days after the stack has been deleted. +// +// // Example sending a request using the ListStackResourcesRequest method. +// req := client.ListStackResourcesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackResources +func (c *CloudFormation) ListStackResourcesRequest(input *ListStackResourcesInput) ListStackResourcesRequest { + op := &aws.Operation{ + Name: opListStackResources, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListStackResourcesInput{} + } + + output := &ListStackResourcesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStackResourcesRequest{Request: req, Input: input, Copy: c.ListStackResourcesRequest} +} + +// Paginate pages iterates over the pages of a ListStackResourcesRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListStackResources operation. +// req := client.ListStackResourcesRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListStackResourcesRequest) Paginate(opts ...aws.Option) ListStackResourcesPager { + return ListStackResourcesPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListStackResourcesInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListStackResourcesPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListStackResourcesPager struct { + aws.Pager +} + +func (p *ListStackResourcesPager) CurrentPage() *ListStackResourcesOutput { + return p.Pager.CurrentPage().(*ListStackResourcesOutput) +} + +const opListStackSetOperationResults = "ListStackSetOperationResults" + +// ListStackSetOperationResultsRequest is a API request type for the ListStackSetOperationResults API operation. +type ListStackSetOperationResultsRequest struct { + *aws.Request + Input *ListStackSetOperationResultsInput + Copy func(*ListStackSetOperationResultsInput) ListStackSetOperationResultsRequest +} + +// Send marshals and sends the ListStackSetOperationResults API request. +func (r ListStackSetOperationResultsRequest) Send() (*ListStackSetOperationResultsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStackSetOperationResultsOutput), nil +} + +// ListStackSetOperationResultsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns summary information about the results of a stack set operation. +// +// // Example sending a request using the ListStackSetOperationResultsRequest method. +// req := client.ListStackSetOperationResultsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperationResults +func (c *CloudFormation) ListStackSetOperationResultsRequest(input *ListStackSetOperationResultsInput) ListStackSetOperationResultsRequest { + op := &aws.Operation{ + Name: opListStackSetOperationResults, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListStackSetOperationResultsInput{} + } + + output := &ListStackSetOperationResultsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStackSetOperationResultsRequest{Request: req, Input: input, Copy: c.ListStackSetOperationResultsRequest} +} + +const opListStackSetOperations = "ListStackSetOperations" + +// ListStackSetOperationsRequest is a API request type for the ListStackSetOperations API operation. +type ListStackSetOperationsRequest struct { + *aws.Request + Input *ListStackSetOperationsInput + Copy func(*ListStackSetOperationsInput) ListStackSetOperationsRequest +} + +// Send marshals and sends the ListStackSetOperations API request. +func (r ListStackSetOperationsRequest) Send() (*ListStackSetOperationsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStackSetOperationsOutput), nil +} + +// ListStackSetOperationsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns summary information about operations performed on a stack set. +// +// // Example sending a request using the ListStackSetOperationsRequest method. +// req := client.ListStackSetOperationsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperations +func (c *CloudFormation) ListStackSetOperationsRequest(input *ListStackSetOperationsInput) ListStackSetOperationsRequest { + op := &aws.Operation{ + Name: opListStackSetOperations, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListStackSetOperationsInput{} + } + + output := &ListStackSetOperationsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStackSetOperationsRequest{Request: req, Input: input, Copy: c.ListStackSetOperationsRequest} +} + +const opListStackSets = "ListStackSets" + +// ListStackSetsRequest is a API request type for the ListStackSets API operation. +type ListStackSetsRequest struct { + *aws.Request + Input *ListStackSetsInput + Copy func(*ListStackSetsInput) ListStackSetsRequest +} + +// Send marshals and sends the ListStackSets API request. +func (r ListStackSetsRequest) Send() (*ListStackSetsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStackSetsOutput), nil +} + +// ListStackSetsRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns summary information about stack sets that are associated with the +// user. +// +// // Example sending a request using the ListStackSetsRequest method. +// req := client.ListStackSetsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSets +func (c *CloudFormation) ListStackSetsRequest(input *ListStackSetsInput) ListStackSetsRequest { + op := &aws.Operation{ + Name: opListStackSets, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListStackSetsInput{} + } + + output := &ListStackSetsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStackSetsRequest{Request: req, Input: input, Copy: c.ListStackSetsRequest} +} + +const opListStacks = "ListStacks" + +// ListStacksRequest is a API request type for the ListStacks API operation. +type ListStacksRequest struct { + *aws.Request + Input *ListStacksInput + Copy func(*ListStacksInput) ListStacksRequest +} + +// Send marshals and sends the ListStacks API request. +func (r ListStacksRequest) Send() (*ListStacksOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListStacksOutput), nil +} + +// ListStacksRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Returns the summary information for stacks whose status matches the specified +// StackStatusFilter. Summary information for stacks that have been deleted +// is kept for 90 days after the stack is deleted. If no StackStatusFilter is +// specified, summary information for all stacks is returned (including existing +// stacks and stacks that have been deleted). +// +// // Example sending a request using the ListStacksRequest method. +// req := client.ListStacksRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStacks +func (c *CloudFormation) ListStacksRequest(input *ListStacksInput) ListStacksRequest { + op := &aws.Operation{ + Name: opListStacks, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListStacksInput{} + } + + output := &ListStacksOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListStacksRequest{Request: req, Input: input, Copy: c.ListStacksRequest} +} + +// Paginate pages iterates over the pages of a ListStacksRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListStacks operation. +// req := client.ListStacksRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListStacksRequest) Paginate(opts ...aws.Option) ListStacksPager { + return ListStacksPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListStacksInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListStacksPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListStacksPager struct { + aws.Pager +} + +func (p *ListStacksPager) CurrentPage() *ListStacksOutput { + return p.Pager.CurrentPage().(*ListStacksOutput) +} + +const opSetStackPolicy = "SetStackPolicy" + +// SetStackPolicyRequest is a API request type for the SetStackPolicy API operation. +type SetStackPolicyRequest struct { + *aws.Request + Input *SetStackPolicyInput + Copy func(*SetStackPolicyInput) SetStackPolicyRequest +} + +// Send marshals and sends the SetStackPolicy API request. +func (r SetStackPolicyRequest) Send() (*SetStackPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*SetStackPolicyOutput), nil +} + +// SetStackPolicyRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Sets a stack policy for a specified stack. +// +// // Example sending a request using the SetStackPolicyRequest method. +// req := client.SetStackPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SetStackPolicy +func (c *CloudFormation) SetStackPolicyRequest(input *SetStackPolicyInput) SetStackPolicyRequest { + op := &aws.Operation{ + Name: opSetStackPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &SetStackPolicyInput{} + } + + output := &SetStackPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return SetStackPolicyRequest{Request: req, Input: input, Copy: c.SetStackPolicyRequest} +} + +const opSignalResource = "SignalResource" + +// SignalResourceRequest is a API request type for the SignalResource API operation. +type SignalResourceRequest struct { + *aws.Request + Input *SignalResourceInput + Copy func(*SignalResourceInput) SignalResourceRequest +} + +// Send marshals and sends the SignalResource API request. +func (r SignalResourceRequest) Send() (*SignalResourceOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*SignalResourceOutput), nil +} + +// SignalResourceRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Sends a signal to the specified resource with a success or failure status. +// You can use the SignalResource API in conjunction with a creation policy +// or update policy. AWS CloudFormation doesn't proceed with a stack creation +// or update until resources receive the required number of signals or the timeout +// period is exceeded. The SignalResource API is useful in cases where you want +// to send signals from anywhere other than an Amazon EC2 instance. +// +// // Example sending a request using the SignalResourceRequest method. +// req := client.SignalResourceRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SignalResource +func (c *CloudFormation) SignalResourceRequest(input *SignalResourceInput) SignalResourceRequest { + op := &aws.Operation{ + Name: opSignalResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &SignalResourceInput{} + } + + output := &SignalResourceOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return SignalResourceRequest{Request: req, Input: input, Copy: c.SignalResourceRequest} +} + +const opStopStackSetOperation = "StopStackSetOperation" + +// StopStackSetOperationRequest is a API request type for the StopStackSetOperation API operation. +type StopStackSetOperationRequest struct { + *aws.Request + Input *StopStackSetOperationInput + Copy func(*StopStackSetOperationInput) StopStackSetOperationRequest +} + +// Send marshals and sends the StopStackSetOperation API request. +func (r StopStackSetOperationRequest) Send() (*StopStackSetOperationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*StopStackSetOperationOutput), nil +} + +// StopStackSetOperationRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Stops an in-progress operation on a stack set and its associated stack instances. +// +// // Example sending a request using the StopStackSetOperationRequest method. +// req := client.StopStackSetOperationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StopStackSetOperation +func (c *CloudFormation) StopStackSetOperationRequest(input *StopStackSetOperationInput) StopStackSetOperationRequest { + op := &aws.Operation{ + Name: opStopStackSetOperation, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StopStackSetOperationInput{} + } + + output := &StopStackSetOperationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return StopStackSetOperationRequest{Request: req, Input: input, Copy: c.StopStackSetOperationRequest} +} + +const opUpdateStack = "UpdateStack" + +// UpdateStackRequest is a API request type for the UpdateStack API operation. +type UpdateStackRequest struct { + *aws.Request + Input *UpdateStackInput + Copy func(*UpdateStackInput) UpdateStackRequest +} + +// Send marshals and sends the UpdateStack API request. +func (r UpdateStackRequest) Send() (*UpdateStackOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateStackOutput), nil +} + +// UpdateStackRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Updates a stack as specified in the template. After the call completes successfully, +// the stack update starts. You can check the status of the stack via the DescribeStacks +// action. +// +// To get a copy of the template for an existing stack, you can use the GetTemplate +// action. +// +// For more information about creating an update template, updating a stack, +// and monitoring the progress of the update, see Updating a Stack (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html). +// +// // Example sending a request using the UpdateStackRequest method. +// req := client.UpdateStackRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStack +func (c *CloudFormation) UpdateStackRequest(input *UpdateStackInput) UpdateStackRequest { + op := &aws.Operation{ + Name: opUpdateStack, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateStackInput{} + } + + output := &UpdateStackOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateStackRequest{Request: req, Input: input, Copy: c.UpdateStackRequest} +} + +const opUpdateStackInstances = "UpdateStackInstances" + +// UpdateStackInstancesRequest is a API request type for the UpdateStackInstances API operation. +type UpdateStackInstancesRequest struct { + *aws.Request + Input *UpdateStackInstancesInput + Copy func(*UpdateStackInstancesInput) UpdateStackInstancesRequest +} + +// Send marshals and sends the UpdateStackInstances API request. +func (r UpdateStackInstancesRequest) Send() (*UpdateStackInstancesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateStackInstancesOutput), nil +} + +// UpdateStackInstancesRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Updates the parameter values for stack instances for the specified accounts, +// within the specified regions. A stack instance refers to a stack in a specific +// account and region. +// +// You can only update stack instances in regions and accounts where they already +// exist; to create additional stack instances, use CreateStackInstances (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStackInstances.html). +// +// During stack set updates, any parameters overridden for a stack instance +// are not updated, but retain their overridden value. +// +// You can only update the parameter values that are specified in the stack +// set; to add or delete a parameter itself, use UpdateStackSet (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) +// to update the stack set template. If you add a parameter to a template, before +// you can override the parameter value specified in the stack set you must +// first use UpdateStackSet (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) +// to update all stack instances with the updated template and parameter value +// specified in the stack set. Once a stack instance has been updated with the +// new parameter, you can then override the parameter value using UpdateStackInstances. +// +// // Example sending a request using the UpdateStackInstancesRequest method. +// req := client.UpdateStackInstancesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackInstances +func (c *CloudFormation) UpdateStackInstancesRequest(input *UpdateStackInstancesInput) UpdateStackInstancesRequest { + op := &aws.Operation{ + Name: opUpdateStackInstances, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateStackInstancesInput{} + } + + output := &UpdateStackInstancesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateStackInstancesRequest{Request: req, Input: input, Copy: c.UpdateStackInstancesRequest} +} + +const opUpdateStackSet = "UpdateStackSet" + +// UpdateStackSetRequest is a API request type for the UpdateStackSet API operation. +type UpdateStackSetRequest struct { + *aws.Request + Input *UpdateStackSetInput + Copy func(*UpdateStackSetInput) UpdateStackSetRequest +} + +// Send marshals and sends the UpdateStackSet API request. +func (r UpdateStackSetRequest) Send() (*UpdateStackSetOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateStackSetOutput), nil +} + +// UpdateStackSetRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Updates the stack set, and associated stack instances in the specified accounts +// and regions. +// +// Even if the stack set operation created by updating the stack set fails (completely +// or partially, below or above a specified failure tolerance), the stack set +// is updated with your changes. Subsequent CreateStackInstances calls on the +// specified stack set use the updated stack set. +// +// // Example sending a request using the UpdateStackSetRequest method. +// req := client.UpdateStackSetRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackSet +func (c *CloudFormation) UpdateStackSetRequest(input *UpdateStackSetInput) UpdateStackSetRequest { + op := &aws.Operation{ + Name: opUpdateStackSet, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateStackSetInput{} + } + + output := &UpdateStackSetOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateStackSetRequest{Request: req, Input: input, Copy: c.UpdateStackSetRequest} +} + +const opUpdateTerminationProtection = "UpdateTerminationProtection" + +// UpdateTerminationProtectionRequest is a API request type for the UpdateTerminationProtection API operation. +type UpdateTerminationProtectionRequest struct { + *aws.Request + Input *UpdateTerminationProtectionInput + Copy func(*UpdateTerminationProtectionInput) UpdateTerminationProtectionRequest +} + +// Send marshals and sends the UpdateTerminationProtection API request. +func (r UpdateTerminationProtectionRequest) Send() (*UpdateTerminationProtectionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateTerminationProtectionOutput), nil +} + +// UpdateTerminationProtectionRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Updates termination protection for the specified stack. If a user attempts +// to delete a stack with termination protection enabled, the operation fails +// and the stack remains unchanged. For more information, see Protecting a Stack +// From Being Deleted (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-protect-stacks.html) +// in the AWS CloudFormation User Guide. +// +// For nested stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html), +// termination protection is set on the root stack and cannot be changed directly +// on the nested stack. +// +// // Example sending a request using the UpdateTerminationProtectionRequest method. +// req := client.UpdateTerminationProtectionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateTerminationProtection +func (c *CloudFormation) UpdateTerminationProtectionRequest(input *UpdateTerminationProtectionInput) UpdateTerminationProtectionRequest { + op := &aws.Operation{ + Name: opUpdateTerminationProtection, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateTerminationProtectionInput{} + } + + output := &UpdateTerminationProtectionOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateTerminationProtectionRequest{Request: req, Input: input, Copy: c.UpdateTerminationProtectionRequest} +} + +const opValidateTemplate = "ValidateTemplate" + +// ValidateTemplateRequest is a API request type for the ValidateTemplate API operation. +type ValidateTemplateRequest struct { + *aws.Request + Input *ValidateTemplateInput + Copy func(*ValidateTemplateInput) ValidateTemplateRequest +} + +// Send marshals and sends the ValidateTemplate API request. +func (r ValidateTemplateRequest) Send() (*ValidateTemplateOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ValidateTemplateOutput), nil +} + +// ValidateTemplateRequest returns a request value for making API operation for +// AWS CloudFormation. +// +// Validates a specified template. AWS CloudFormation first checks if the template +// is valid JSON. If it isn't, AWS CloudFormation checks if the template is +// valid YAML. If both these checks fail, AWS CloudFormation returns a template +// validation error. +// +// // Example sending a request using the ValidateTemplateRequest method. +// req := client.ValidateTemplateRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ValidateTemplate +func (c *CloudFormation) ValidateTemplateRequest(input *ValidateTemplateInput) ValidateTemplateRequest { + op := &aws.Operation{ + Name: opValidateTemplate, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ValidateTemplateInput{} + } + + output := &ValidateTemplateOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ValidateTemplateRequest{Request: req, Input: input, Copy: c.ValidateTemplateRequest} +} + +// Structure that contains the results of the account gate function which AWS +// CloudFormation invokes, if present, before proceeding with a stack set operation +// in an account and region. +// +// For each account and region, AWS CloudFormation lets you specify a Lamdba +// function that encapsulates any requirements that must be met before CloudFormation +// can proceed with a stack set operation in that account and region. CloudFormation +// invokes the function each time a stack set operation is requested for that +// account and region; if the function returns FAILED, CloudFormation cancels +// the operation in that account and region, and sets the stack set operation +// result status for that account and region to FAILED. +// +// For more information, see Configuring a target account gate (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-account-gating.html). +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/AccountGateResult +type AccountGateResult struct { + _ struct{} `type:"structure"` + + // The status of the account gate function. + // + // * SUCCEEDED: The account gate function has determined that the account + // and region passes any requirements for a stack set operation to occur. + // AWS CloudFormation proceeds with the stack operation in that account and + // region. + // + // * FAILED: The account gate function has determined that the account and + // region does not meet the requirements for a stack set operation to occur. + // AWS CloudFormation cancels the stack set operation in that account and + // region, and sets the stack set operation result status for that account + // and region to FAILED. + // + // * SKIPPED: AWS CloudFormation has skipped calling the account gate function + // for this account and region, for one of the following reasons: + // + // An account gate function has not been specified for the account and region. + // AWS CloudFormation proceeds with the stack set operation in this account + // and region. + // + // The AWSCloudFormationStackSetExecutionRole of the stack set adminstration + // account lacks permissions to invoke the function. AWS CloudFormation proceeds + // with the stack set operation in this account and region. + // + // Either no action is necessary, or no action is possible, on the stack. AWS + // CloudFormation skips the stack set operation in this account and region. + Status AccountGateStatus `type:"string" enum:"true"` + + // The reason for the account gate status assigned to this account and region + // for the stack set operation. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s AccountGateResult) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccountGateResult) GoString() string { + return s.String() +} + +// The AccountLimit data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/AccountLimit +type AccountLimit struct { + _ struct{} `type:"structure"` + + // The name of the account limit. Currently, the only account limit is StackLimit. + Name *string `type:"string"` + + // The value that is associated with the account limit name. + Value *int64 `type:"integer"` +} + +// String returns the string representation +func (s AccountLimit) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccountLimit) GoString() string { + return s.String() +} + +// The input for the CancelUpdateStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CancelUpdateStackInput +type CancelUpdateStackInput struct { + _ struct{} `type:"structure"` + + // A unique identifier for this CancelUpdateStack request. Specify this token + // if you plan to retry requests so that AWS CloudFormation knows that you're + // not attempting to cancel an update on a stack with the same name. You might + // retry CancelUpdateStack requests to ensure that AWS CloudFormation successfully + // received them. + ClientRequestToken *string `min:"1" type:"string"` + + // The name or the unique stack ID that is associated with the stack. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s CancelUpdateStackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelUpdateStackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelUpdateStackInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CancelUpdateStackInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CancelUpdateStackOutput +type CancelUpdateStackOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s CancelUpdateStackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelUpdateStackOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CancelUpdateStackOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The Change structure describes the changes AWS CloudFormation will perform +// if you execute the change set. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Change +type Change struct { + _ struct{} `type:"structure"` + + // A ResourceChange structure that describes the resource and action that AWS + // CloudFormation will perform. + ResourceChange *ResourceChange `type:"structure"` + + // The type of entity that AWS CloudFormation changes. Currently, the only entity + // type is Resource. + Type ChangeType `type:"string" enum:"true"` +} + +// String returns the string representation +func (s Change) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Change) GoString() string { + return s.String() +} + +// The ChangeSetSummary structure describes a change set, its status, and the +// stack with which it's associated. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ChangeSetSummary +type ChangeSetSummary struct { + _ struct{} `type:"structure"` + + // The ID of the change set. + ChangeSetId *string `min:"1" type:"string"` + + // The name of the change set. + ChangeSetName *string `min:"1" type:"string"` + + // The start time when the change set was created, in UTC. + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Descriptive information about the change set. + Description *string `min:"1" type:"string"` + + // If the change set execution status is AVAILABLE, you can execute the change + // set. If you can’t execute the change set, the status indicates why. For example, + // a change set might be in an UNAVAILABLE state because AWS CloudFormation + // is still creating it or in an OBSOLETE state because the stack was already + // updated. + ExecutionStatus ExecutionStatus `type:"string" enum:"true"` + + // The ID of the stack with which the change set is associated. + StackId *string `type:"string"` + + // The name of the stack with which the change set is associated. + StackName *string `type:"string"` + + // The state of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, + // or FAILED. + Status ChangeSetStatus `type:"string" enum:"true"` + + // A description of the change set's status. For example, if your change set + // is in the FAILED state, AWS CloudFormation shows the error message. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s ChangeSetSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ChangeSetSummary) GoString() string { + return s.String() +} + +// The input for the ContinueUpdateRollback action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ContinueUpdateRollbackInput +type ContinueUpdateRollbackInput struct { + _ struct{} `type:"structure"` + + // A unique identifier for this ContinueUpdateRollback request. Specify this + // token if you plan to retry requests so that AWS CloudFormation knows that + // you're not attempting to continue the rollback to a stack with the same name. + // You might retry ContinueUpdateRollback requests to ensure that AWS CloudFormation + // successfully received them. + ClientRequestToken *string `min:"1" type:"string"` + + // A list of the logical IDs of the resources that AWS CloudFormation skips + // during the continue update rollback operation. You can specify only resources + // that are in the UPDATE_FAILED state because a rollback failed. You can't + // specify resources that are in the UPDATE_FAILED state for other reasons, + // for example, because an update was cancelled. To check why a resource update + // failed, use the DescribeStackResources action, and view the resource status + // reason. + // + // Specify this property to skip rolling back resources that AWS CloudFormation + // can't successfully roll back. We recommend that you troubleshoot (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/troubleshooting.html#troubleshooting-errors-update-rollback-failed) + // resources before skipping them. AWS CloudFormation sets the status of the + // specified resources to UPDATE_COMPLETE and continues to roll back the stack. + // After the rollback is complete, the state of the skipped resources will be + // inconsistent with the state of the resources in the stack template. Before + // performing another stack update, you must update the stack or resources to + // be consistent with each other. If you don't, subsequent stack updates might + // fail, and the stack will become unrecoverable. + // + // Specify the minimum number of resources required to successfully roll back + // your stack. For example, a failed resource update might cause dependent resources + // to fail. In this case, it might not be necessary to skip the dependent resources. + // + // To skip resources that are part of nested stacks, use the following format: + // NestedStackName.ResourceLogicalID. If you want to specify the logical ID + // of a stack resource (Type: AWS::CloudFormation::Stack) in the ResourcesToSkip + // list, then its corresponding embedded stack must be in one of the following + // states: DELETE_IN_PROGRESS, DELETE_COMPLETE, or DELETE_FAILED. + // + // Don't confuse a child stack's name with its corresponding logical ID defined + // in the parent stack. For an example of a continue update rollback operation + // with nested stacks, see Using ResourcesToSkip to recover a nested stacks + // hierarchy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-continueupdaterollback.html#nested-stacks). + ResourcesToSkip []string `type:"list"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that AWS CloudFormation assumes to roll back the stack. AWS CloudFormation + // uses the role's credentials to make calls on your behalf. AWS CloudFormation + // always uses this role for all future operations on the stack. As long as + // users have permission to operate on the stack, AWS CloudFormation uses this + // role even if the users don't have permission to pass it. Ensure that the + // role grants least privilege. + // + // If you don't specify a value, AWS CloudFormation uses the role that was previously + // associated with the stack. If no role is available, AWS CloudFormation uses + // a temporary session that is generated from your user credentials. + RoleARN *string `min:"20" type:"string"` + + // The name or the unique ID of the stack that you want to continue rolling + // back. + // + // Don't specify the name of a nested stack (a stack that was created by using + // the AWS::CloudFormation::Stack resource). Instead, use this operation on + // the parent stack (the stack that contains the AWS::CloudFormation::Stack + // resource). + // + // StackName is a required field + StackName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ContinueUpdateRollbackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ContinueUpdateRollbackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ContinueUpdateRollbackInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ContinueUpdateRollbackInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleARN", 20)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a ContinueUpdateRollback action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ContinueUpdateRollbackOutput +type ContinueUpdateRollbackOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s ContinueUpdateRollbackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ContinueUpdateRollbackOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ContinueUpdateRollbackOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the CreateChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateChangeSetInput +type CreateChangeSetInput struct { + _ struct{} `type:"structure"` + + // A list of values that you must specify before AWS CloudFormation can update + // certain stacks. Some stack templates might include resources that can affect + // permissions in your AWS account, for example, by creating new AWS Identity + // and Access Management (IAM) users. For those stacks, you must explicitly + // acknowledge their capabilities by specifying this parameter. + // + // The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following + // resources require you to specify this parameter: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), + // AWS::IAM::Group (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html), + // AWS::IAM::InstanceProfile (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html), + // AWS::IAM::Policy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html), + // AWS::IAM::Role (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html), + // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), + // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). + // If your stack template contains these resources, we recommend that you review + // all permissions associated with them and edit their permissions if necessary. + // + // If you have IAM resources, you can specify either capability. If you have + // IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If + // you don't specify this parameter, this action returns an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). + Capabilities []Capability `type:"list"` + + // The name of the change set. The name must be unique among all change sets + // that are associated with the specified stack. + // + // A change set name can contain only alphanumeric, case sensitive characters + // and hyphens. It must start with an alphabetic character and cannot exceed + // 128 characters. + // + // ChangeSetName is a required field + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // The type of change set operation. To create a change set for a new stack, + // specify CREATE. To create a change set for an existing stack, specify UPDATE. + // + // If you create a change set for a new stack, AWS Cloudformation creates a + // stack with a unique stack ID, but no template or resources. The stack will + // be in the REVIEW_IN_PROGRESS (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html#d0e11995) + // state until you execute the change set. + // + // By default, AWS CloudFormation specifies UPDATE. You can't use the UPDATE + // type to create a change set for a new stack or the CREATE type to create + // a change set for an existing stack. + ChangeSetType ChangeSetType `type:"string" enum:"true"` + + // A unique identifier for this CreateChangeSet request. Specify this token + // if you plan to retry requests so that AWS CloudFormation knows that you're + // not attempting to create another change set with the same name. You might + // retry CreateChangeSet requests to ensure that AWS CloudFormation successfully + // received them. + ClientToken *string `min:"1" type:"string"` + + // A description to help you identify this change set. + Description *string `min:"1" type:"string"` + + // The Amazon Resource Names (ARNs) of Amazon Simple Notification Service (Amazon + // SNS) topics that AWS CloudFormation associates with the stack. To remove + // all associated notification topics, specify an empty list. + NotificationARNs []string `type:"list"` + + // A list of Parameter structures that specify input parameters for the change + // set. For more information, see the Parameter (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []Parameter `type:"list"` + + // The template resource types that you have permissions to work with if you + // execute this change set, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. + // + // If the list of resource types doesn't include a resource type that you're + // updating, the stack update fails. By default, AWS CloudFormation grants permissions + // to all resource types. AWS Identity and Access Management (IAM) uses this + // parameter for condition keys in IAM policies for AWS CloudFormation. For + // more information, see Controlling Access with AWS Identity and Access Management + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html) + // in the AWS CloudFormation User Guide. + ResourceTypes []string `type:"list"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that AWS CloudFormation assumes when executing the change set. AWS CloudFormation + // uses the role's credentials to make calls on your behalf. AWS CloudFormation + // uses this role for all future operations on the stack. As long as users have + // permission to operate on the stack, AWS CloudFormation uses this role even + // if the users don't have permission to pass it. Ensure that the role grants + // least privilege. + // + // If you don't specify a value, AWS CloudFormation uses the role that was previously + // associated with the stack. If no role is available, AWS CloudFormation uses + // a temporary session that is generated from your user credentials. + RoleARN *string `min:"20" type:"string"` + + // The rollback triggers for AWS CloudFormation to monitor during stack creation + // and updating operations, and for the specified monitoring period afterwards. + RollbackConfiguration *RollbackConfiguration `type:"structure"` + + // The name or the unique ID of the stack for which you are creating a change + // set. AWS CloudFormation generates the change set by comparing this stack's + // information with the information that you submit, such as a modified template + // or different parameter input values. + // + // StackName is a required field + StackName *string `min:"1" type:"string" required:"true"` + + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to resources in the stack. You can specify a maximum of 50 tags. + Tags []Tag `type:"list"` + + // A structure that contains the body of the revised template, with a minimum + // length of 1 byte and a maximum length of 51,200 bytes. AWS CloudFormation + // generates the change set by comparing this template with the template of + // the stack that you specified. + // + // Conditional: You must specify only TemplateBody or TemplateURL. + TemplateBody *string `min:"1" type:"string"` + + // The location of the file that contains the revised template. The URL must + // point to a template (max size: 460,800 bytes) that is located in an S3 bucket. + // AWS CloudFormation generates the change set by comparing this template with + // the stack that you specified. + // + // Conditional: You must specify only TemplateBody or TemplateURL. + TemplateURL *string `min:"1" type:"string"` + + // Whether to reuse the template that is associated with the stack to create + // the change set. + UsePreviousTemplate *bool `type:"boolean"` +} + +// String returns the string representation +func (s CreateChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateChangeSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateChangeSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateChangeSetInput"} + + if s.ChangeSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("ChangeSetName")) + } + if s.ChangeSetName != nil && len(*s.ChangeSetName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ChangeSetName", 1)) + } + if s.ClientToken != nil && len(*s.ClientToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientToken", 1)) + } + if s.Description != nil && len(*s.Description) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Description", 1)) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleARN", 20)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + if s.RollbackConfiguration != nil { + if err := s.RollbackConfiguration.Validate(); err != nil { + invalidParams.AddNested("RollbackConfiguration", err.(aws.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the CreateChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateChangeSetOutput +type CreateChangeSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The Amazon Resource Name (ARN) of the change set. + Id *string `min:"1" type:"string"` + + // The unique ID of the stack. + StackId *string `type:"string"` +} + +// String returns the string representation +func (s CreateChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateChangeSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateChangeSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for CreateStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackInput +type CreateStackInput struct { + _ struct{} `type:"structure"` + + // A list of values that you must specify before AWS CloudFormation can create + // certain stacks. Some stack templates might include resources that can affect + // permissions in your AWS account, for example, by creating new AWS Identity + // and Access Management (IAM) users. For those stacks, you must explicitly + // acknowledge their capabilities by specifying this parameter. + // + // The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following + // resources require you to specify this parameter: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), + // AWS::IAM::Group (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html), + // AWS::IAM::InstanceProfile (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html), + // AWS::IAM::Policy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html), + // AWS::IAM::Role (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html), + // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), + // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). + // If your stack template contains these resources, we recommend that you review + // all permissions associated with them and edit their permissions if necessary. + // + // If you have IAM resources, you can specify either capability. If you have + // IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If + // you don't specify this parameter, this action returns an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). + Capabilities []Capability `type:"list"` + + // A unique identifier for this CreateStack request. Specify this token if you + // plan to retry requests so that AWS CloudFormation knows that you're not attempting + // to create a stack with the same name. You might retry CreateStack requests + // to ensure that AWS CloudFormation successfully received them. + // + // All events triggered by a given stack operation are assigned the same client + // request token, which you can use to track operations. For example, if you + // execute a CreateStack operation with the token token1, then all the StackEvents + // generated by that operation will have ClientRequestToken set as token1. + // + // In the console, stack operations display the client request token on the + // Events tab. Stack operations that are initiated from the console use the + // token format Console-StackOperation-ID, which helps you easily identify the + // stack operation . For example, if you create a stack using the console, each + // stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. + ClientRequestToken *string `min:"1" type:"string"` + + // Set to true to disable rollback of the stack if stack creation failed. You + // can specify either DisableRollback or OnFailure, but not both. + // + // Default: false + DisableRollback *bool `type:"boolean"` + + // Whether to enable termination protection on the specified stack. If a user + // attempts to delete a stack with termination protection enabled, the operation + // fails and the stack remains unchanged. For more information, see Protecting + // a Stack From Being Deleted (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-protect-stacks.html) + // in the AWS CloudFormation User Guide. Termination protection is disabled + // on stacks by default. + // + // For nested stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html), + // termination protection is set on the root stack and cannot be changed directly + // on the nested stack. + EnableTerminationProtection *bool `type:"boolean"` + + // The Simple Notification Service (SNS) topic ARNs to publish stack related + // events. You can find your SNS topic ARNs using the SNS console or your Command + // Line Interface (CLI). + NotificationARNs []string `type:"list"` + + // Determines what action will be taken if stack creation fails. This must be + // one of: DO_NOTHING, ROLLBACK, or DELETE. You can specify either OnFailure + // or DisableRollback, but not both. + // + // Default: ROLLBACK + OnFailure OnFailure `type:"string" enum:"true"` + + // A list of Parameter structures that specify input parameters for the stack. + // For more information, see the Parameter (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []Parameter `type:"list"` + + // The template resource types that you have permissions to work with for this + // create stack action, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. + // Use the following syntax to describe template resource types: AWS::* (for + // all AWS resource), Custom::* (for all custom resources), Custom::logical_ID + // (for a specific custom resource), AWS::service_name::* (for all resources + // of a particular AWS service), and AWS::service_name::resource_logical_ID + // (for a specific AWS resource). + // + // If the list of resource types doesn't include a resource that you're creating, + // the stack creation fails. By default, AWS CloudFormation grants permissions + // to all resource types. AWS Identity and Access Management (IAM) uses this + // parameter for AWS CloudFormation-specific condition keys in IAM policies. + // For more information, see Controlling Access with AWS Identity and Access + // Management (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html). + ResourceTypes []string `type:"list"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that AWS CloudFormation assumes to create the stack. AWS CloudFormation + // uses the role's credentials to make calls on your behalf. AWS CloudFormation + // always uses this role for all future operations on the stack. As long as + // users have permission to operate on the stack, AWS CloudFormation uses this + // role even if the users don't have permission to pass it. Ensure that the + // role grants least privilege. + // + // If you don't specify a value, AWS CloudFormation uses the role that was previously + // associated with the stack. If no role is available, AWS CloudFormation uses + // a temporary session that is generated from your user credentials. + RoleARN *string `min:"20" type:"string"` + + // The rollback triggers for AWS CloudFormation to monitor during stack creation + // and updating operations, and for the specified monitoring period afterwards. + RollbackConfiguration *RollbackConfiguration `type:"structure"` + + // The name that is associated with the stack. The name must be unique in the + // region in which you are creating the stack. + // + // A stack name can contain only alphanumeric characters (case sensitive) and + // hyphens. It must start with an alphabetic character and cannot be longer + // than 128 characters. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // Structure containing the stack policy body. For more information, go to + // Prevent Updates to Stack Resources (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html) + // in the AWS CloudFormation User Guide. You can specify either the StackPolicyBody + // or the StackPolicyURL parameter, but not both. + StackPolicyBody *string `min:"1" type:"string"` + + // Location of a file containing the stack policy. The URL must point to a policy + // (maximum size: 16 KB) located in an S3 bucket in the same region as the stack. + // You can specify either the StackPolicyBody or the StackPolicyURL parameter, + // but not both. + StackPolicyURL *string `min:"1" type:"string"` + + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to the resources created in the stack. A maximum number of 50 + // tags can be specified. + Tags []Tag `type:"list"` + + // Structure containing the template body with a minimum length of 1 byte and + // a maximum length of 51,200 bytes. For more information, go to Template Anatomy + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify either the TemplateBody or the TemplateURL + // parameter, but not both. + TemplateBody *string `min:"1" type:"string"` + + // Location of file containing the template body. The URL must point to a template + // (max size: 460,800 bytes) that is located in an Amazon S3 bucket. For more + // information, go to the Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify either the TemplateBody or the TemplateURL + // parameter, but not both. + TemplateURL *string `min:"1" type:"string"` + + // The amount of time that can pass before the stack status becomes CREATE_FAILED; + // if DisableRollback is not set or is set to false, the stack will be rolled + // back. + TimeoutInMinutes *int64 `min:"1" type:"integer"` +} + +// String returns the string representation +func (s CreateStackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateStackInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateStackInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleARN", 20)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackPolicyBody != nil && len(*s.StackPolicyBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyBody", 1)) + } + if s.StackPolicyURL != nil && len(*s.StackPolicyURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyURL", 1)) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + if s.TimeoutInMinutes != nil && *s.TimeoutInMinutes < 1 { + invalidParams.Add(aws.NewErrParamMinValue("TimeoutInMinutes", 1)) + } + if s.RollbackConfiguration != nil { + if err := s.RollbackConfiguration.Validate(); err != nil { + invalidParams.AddNested("RollbackConfiguration", err.(aws.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackInstancesInput +type CreateStackInstancesInput struct { + _ struct{} `type:"structure"` + + // The names of one or more AWS accounts that you want to create stack instances + // in the specified region(s) for. + // + // Accounts is a required field + Accounts []string `type:"list" required:"true"` + + // The unique identifier for this stack set operation. + // + // The operation ID also functions as an idempotency token, to ensure that AWS + // CloudFormation performs the stack set operation only once, even if you retry + // the request multiple times. You might retry stack set operation requests + // to ensure that AWS CloudFormation successfully received them. + // + // If you don't specify an operation ID, the SDK generates one automatically. + // + // Repeating this stack set operation with a new operation ID retries all stack + // instances whose status is OUTDATED. + OperationId *string `min:"1" type:"string" idempotencyToken:"true"` + + // Preferences for how AWS CloudFormation performs this stack set operation. + OperationPreferences *StackSetOperationPreferences `type:"structure"` + + // A list of stack set parameters whose values you want to override in the selected + // stack instances. + // + // Any overridden parameter values will be applied to all stack instances in + // the specified accounts and regions. When specifying parameters and their + // values, be aware of how AWS CloudFormation sets parameter values during stack + // instance operations: + // + // * To override the current value for a parameter, include the parameter + // and specify its value. + // + // * To leave a parameter set to its present value, you can do one of the + // following: + // + // Do not include the parameter in the list. + // + // Include the parameter and specify UsePreviousValue as true. (You cannot specify + // both a value and set UsePreviousValue to true.) + // + // * To set all overridden parameter back to the values specified in the + // stack set, specify a parameter list but do not include any parameters. + // + // * To leave all parameters set to their present values, do not specify + // this property at all. + // + // During stack set updates, any parameter values overridden for a stack instance + // are not updated, but retain their overridden value. + // + // You can only override the parameter values that are specified in the stack + // set; to add or delete a parameter itself, use UpdateStackSet (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) + // to update the stack set template. + ParameterOverrides []Parameter `type:"list"` + + // The names of one or more regions where you want to create stack instances + // using the specified AWS account(s). + // + // Regions is a required field + Regions []string `type:"list" required:"true"` + + // The name or unique ID of the stack set that you want to create stack instances + // from. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateStackInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackInstancesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateStackInstancesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateStackInstancesInput"} + + if s.Accounts == nil { + invalidParams.Add(aws.NewErrParamRequired("Accounts")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.Regions == nil { + invalidParams.Add(aws.NewErrParamRequired("Regions")) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + if s.OperationPreferences != nil { + if err := s.OperationPreferences.Validate(); err != nil { + invalidParams.AddNested("OperationPreferences", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackInstancesOutput +type CreateStackInstancesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The unique identifier for this stack set operation. + OperationId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s CreateStackInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackInstancesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateStackInstancesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The output for a CreateStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackOutput +type CreateStackOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Unique identifier of the stack. + StackId *string `type:"string"` +} + +// String returns the string representation +func (s CreateStackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateStackOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackSetInput +type CreateStackSetInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Number (ARN) of the IAM role to use to create this stack + // set. + // + // Specify an IAM role only if you are using customized administrator roles + // to control which users or groups can manage specific stack sets within the + // same administrator account. For more information, see Prerequisites: Granting + // Permissions for Stack Set Operations (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html) + // in the AWS CloudFormation User Guide. + AdministrationRoleARN *string `min:"20" type:"string"` + + // A list of values that you must specify before AWS CloudFormation can create + // certain stack sets. Some stack set templates might include resources that + // can affect permissions in your AWS account—for example, by creating new AWS + // Identity and Access Management (IAM) users. For those stack sets, you must + // explicitly acknowledge their capabilities by specifying this parameter. + // + // The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following + // resources require you to specify this parameter: + // + // * AWS::IAM::AccessKey + // + // * AWS::IAM::Group + // + // * AWS::IAM::InstanceProfile + // + // * AWS::IAM::Policy + // + // * AWS::IAM::Role + // + // * AWS::IAM::User + // + // * AWS::IAM::UserToGroupAddition + // + // If your stack template contains these resources, we recommend that you review + // all permissions that are associated with them and edit their permissions + // if necessary. + // + // If you have IAM resources, you can specify either capability. If you have + // IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If + // you don't specify this parameter, this action returns an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates. (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities) + Capabilities []Capability `type:"list"` + + // A unique identifier for this CreateStackSet request. Specify this token if + // you plan to retry requests so that AWS CloudFormation knows that you're not + // attempting to create another stack set with the same name. You might retry + // CreateStackSet requests to ensure that AWS CloudFormation successfully received + // them. + // + // If you don't specify an operation ID, the SDK generates one automatically. + ClientRequestToken *string `min:"1" type:"string" idempotencyToken:"true"` + + // A description of the stack set. You can use the description to identify the + // stack set's purpose or other important information. + Description *string `min:"1" type:"string"` + + // The name of the IAM execution role to use to create the stack set. If you + // do not specify an execution role, AWS CloudFormation uses the AWSCloudFormationStackSetExecutionRole + // role for the stack set operation. + // + // Specify an IAM role only if you are using customized execution roles to control + // which stack resources users and groups can include in their stack sets. + ExecutionRoleName *string `min:"1" type:"string"` + + // The input parameters for the stack set template. + Parameters []Parameter `type:"list"` + + // The name to associate with the stack set. The name must be unique in the + // region where you create your stack set. + // + // A stack name can contain only alphanumeric characters (case-sensitive) and + // hyphens. It must start with an alphabetic character and can't be longer than + // 128 characters. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` + + // The key-value pairs to associate with this stack set and the stacks created + // from it. AWS CloudFormation also propagates these tags to supported resources + // that are created in the stacks. A maximum number of 50 tags can be specified. + // + // If you specify tags as part of a CreateStackSet action, AWS CloudFormation + // checks to see if you have the required IAM permission to tag resources. If + // you don't, the entire CreateStackSet action fails with an access denied error, + // and the stack set is not created. + Tags []Tag `type:"list"` + + // The structure that contains the template body, with a minimum length of 1 + // byte and a maximum length of 51,200 bytes. For more information, see Template + // Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify either the TemplateBody or the TemplateURL + // parameter, but not both. + TemplateBody *string `min:"1" type:"string"` + + // The location of the file that contains the template body. The URL must point + // to a template (maximum size: 460,800 bytes) that's located in an Amazon S3 + // bucket. For more information, see Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify either the TemplateBody or the TemplateURL + // parameter, but not both. + TemplateURL *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s CreateStackSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateStackSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateStackSetInput"} + if s.AdministrationRoleARN != nil && len(*s.AdministrationRoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("AdministrationRoleARN", 20)) + } + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.Description != nil && len(*s.Description) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Description", 1)) + } + if s.ExecutionRoleName != nil && len(*s.ExecutionRoleName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ExecutionRoleName", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/CreateStackSetOutput +type CreateStackSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The ID of the stack set that you're creating. + StackSetId *string `type:"string"` +} + +// String returns the string representation +func (s CreateStackSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateStackSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateStackSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the DeleteChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteChangeSetInput +type DeleteChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or Amazon Resource Name (ARN) of the change set that you want to + // delete. + // + // ChangeSetName is a required field + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // If you specified the name of a change set to delete, specify the stack name + // or ID (ARN) that is associated with it. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DeleteChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteChangeSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteChangeSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteChangeSetInput"} + + if s.ChangeSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("ChangeSetName")) + } + if s.ChangeSetName != nil && len(*s.ChangeSetName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ChangeSetName", 1)) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the DeleteChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteChangeSetOutput +type DeleteChangeSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteChangeSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteChangeSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for DeleteStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackInput +type DeleteStackInput struct { + _ struct{} `type:"structure"` + + // A unique identifier for this DeleteStack request. Specify this token if you + // plan to retry requests so that AWS CloudFormation knows that you're not attempting + // to delete a stack with the same name. You might retry DeleteStack requests + // to ensure that AWS CloudFormation successfully received them. + // + // All events triggered by a given stack operation are assigned the same client + // request token, which you can use to track operations. For example, if you + // execute a CreateStack operation with the token token1, then all the StackEvents + // generated by that operation will have ClientRequestToken set as token1. + // + // In the console, stack operations display the client request token on the + // Events tab. Stack operations that are initiated from the console use the + // token format Console-StackOperation-ID, which helps you easily identify the + // stack operation . For example, if you create a stack using the console, each + // stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. + ClientRequestToken *string `min:"1" type:"string"` + + // For stacks in the DELETE_FAILED state, a list of resource logical IDs that + // are associated with the resources you want to retain. During deletion, AWS + // CloudFormation deletes the stack but does not delete the retained resources. + // + // Retaining resources is useful when you cannot delete a resource, such as + // a non-empty S3 bucket, but you want to delete the stack. + RetainResources []string `type:"list"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that AWS CloudFormation assumes to delete the stack. AWS CloudFormation + // uses the role's credentials to make calls on your behalf. + // + // If you don't specify a value, AWS CloudFormation uses the role that was previously + // associated with the stack. If no role is available, AWS CloudFormation uses + // a temporary session that is generated from your user credentials. + RoleARN *string `min:"20" type:"string"` + + // The name or the unique stack ID that is associated with the stack. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteStackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteStackInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteStackInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleARN", 20)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackInstancesInput +type DeleteStackInstancesInput struct { + _ struct{} `type:"structure"` + + // The names of the AWS accounts that you want to delete stack instances for. + // + // Accounts is a required field + Accounts []string `type:"list" required:"true"` + + // The unique identifier for this stack set operation. + // + // If you don't specify an operation ID, the SDK generates one automatically. + // + // The operation ID also functions as an idempotency token, to ensure that AWS + // CloudFormation performs the stack set operation only once, even if you retry + // the request multiple times. You can retry stack set operation requests to + // ensure that AWS CloudFormation successfully received them. + // + // Repeating this stack set operation with a new operation ID retries all stack + // instances whose status is OUTDATED. + OperationId *string `min:"1" type:"string" idempotencyToken:"true"` + + // Preferences for how AWS CloudFormation performs this stack set operation. + OperationPreferences *StackSetOperationPreferences `type:"structure"` + + // The regions where you want to delete stack set instances. + // + // Regions is a required field + Regions []string `type:"list" required:"true"` + + // Removes the stack instances from the specified stack set, but doesn't delete + // the stacks. You can't reassociate a retained stack or add an existing, saved + // stack to a new stack set. + // + // For more information, see Stack set operation options (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options). + // + // RetainStacks is a required field + RetainStacks *bool `type:"boolean" required:"true"` + + // The name or unique ID of the stack set that you want to delete stack instances + // for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteStackInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackInstancesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteStackInstancesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteStackInstancesInput"} + + if s.Accounts == nil { + invalidParams.Add(aws.NewErrParamRequired("Accounts")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.Regions == nil { + invalidParams.Add(aws.NewErrParamRequired("Regions")) + } + + if s.RetainStacks == nil { + invalidParams.Add(aws.NewErrParamRequired("RetainStacks")) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + if s.OperationPreferences != nil { + if err := s.OperationPreferences.Validate(); err != nil { + invalidParams.AddNested("OperationPreferences", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackInstancesOutput +type DeleteStackInstancesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The unique identifier for this stack set operation. + OperationId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DeleteStackInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackInstancesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteStackInstancesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackOutput +type DeleteStackOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteStackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteStackOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackSetInput +type DeleteStackSetInput struct { + _ struct{} `type:"structure"` + + // The name or unique ID of the stack set that you're deleting. You can obtain + // this value by running ListStackSets. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteStackSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteStackSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteStackSetInput"} + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DeleteStackSetOutput +type DeleteStackSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteStackSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteStackSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteStackSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the DescribeAccountLimits action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeAccountLimitsInput +type DescribeAccountLimitsInput struct { + _ struct{} `type:"structure"` + + // A string that identifies the next page of limits that you want to retrieve. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeAccountLimitsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAccountLimitsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeAccountLimitsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeAccountLimitsInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the DescribeAccountLimits action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeAccountLimitsOutput +type DescribeAccountLimitsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // An account limit structure that contain a list of AWS CloudFormation account + // limits and their values. + AccountLimits []AccountLimit `type:"list"` + + // If the output exceeds 1 MB in size, a string that identifies the next page + // of limits. If no additional page exists, this value is null. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeAccountLimitsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeAccountLimitsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeAccountLimitsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the DescribeChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeChangeSetInput +type DescribeChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or Amazon Resource Name (ARN) of the change set that you want to + // describe. + // + // ChangeSetName is a required field + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // A string (provided by the DescribeChangeSet response output) that identifies + // the next page of information that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // If you specified the name of a change set, specify the stack name or ID (ARN) + // of the change set you want to describe. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeChangeSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeChangeSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeChangeSetInput"} + + if s.ChangeSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("ChangeSetName")) + } + if s.ChangeSetName != nil && len(*s.ChangeSetName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ChangeSetName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the DescribeChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeChangeSetOutput +type DescribeChangeSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If you execute the change set, the list of capabilities that were explicitly + // acknowledged when the change set was created. + Capabilities []Capability `type:"list"` + + // The ARN of the change set. + ChangeSetId *string `min:"1" type:"string"` + + // The name of the change set. + ChangeSetName *string `min:"1" type:"string"` + + // A list of Change structures that describes the resources AWS CloudFormation + // changes if you execute the change set. + Changes []Change `type:"list"` + + // The start time when the change set was created, in UTC. + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Information about the change set. + Description *string `min:"1" type:"string"` + + // If the change set execution status is AVAILABLE, you can execute the change + // set. If you can’t execute the change set, the status indicates why. For example, + // a change set might be in an UNAVAILABLE state because AWS CloudFormation + // is still creating it or in an OBSOLETE state because the stack was already + // updated. + ExecutionStatus ExecutionStatus `type:"string" enum:"true"` + + // If the output exceeds 1 MB, a string that identifies the next page of changes. + // If there is no additional page, this value is null. + NextToken *string `min:"1" type:"string"` + + // The ARNs of the Amazon Simple Notification Service (Amazon SNS) topics that + // will be associated with the stack if you execute the change set. + NotificationARNs []string `type:"list"` + + // A list of Parameter structures that describes the input parameters and their + // values used to create the change set. For more information, see the Parameter + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []Parameter `type:"list"` + + // The rollback triggers for AWS CloudFormation to monitor during stack creation + // and updating operations, and for the specified monitoring period afterwards. + RollbackConfiguration *RollbackConfiguration `type:"structure"` + + // The ARN of the stack that is associated with the change set. + StackId *string `type:"string"` + + // The name of the stack that is associated with the change set. + StackName *string `type:"string"` + + // The current status of the change set, such as CREATE_IN_PROGRESS, CREATE_COMPLETE, + // or FAILED. + Status ChangeSetStatus `type:"string" enum:"true"` + + // A description of the change set's status. For example, if your attempt to + // create a change set failed, AWS CloudFormation shows the error message. + StatusReason *string `type:"string"` + + // If you execute the change set, the tags that will be associated with the + // stack. + Tags []Tag `type:"list"` +} + +// String returns the string representation +func (s DescribeChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeChangeSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeChangeSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for DescribeStackEvents action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackEventsInput +type DescribeStackEventsInput struct { + _ struct{} `type:"structure"` + + // A string that identifies the next page of events that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + StackName *string `type:"string"` +} + +// String returns the string representation +func (s DescribeStackEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStackEventsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStackEventsInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a DescribeStackEvents action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackEventsOutput +type DescribeStackEventsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the output exceeds 1 MB in size, a string that identifies the next page + // of events. If no additional page exists, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of StackEvents structures. + StackEvents []StackEvent `type:"list"` +} + +// String returns the string representation +func (s DescribeStackEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackEventsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackEventsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackInstanceInput +type DescribeStackInstanceInput struct { + _ struct{} `type:"structure"` + + // The ID of an AWS account that's associated with this stack instance. + // + // StackInstanceAccount is a required field + StackInstanceAccount *string `type:"string" required:"true"` + + // The name of a region that's associated with this stack instance. + // + // StackInstanceRegion is a required field + StackInstanceRegion *string `type:"string" required:"true"` + + // The name or the unique stack ID of the stack set that you want to get stack + // instance information for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeStackInstanceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackInstanceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStackInstanceInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStackInstanceInput"} + + if s.StackInstanceAccount == nil { + invalidParams.Add(aws.NewErrParamRequired("StackInstanceAccount")) + } + + if s.StackInstanceRegion == nil { + invalidParams.Add(aws.NewErrParamRequired("StackInstanceRegion")) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackInstanceOutput +type DescribeStackInstanceOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The stack instance that matches the specified request parameters. + StackInstance *StackInstance `type:"structure"` +} + +// String returns the string representation +func (s DescribeStackInstanceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackInstanceOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackInstanceOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for DescribeStackResource action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResourceInput +type DescribeStackResourceInput struct { + _ struct{} `type:"structure"` + + // The logical name of the resource as specified in the template. + // + // Default: There is no default value. + // + // LogicalResourceId is a required field + LogicalResourceId *string `type:"string" required:"true"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeStackResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStackResourceInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStackResourceInput"} + + if s.LogicalResourceId == nil { + invalidParams.Add(aws.NewErrParamRequired("LogicalResourceId")) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a DescribeStackResource action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResourceOutput +type DescribeStackResourceOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A StackResourceDetail structure containing the description of the specified + // resource in the specified stack. + StackResourceDetail *StackResourceDetail `type:"structure"` +} + +// String returns the string representation +func (s DescribeStackResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackResourceOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackResourceOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for DescribeStackResources action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResourcesInput +type DescribeStackResourcesInput struct { + _ struct{} `type:"structure"` + + // The logical name of the resource as specified in the template. + // + // Default: There is no default value. + LogicalResourceId *string `type:"string"` + + // The name or unique identifier that corresponds to a physical instance ID + // of a resource supported by AWS CloudFormation. + // + // For example, for an Amazon Elastic Compute Cloud (EC2) instance, PhysicalResourceId + // corresponds to the InstanceId. You can pass the EC2 InstanceId to DescribeStackResources + // to find which stack the instance belongs to and what other resources are + // part of the stack. + // + // Required: Conditional. If you do not specify PhysicalResourceId, you must + // specify StackName. + // + // Default: There is no default value. + PhysicalResourceId *string `type:"string"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + // + // Required: Conditional. If you do not specify StackName, you must specify + // PhysicalResourceId. + StackName *string `type:"string"` +} + +// String returns the string representation +func (s DescribeStackResourcesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackResourcesInput) GoString() string { + return s.String() +} + +// The output for a DescribeStackResources action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackResourcesOutput +type DescribeStackResourcesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of StackResource structures. + StackResources []StackResource `type:"list"` +} + +// String returns the string representation +func (s DescribeStackResourcesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackResourcesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackResourcesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSetInput +type DescribeStackSetInput struct { + _ struct{} `type:"structure"` + + // The name or unique ID of the stack set whose description you want. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeStackSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStackSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStackSetInput"} + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSetOperationInput +type DescribeStackSetOperationInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the stack set operation. + // + // OperationId is a required field + OperationId *string `min:"1" type:"string" required:"true"` + + // The name or the unique stack ID of the stack set for the stack operation. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeStackSetOperationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackSetOperationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStackSetOperationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStackSetOperationInput"} + + if s.OperationId == nil { + invalidParams.Add(aws.NewErrParamRequired("OperationId")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSetOperationOutput +type DescribeStackSetOperationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The specified stack set operation. + StackSetOperation *StackSetOperation `type:"structure"` +} + +// String returns the string representation +func (s DescribeStackSetOperationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackSetOperationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackSetOperationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStackSetOutput +type DescribeStackSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The specified stack set. + StackSet *StackSet `type:"structure"` +} + +// String returns the string representation +func (s DescribeStackSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStackSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStackSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for DescribeStacks action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStacksInput +type DescribeStacksInput struct { + _ struct{} `type:"structure"` + + // A string that identifies the next page of stacks that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + StackName *string `type:"string"` +} + +// String returns the string representation +func (s DescribeStacksInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStacksInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeStacksInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeStacksInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a DescribeStacks action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/DescribeStacksOutput +type DescribeStacksOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the output exceeds 1 MB in size, a string that identifies the next page + // of stacks. If no additional page exists, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of stack structures. + Stacks []Stack `type:"list"` +} + +// String returns the string representation +func (s DescribeStacksOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeStacksOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeStacksOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for an EstimateTemplateCost action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/EstimateTemplateCostInput +type EstimateTemplateCostInput struct { + _ struct{} `type:"structure"` + + // A list of Parameter structures that specify input parameters. + Parameters []Parameter `type:"list"` + + // Structure containing the template body with a minimum length of 1 byte and + // a maximum length of 51,200 bytes. (For more information, go to Template Anatomy + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide.) + // + // Conditional: You must pass TemplateBody or TemplateURL. If both are passed, + // only TemplateBody is used. + TemplateBody *string `min:"1" type:"string"` + + // Location of file containing the template body. The URL must point to a template + // that is located in an Amazon S3 bucket. For more information, go to Template + // Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must pass TemplateURL or TemplateBody. If both are passed, + // only TemplateBody is used. + TemplateURL *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s EstimateTemplateCostInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EstimateTemplateCostInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EstimateTemplateCostInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "EstimateTemplateCostInput"} + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a EstimateTemplateCost action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/EstimateTemplateCostOutput +type EstimateTemplateCostOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // An AWS Simple Monthly Calculator URL with a query string that describes the + // resources required to run the template. + Url *string `type:"string"` +} + +// String returns the string representation +func (s EstimateTemplateCostOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EstimateTemplateCostOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s EstimateTemplateCostOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the ExecuteChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ExecuteChangeSetInput +type ExecuteChangeSetInput struct { + _ struct{} `type:"structure"` + + // The name or ARN of the change set that you want use to update the specified + // stack. + // + // ChangeSetName is a required field + ChangeSetName *string `min:"1" type:"string" required:"true"` + + // A unique identifier for this ExecuteChangeSet request. Specify this token + // if you plan to retry requests so that AWS CloudFormation knows that you're + // not attempting to execute a change set to update a stack with the same name. + // You might retry ExecuteChangeSet requests to ensure that AWS CloudFormation + // successfully received them. + ClientRequestToken *string `min:"1" type:"string"` + + // If you specified the name of a change set, specify the stack name or ID (ARN) + // that is associated with the change set you want to execute. + StackName *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ExecuteChangeSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExecuteChangeSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ExecuteChangeSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ExecuteChangeSetInput"} + + if s.ChangeSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("ChangeSetName")) + } + if s.ChangeSetName != nil && len(*s.ChangeSetName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ChangeSetName", 1)) + } + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the ExecuteChangeSet action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ExecuteChangeSetOutput +type ExecuteChangeSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s ExecuteChangeSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExecuteChangeSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ExecuteChangeSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The Export structure describes the exported output values for a stack. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Export +type Export struct { + _ struct{} `type:"structure"` + + // The stack that contains the exported output name and value. + ExportingStackId *string `type:"string"` + + // The name of exported output value. Use this name and the Fn::ImportValue + // function to import the associated value into other stacks. The name is defined + // in the Export field in the associated stack's Outputs section. + Name *string `type:"string"` + + // The value of the exported output, such as a resource physical ID. This value + // is defined in the Export field in the associated stack's Outputs section. + Value *string `type:"string"` +} + +// String returns the string representation +func (s Export) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Export) GoString() string { + return s.String() +} + +// The input for the GetStackPolicy action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetStackPolicyInput +type GetStackPolicyInput struct { + _ struct{} `type:"structure"` + + // The name or unique stack ID that is associated with the stack whose policy + // you want to get. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetStackPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetStackPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetStackPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetStackPolicyInput"} + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the GetStackPolicy action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetStackPolicyOutput +type GetStackPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Structure containing the stack policy body. (For more information, go to + // Prevent Updates to Stack Resources (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html) + // in the AWS CloudFormation User Guide.) + StackPolicyBody *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetStackPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetStackPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetStackPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for a GetTemplate action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateInput +type GetTemplateInput struct { + _ struct{} `type:"structure"` + + // The name or Amazon Resource Name (ARN) of a change set for which AWS CloudFormation + // returns the associated template. If you specify a name, you must also specify + // the StackName. + ChangeSetName *string `min:"1" type:"string"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + StackName *string `type:"string"` + + // For templates that include transforms, the stage of the template that AWS + // CloudFormation returns. To get the user-submitted template, specify Original. + // To get the template after AWS CloudFormation has processed all transforms, + // specify Processed. + // + // If the template doesn't include transforms, Original and Processed return + // the same template. By default, AWS CloudFormation specifies Original. + TemplateStage TemplateStage `type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetTemplateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetTemplateInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetTemplateInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetTemplateInput"} + if s.ChangeSetName != nil && len(*s.ChangeSetName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ChangeSetName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for GetTemplate action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateOutput +type GetTemplateOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The stage of the template that you can retrieve. For stacks, the Original + // and Processed templates are always available. For change sets, the Original + // template is always available. After AWS CloudFormation finishes creating + // the change set, the Processed template becomes available. + StagesAvailable []TemplateStage `type:"list"` + + // Structure containing the template body. (For more information, go to Template + // Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide.) + // + // AWS CloudFormation returns the same template that was used when the stack + // was created. + TemplateBody *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetTemplateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetTemplateOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetTemplateOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the GetTemplateSummary action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateSummaryInput +type GetTemplateSummaryInput struct { + _ struct{} `type:"structure"` + + // The name or the stack ID that is associated with the stack, which are not + // always interchangeable. For running stacks, you can specify either the stack's + // name or its unique stack ID. For deleted stack, you must specify the unique + // stack ID. + // + // Conditional: You must specify only one of the following parameters: StackName, + // StackSetName, TemplateBody, or TemplateURL. + StackName *string `min:"1" type:"string"` + + // The name or unique ID of the stack set from which the stack was created. + // + // Conditional: You must specify only one of the following parameters: StackName, + // StackSetName, TemplateBody, or TemplateURL. + StackSetName *string `type:"string"` + + // Structure containing the template body with a minimum length of 1 byte and + // a maximum length of 51,200 bytes. For more information about templates, see + // Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify only one of the following parameters: StackName, + // StackSetName, TemplateBody, or TemplateURL. + TemplateBody *string `min:"1" type:"string"` + + // Location of file containing the template body. The URL must point to a template + // (max size: 460,800 bytes) that is located in an Amazon S3 bucket. For more + // information about templates, see Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify only one of the following parameters: StackName, + // StackSetName, TemplateBody, or TemplateURL. + TemplateURL *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetTemplateSummaryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetTemplateSummaryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetTemplateSummaryInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetTemplateSummaryInput"} + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the GetTemplateSummary action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/GetTemplateSummaryOutput +type GetTemplateSummaryOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The capabilities found within the template. If your template contains IAM + // resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value + // for this parameter when you use the CreateStack or UpdateStack actions with + // your template; otherwise, those actions return an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). + Capabilities []Capability `type:"list"` + + // The list of resources that generated the values in the Capabilities response + // element. + CapabilitiesReason *string `type:"string"` + + // A list of the transforms that are declared in the template. + DeclaredTransforms []string `type:"list"` + + // The value that is defined in the Description property of the template. + Description *string `min:"1" type:"string"` + + // The value that is defined for the Metadata property of the template. + Metadata *string `type:"string"` + + // A list of parameter declarations that describe various properties for each + // parameter. + Parameters []ParameterDeclaration `type:"list"` + + // A list of all the template resource types that are defined in the template, + // such as AWS::EC2::Instance, AWS::Dynamo::Table, and Custom::MyCustomInstance. + ResourceTypes []string `type:"list"` + + // The AWS template format version, which identifies the capabilities of the + // template. + Version *string `type:"string"` +} + +// String returns the string representation +func (s GetTemplateSummaryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetTemplateSummaryOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetTemplateSummaryOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the ListChangeSets action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListChangeSetsInput +type ListChangeSetsInput struct { + _ struct{} `type:"structure"` + + // A string (provided by the ListChangeSets response output) that identifies + // the next page of change sets that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // The name or the Amazon Resource Name (ARN) of the stack for which you want + // to list change sets. + // + // StackName is a required field + StackName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListChangeSetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListChangeSetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListChangeSetsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListChangeSetsInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for the ListChangeSets action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListChangeSetsOutput +type ListChangeSetsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the output exceeds 1 MB, a string that identifies the next page of change + // sets. If there is no additional page, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of ChangeSetSummary structures that provides the ID and status of + // each change set for the specified stack. + Summaries []ChangeSetSummary `type:"list"` +} + +// String returns the string representation +func (s ListChangeSetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListChangeSetsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListChangeSetsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListExportsInput +type ListExportsInput struct { + _ struct{} `type:"structure"` + + // A string (provided by the ListExports response output) that identifies the + // next page of exported output values that you asked to retrieve. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListExportsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListExportsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListExportsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListExportsInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListExportsOutput +type ListExportsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The output for the ListExports action. + Exports []Export `type:"list"` + + // If the output exceeds 100 exported output values, a string that identifies + // the next page of exports. If there is no additional page, this value is null. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListExportsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListExportsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListExportsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListImportsInput +type ListImportsInput struct { + _ struct{} `type:"structure"` + + // The name of the exported output value. AWS CloudFormation returns the stack + // names that are importing this value. + // + // ExportName is a required field + ExportName *string `type:"string" required:"true"` + + // A string (provided by the ListImports response output) that identifies the + // next page of stacks that are importing the specified exported output value. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListImportsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListImportsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListImportsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListImportsInput"} + + if s.ExportName == nil { + invalidParams.Add(aws.NewErrParamRequired("ExportName")) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListImportsOutput +type ListImportsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of stack names that are importing the specified exported output value. + Imports []string `type:"list"` + + // A string that identifies the next page of exports. If there is no additional + // page, this value is null. + NextToken *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ListImportsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListImportsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListImportsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackInstancesInput +type ListStackInstancesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to be returned with a single call. If the number + // of available results exceeds this maximum, the response includes a NextToken + // value that you can assign to the NextToken request parameter to get the next + // set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // If the previous request didn't return all of the remaining results, the response's + // NextToken parameter value is set to a token. To retrieve the next set of + // results, call ListStackInstances again and assign that token to the request + // object's NextToken parameter. If there are no remaining results, the previous + // response object's NextToken parameter is set to null. + NextToken *string `min:"1" type:"string"` + + // The name of the AWS account that you want to list stack instances for. + StackInstanceAccount *string `type:"string"` + + // The name of the region where you want to list stack instances. + StackInstanceRegion *string `type:"string"` + + // The name or unique ID of the stack set that you want to list stack instances + // for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ListStackInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackInstancesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStackInstancesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStackInstancesInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackInstancesOutput +type ListStackInstancesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the request doesn't return all of the remaining results, NextToken is + // set to a token. To retrieve the next set of results, call ListStackInstances + // again and assign that token to the request object's NextToken parameter. + // If the request returns all results, NextToken is set to null. + NextToken *string `min:"1" type:"string"` + + // A list of StackInstanceSummary structures that contain information about + // the specified stack instances. + Summaries []StackInstanceSummary `type:"list"` +} + +// String returns the string representation +func (s ListStackInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackInstancesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStackInstancesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the ListStackResource action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackResourcesInput +type ListStackResourcesInput struct { + _ struct{} `type:"structure"` + + // A string that identifies the next page of stack resources that you want to + // retrieve. + NextToken *string `min:"1" type:"string"` + + // The name or the unique stack ID that is associated with the stack, which + // are not always interchangeable: + // + // * Running stacks: You can specify either the stack's name or its unique + // stack ID. + // + // * Deleted stacks: You must specify the unique stack ID. + // + // Default: There is no default value. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ListStackResourcesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackResourcesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStackResourcesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStackResourcesInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for a ListStackResources action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackResourcesOutput +type ListStackResourcesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the output exceeds 1 MB, a string that identifies the next page of stack + // resources. If no additional page exists, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of StackResourceSummary structures. + StackResourceSummaries []StackResourceSummary `type:"list"` +} + +// String returns the string representation +func (s ListStackResourcesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackResourcesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStackResourcesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperationResultsInput +type ListStackSetOperationResultsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to be returned with a single call. If the number + // of available results exceeds this maximum, the response includes a NextToken + // value that you can assign to the NextToken request parameter to get the next + // set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // If the previous request didn't return all of the remaining results, the response + // object's NextToken parameter value is set to a token. To retrieve the next + // set of results, call ListStackSetOperationResults again and assign that token + // to the request object's NextToken parameter. If there are no remaining results, + // the previous response object's NextToken parameter is set to null. + NextToken *string `min:"1" type:"string"` + + // The ID of the stack set operation. + // + // OperationId is a required field + OperationId *string `min:"1" type:"string" required:"true"` + + // The name or unique ID of the stack set that you want to get operation results + // for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ListStackSetOperationResultsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetOperationResultsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStackSetOperationResultsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStackSetOperationResultsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if s.OperationId == nil { + invalidParams.Add(aws.NewErrParamRequired("OperationId")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperationResultsOutput +type ListStackSetOperationResultsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the request doesn't return all results, NextToken is set to a token. To + // retrieve the next set of results, call ListOperationResults again and assign + // that token to the request object's NextToken parameter. If there are no remaining + // results, NextToken is set to null. + NextToken *string `min:"1" type:"string"` + + // A list of StackSetOperationResultSummary structures that contain information + // about the specified operation results, for accounts and regions that are + // included in the operation. + Summaries []StackSetOperationResultSummary `type:"list"` +} + +// String returns the string representation +func (s ListStackSetOperationResultsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetOperationResultsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStackSetOperationResultsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperationsInput +type ListStackSetOperationsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to be returned with a single call. If the number + // of available results exceeds this maximum, the response includes a NextToken + // value that you can assign to the NextToken request parameter to get the next + // set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // If the previous paginated request didn't return all of the remaining results, + // the response object's NextToken parameter value is set to a token. To retrieve + // the next set of results, call ListStackSetOperations again and assign that + // token to the request object's NextToken parameter. If there are no remaining + // results, the previous response object's NextToken parameter is set to null. + NextToken *string `min:"1" type:"string"` + + // The name or unique ID of the stack set that you want to get operation summaries + // for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ListStackSetOperationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetOperationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStackSetOperationsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStackSetOperationsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetOperationsOutput +type ListStackSetOperationsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the request doesn't return all results, NextToken is set to a token. To + // retrieve the next set of results, call ListOperationResults again and assign + // that token to the request object's NextToken parameter. If there are no remaining + // results, NextToken is set to null. + NextToken *string `min:"1" type:"string"` + + // A list of StackSetOperationSummary structures that contain summary information + // about operations for the specified stack set. + Summaries []StackSetOperationSummary `type:"list"` +} + +// String returns the string representation +func (s ListStackSetOperationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetOperationsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStackSetOperationsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetsInput +type ListStackSetsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results to be returned with a single call. If the number + // of available results exceeds this maximum, the response includes a NextToken + // value that you can assign to the NextToken request parameter to get the next + // set of results. + MaxResults *int64 `min:"1" type:"integer"` + + // If the previous paginated request didn't return all of the remaining results, + // the response object's NextToken parameter value is set to a token. To retrieve + // the next set of results, call ListStackSets again and assign that token to + // the request object's NextToken parameter. If there are no remaining results, + // the previous response object's NextToken parameter is set to null. + NextToken *string `min:"1" type:"string"` + + // The status of the stack sets that you want to get summary information about. + Status StackSetStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s ListStackSetsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStackSetsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStackSetsInput"} + if s.MaxResults != nil && *s.MaxResults < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxResults", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStackSetsOutput +type ListStackSetsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the request doesn't return all of the remaining results, NextToken is + // set to a token. To retrieve the next set of results, call ListStackInstances + // again and assign that token to the request object's NextToken parameter. + // If the request returns all results, NextToken is set to null. + NextToken *string `min:"1" type:"string"` + + // A list of StackSetSummary structures that contain information about the user's + // stack sets. + Summaries []StackSetSummary `type:"list"` +} + +// String returns the string representation +func (s ListStackSetsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStackSetsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStackSetsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for ListStacks action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStacksInput +type ListStacksInput struct { + _ struct{} `type:"structure"` + + // A string that identifies the next page of stacks that you want to retrieve. + NextToken *string `min:"1" type:"string"` + + // Stack status to use as a filter. Specify one or more stack status codes to + // list only stacks with the specified status codes. For a complete list of + // stack status codes, see the StackStatus parameter of the Stack data type. + StackStatusFilter []StackStatus `type:"list"` +} + +// String returns the string representation +func (s ListStacksInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStacksInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListStacksInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListStacksInput"} + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for ListStacks action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ListStacksOutput +type ListStacksOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If the output exceeds 1 MB in size, a string that identifies the next page + // of stacks. If no additional page exists, this value is null. + NextToken *string `min:"1" type:"string"` + + // A list of StackSummary structures containing information about the specified + // stacks. + StackSummaries []StackSummary `type:"list"` +} + +// String returns the string representation +func (s ListStacksOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListStacksOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListStacksOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The Output data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Output +type Output struct { + _ struct{} `type:"structure"` + + // User defined description associated with the output. + Description *string `min:"1" type:"string"` + + // The name of the export associated with the output. + ExportName *string `type:"string"` + + // The key associated with the output. + OutputKey *string `type:"string"` + + // The value associated with the output. + OutputValue *string `type:"string"` +} + +// String returns the string representation +func (s Output) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Output) GoString() string { + return s.String() +} + +// The Parameter data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Parameter +type Parameter struct { + _ struct{} `type:"structure"` + + // The key associated with the parameter. If you don't specify a key and value + // for a particular parameter, AWS CloudFormation uses the default value that + // is specified in your template. + ParameterKey *string `type:"string"` + + // The input value associated with the parameter. + ParameterValue *string `type:"string"` + + // Read-only. The value that corresponds to a Systems Manager parameter key. + // This field is returned only for SSM (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-ssm-parameter-types) + // parameter types in the template. + ResolvedValue *string `type:"string"` + + // During a stack update, use the existing parameter value that the stack is + // using for a given parameter key. If you specify true, do not specify a parameter + // value. + UsePreviousValue *bool `type:"boolean"` +} + +// String returns the string representation +func (s Parameter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Parameter) GoString() string { + return s.String() +} + +// A set of criteria that AWS CloudFormation uses to validate parameter values. +// Although other constraints might be defined in the stack template, AWS CloudFormation +// returns only the AllowedValues property. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ParameterConstraints +type ParameterConstraints struct { + _ struct{} `type:"structure"` + + // A list of values that are permitted for a parameter. + AllowedValues []string `type:"list"` +} + +// String returns the string representation +func (s ParameterConstraints) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ParameterConstraints) GoString() string { + return s.String() +} + +// The ParameterDeclaration data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ParameterDeclaration +type ParameterDeclaration struct { + _ struct{} `type:"structure"` + + // The default value of the parameter. + DefaultValue *string `type:"string"` + + // The description that is associate with the parameter. + Description *string `min:"1" type:"string"` + + // Flag that indicates whether the parameter value is shown as plain text in + // logs and in the AWS Management Console. + NoEcho *bool `type:"boolean"` + + // The criteria that AWS CloudFormation uses to validate parameter values. + ParameterConstraints *ParameterConstraints `type:"structure"` + + // The name that is associated with the parameter. + ParameterKey *string `type:"string"` + + // The type of parameter. + ParameterType *string `type:"string"` +} + +// String returns the string representation +func (s ParameterDeclaration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ParameterDeclaration) GoString() string { + return s.String() +} + +// The ResourceChange structure describes the resource and the action that AWS +// CloudFormation will perform on it if you execute this change set. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ResourceChange +type ResourceChange struct { + _ struct{} `type:"structure"` + + // The action that AWS CloudFormation takes on the resource, such as Add (adds + // a new resource), Modify (changes a resource), or Remove (deletes a resource). + Action ChangeAction `type:"string" enum:"true"` + + // For the Modify action, a list of ResourceChangeDetail structures that describes + // the changes that AWS CloudFormation will make to the resource. + Details []ResourceChangeDetail `type:"list"` + + // The resource's logical ID, which is defined in the stack's template. + LogicalResourceId *string `type:"string"` + + // The resource's physical ID (resource name). Resources that you are adding + // don't have physical IDs because they haven't been created. + PhysicalResourceId *string `type:"string"` + + // For the Modify action, indicates whether AWS CloudFormation will replace + // the resource by creating a new one and deleting the old one. This value depends + // on the value of the RequiresRecreation property in the ResourceTargetDefinition + // structure. For example, if the RequiresRecreation field is Always and the + // Evaluation field is Static, Replacement is True. If the RequiresRecreation + // field is Always and the Evaluation field is Dynamic, Replacement is Conditionally. + // + // If you have multiple changes with different RequiresRecreation values, the + // Replacement value depends on the change with the most impact. A RequiresRecreation + // value of Always has the most impact, followed by Conditionally, and then + // Never. + Replacement Replacement `type:"string" enum:"true"` + + // The type of AWS CloudFormation resource, such as AWS::S3::Bucket. + ResourceType *string `min:"1" type:"string"` + + // For the Modify action, indicates which resource attribute is triggering this + // update, such as a change in the resource attribute's Metadata, Properties, + // or Tags. + Scope []ResourceAttribute `type:"list"` +} + +// String returns the string representation +func (s ResourceChange) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceChange) GoString() string { + return s.String() +} + +// For a resource with Modify as the action, the ResourceChange structure describes +// the changes AWS CloudFormation will make to that resource. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ResourceChangeDetail +type ResourceChangeDetail struct { + _ struct{} `type:"structure"` + + // The identity of the entity that triggered this change. This entity is a member + // of the group that is specified by the ChangeSource field. For example, if + // you modified the value of the KeyPairName parameter, the CausingEntity is + // the name of the parameter (KeyPairName). + // + // If the ChangeSource value is DirectModification, no value is given for CausingEntity. + CausingEntity *string `type:"string"` + + // The group to which the CausingEntity value belongs. There are five entity + // groups: + // + // * ResourceReference entities are Ref intrinsic functions that refer to + // resources in the template, such as { "Ref" : "MyEC2InstanceResource" }. + // + // * ParameterReference entities are Ref intrinsic functions that get template + // parameter values, such as { "Ref" : "MyPasswordParameter" }. + // + // * ResourceAttribute entities are Fn::GetAtt intrinsic functions that get + // resource attribute values, such as { "Fn::GetAtt" : [ "MyEC2InstanceResource", + // "PublicDnsName" ] }. + // + // * DirectModification entities are changes that are made directly to the + // template. + // + // * Automatic entities are AWS::CloudFormation::Stack resource types, which + // are also known as nested stacks. If you made no changes to the AWS::CloudFormation::Stack + // resource, AWS CloudFormation sets the ChangeSource to Automatic because + // the nested stack's template might have changed. Changes to a nested stack's + // template aren't visible to AWS CloudFormation until you run an update + // on the parent stack. + ChangeSource ChangeSource `type:"string" enum:"true"` + + // Indicates whether AWS CloudFormation can determine the target value, and + // whether the target value will change before you execute a change set. + // + // For Static evaluations, AWS CloudFormation can determine that the target + // value will change, and its value. For example, if you directly modify the + // InstanceType property of an EC2 instance, AWS CloudFormation knows that this + // property value will change, and its value, so this is a Static evaluation. + // + // For Dynamic evaluations, cannot determine the target value because it depends + // on the result of an intrinsic function, such as a Ref or Fn::GetAtt intrinsic + // function, when the stack is updated. For example, if your template includes + // a reference to a resource that is conditionally recreated, the value of the + // reference (the physical ID of the resource) might change, depending on if + // the resource is recreated. If the resource is recreated, it will have a new + // physical ID, so all references to that resource will also be updated. + Evaluation EvaluationType `type:"string" enum:"true"` + + // A ResourceTargetDefinition structure that describes the field that AWS CloudFormation + // will change and whether the resource will be recreated. + Target *ResourceTargetDefinition `type:"structure"` +} + +// String returns the string representation +func (s ResourceChangeDetail) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceChangeDetail) GoString() string { + return s.String() +} + +// The field that AWS CloudFormation will change, such as the name of a resource's +// property, and whether the resource will be recreated. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ResourceTargetDefinition +type ResourceTargetDefinition struct { + _ struct{} `type:"structure"` + + // Indicates which resource attribute is triggering this update, such as a change + // in the resource attribute's Metadata, Properties, or Tags. + Attribute ResourceAttribute `type:"string" enum:"true"` + + // If the Attribute value is Properties, the name of the property. For all other + // attributes, the value is null. + Name *string `type:"string"` + + // If the Attribute value is Properties, indicates whether a change to this + // property causes the resource to be recreated. The value can be Never, Always, + // or Conditionally. To determine the conditions for a Conditionally recreation, + // see the update behavior for that property (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide. + RequiresRecreation RequiresRecreation `type:"string" enum:"true"` +} + +// String returns the string representation +func (s ResourceTargetDefinition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceTargetDefinition) GoString() string { + return s.String() +} + +// Structure containing the rollback triggers for AWS CloudFormation to monitor +// during stack creation and updating operations, and for the specified monitoring +// period afterwards. +// +// Rollback triggers enable you to have AWS CloudFormation monitor the state +// of your application during stack creation and updating, and to roll back +// that operation if the application breaches the threshold of any of the alarms +// you've specified. For more information, see Monitor and Roll Back Stack Operations +// (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-rollback-triggers.html). +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackConfiguration +type RollbackConfiguration struct { + _ struct{} `type:"structure"` + + // The amount of time, in minutes, during which CloudFormation should monitor + // all the rollback triggers after the stack creation or update operation deploys + // all necessary resources. + // + // The default is 0 minutes. + // + // If you specify a monitoring period but do not specify any rollback triggers, + // CloudFormation still waits the specified period of time before cleaning up + // old resources after update operations. You can use this monitoring period + // to perform any manual stack validation desired, and manually cancel the stack + // creation or update (using CancelUpdateStack (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CancelUpdateStack.html), + // for example) as necessary. + // + // If you specify 0 for this parameter, CloudFormation still monitors the specified + // rollback triggers during stack creation and update operations. Then, for + // update operations, it begins disposing of old resources immediately once + // the operation completes. + MonitoringTimeInMinutes *int64 `type:"integer"` + + // The triggers to monitor during stack creation or update actions. + // + // By default, AWS CloudFormation saves the rollback triggers specified for + // a stack and applies them to any subsequent update operations for the stack, + // unless you specify otherwise. If you do specify rollback triggers for this + // parameter, those triggers replace any list of triggers previously specified + // for the stack. This means: + // + // * To use the rollback triggers previously specified for this stack, if + // any, don't specify this parameter. + // + // * To specify new or updated rollback triggers, you must specify all the + // triggers that you want used for this stack, even triggers you've specifed + // before (for example, when creating the stack or during a previous stack + // update). Any triggers that you don't include in the updated list of triggers + // are no longer applied to the stack. + // + // * To remove all currently specified triggers, specify an empty list for + // this parameter. + // + // If a specified trigger is missing, the entire stack operation fails and is + // rolled back. + RollbackTriggers []RollbackTrigger `type:"list"` +} + +// String returns the string representation +func (s RollbackConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RollbackConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RollbackConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RollbackConfiguration"} + if s.RollbackTriggers != nil { + for i, v := range s.RollbackTriggers { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RollbackTriggers", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// A rollback trigger AWS CloudFormation monitors during creation and updating +// of stacks. If any of the alarms you specify goes to ALARM state during the +// stack operation or within the specified monitoring period afterwards, CloudFormation +// rolls back the entire stack operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger +type RollbackTrigger struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the rollback trigger. + // + // If a specified trigger is missing, the entire stack operation fails and is + // rolled back. + // + // Arn is a required field + Arn *string `type:"string" required:"true"` + + // The resource type of the rollback trigger. Currently, AWS::CloudWatch::Alarm + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html) + // is the only supported resource type. + // + // Type is a required field + Type *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s RollbackTrigger) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RollbackTrigger) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RollbackTrigger) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RollbackTrigger"} + + if s.Arn == nil { + invalidParams.Add(aws.NewErrParamRequired("Arn")) + } + + if s.Type == nil { + invalidParams.Add(aws.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The input for the SetStackPolicy action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SetStackPolicyInput +type SetStackPolicyInput struct { + _ struct{} `type:"structure"` + + // The name or unique stack ID that you want to associate a policy with. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // Structure containing the stack policy body. For more information, go to + // Prevent Updates to Stack Resources (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html) + // in the AWS CloudFormation User Guide. You can specify either the StackPolicyBody + // or the StackPolicyURL parameter, but not both. + StackPolicyBody *string `min:"1" type:"string"` + + // Location of a file containing the stack policy. The URL must point to a policy + // (maximum size: 16 KB) located in an S3 bucket in the same region as the stack. + // You can specify either the StackPolicyBody or the StackPolicyURL parameter, + // but not both. + StackPolicyURL *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s SetStackPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetStackPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SetStackPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SetStackPolicyInput"} + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackPolicyBody != nil && len(*s.StackPolicyBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyBody", 1)) + } + if s.StackPolicyURL != nil && len(*s.StackPolicyURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyURL", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SetStackPolicyOutput +type SetStackPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s SetStackPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SetStackPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s SetStackPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for the SignalResource action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SignalResourceInput +type SignalResourceInput struct { + _ struct{} `type:"structure"` + + // The logical ID of the resource that you want to signal. The logical ID is + // the name of the resource that given in the template. + // + // LogicalResourceId is a required field + LogicalResourceId *string `type:"string" required:"true"` + + // The stack name or unique stack ID that includes the resource that you want + // to signal. + // + // StackName is a required field + StackName *string `min:"1" type:"string" required:"true"` + + // The status of the signal, which is either success or failure. A failure signal + // causes AWS CloudFormation to immediately fail the stack creation or update. + // + // Status is a required field + Status ResourceSignalStatus `type:"string" required:"true" enum:"true"` + + // A unique ID of the signal. When you signal Amazon EC2 instances or Auto Scaling + // groups, specify the instance ID that you are signaling as the unique ID. + // If you send multiple signals to a single resource (such as signaling a wait + // condition), each signal requires a different unique ID. + // + // UniqueId is a required field + UniqueId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s SignalResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SignalResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SignalResourceInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SignalResourceInput"} + + if s.LogicalResourceId == nil { + invalidParams.Add(aws.NewErrParamRequired("LogicalResourceId")) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + if len(s.Status) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Status")) + } + + if s.UniqueId == nil { + invalidParams.Add(aws.NewErrParamRequired("UniqueId")) + } + if s.UniqueId != nil && len(*s.UniqueId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("UniqueId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/SignalResourceOutput +type SignalResourceOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s SignalResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SignalResourceOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s SignalResourceOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The Stack data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Stack +type Stack struct { + _ struct{} `type:"structure"` + + // The capabilities allowed in the stack. + Capabilities []Capability `type:"list"` + + // The unique ID of the change set. + ChangeSetId *string `min:"1" type:"string"` + + // The time at which the stack was created. + // + // CreationTime is a required field + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The time the stack was deleted. + DeletionTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // A user-defined description associated with the stack. + Description *string `min:"1" type:"string"` + + // Boolean to enable or disable rollback on stack creation failures: + // + // * true: disable rollback + // + // * false: enable rollback + DisableRollback *bool `type:"boolean"` + + // Whether termination protection is enabled for the stack. + // + // For nested stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html), + // termination protection is set on the root stack and cannot be changed directly + // on the nested stack. For more information, see Protecting a Stack From Being + // Deleted (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-protect-stacks.html) + // in the AWS CloudFormation User Guide. + EnableTerminationProtection *bool `type:"boolean"` + + // The time the stack was last updated. This field will only be returned if + // the stack has been updated at least once. + LastUpdatedTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // SNS topic ARNs to which stack related events are published. + NotificationARNs []string `type:"list"` + + // A list of output structures. + Outputs []Output `type:"list"` + + // A list of Parameter structures. + Parameters []Parameter `type:"list"` + + // For nested stacks--stacks created as resources for another stack--the stack + // ID of the direct parent of this stack. For the first level of nested stacks, + // the root stack is also the parent stack. + // + // For more information, see Working with Nested Stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) + // in the AWS CloudFormation User Guide. + ParentId *string `type:"string"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that is associated with the stack. During a stack operation, AWS CloudFormation + // uses this role's credentials to make calls on your behalf. + RoleARN *string `min:"20" type:"string"` + + // The rollback triggers for AWS CloudFormation to monitor during stack creation + // and updating operations, and for the specified monitoring period afterwards. + RollbackConfiguration *RollbackConfiguration `type:"structure"` + + // For nested stacks--stacks created as resources for another stack--the stack + // ID of the the top-level stack to which the nested stack ultimately belongs. + // + // For more information, see Working with Nested Stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) + // in the AWS CloudFormation User Guide. + RootId *string `type:"string"` + + // Unique identifier of the stack. + StackId *string `type:"string"` + + // The name associated with the stack. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // Current status of the stack. + // + // StackStatus is a required field + StackStatus StackStatus `type:"string" required:"true" enum:"true"` + + // Success/failure message associated with the stack status. + StackStatusReason *string `type:"string"` + + // A list of Tags that specify information about the stack. + Tags []Tag `type:"list"` + + // The amount of time within which stack creation should complete. + TimeoutInMinutes *int64 `min:"1" type:"integer"` +} + +// String returns the string representation +func (s Stack) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Stack) GoString() string { + return s.String() +} + +// The StackEvent data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackEvent +type StackEvent struct { + _ struct{} `type:"structure"` + + // The token passed to the operation that generated this event. + // + // All events triggered by a given stack operation are assigned the same client + // request token, which you can use to track operations. For example, if you + // execute a CreateStack operation with the token token1, then all the StackEvents + // generated by that operation will have ClientRequestToken set as token1. + // + // In the console, stack operations display the client request token on the + // Events tab. Stack operations that are initiated from the console use the + // token format Console-StackOperation-ID, which helps you easily identify the + // stack operation . For example, if you create a stack using the console, each + // stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. + ClientRequestToken *string `min:"1" type:"string"` + + // The unique ID of this event. + // + // EventId is a required field + EventId *string `type:"string" required:"true"` + + // The logical name of the resource specified in the template. + LogicalResourceId *string `type:"string"` + + // The name or unique identifier associated with the physical instance of the + // resource. + PhysicalResourceId *string `type:"string"` + + // BLOB of the properties used to create the resource. + ResourceProperties *string `type:"string"` + + // Current status of the resource. + ResourceStatus ResourceStatus `type:"string" enum:"true"` + + // Success/failure message associated with the resource. + ResourceStatusReason *string `type:"string"` + + // Type of resource. (For more information, go to AWS Resource Types Reference + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide.) + ResourceType *string `min:"1" type:"string"` + + // The unique ID name of the instance of the stack. + // + // StackId is a required field + StackId *string `type:"string" required:"true"` + + // The name associated with a stack. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // Time the status was updated. + // + // Timestamp is a required field + Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` +} + +// String returns the string representation +func (s StackEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackEvent) GoString() string { + return s.String() +} + +// An AWS CloudFormation stack, in a specific account and region, that's part +// of a stack set operation. A stack instance is a reference to an attempted +// or actual stack in a given account within a given region. A stack instance +// can exist without a stack—for example, if the stack couldn't be created for +// some reason. A stack instance is associated with only one stack set. Each +// stack instance contains the ID of its associated stack set, as well as the +// ID of the actual stack and the stack status. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackInstance +type StackInstance struct { + _ struct{} `type:"structure"` + + // The name of the AWS account that the stack instance is associated with. + Account *string `type:"string"` + + // A list of parameters from the stack set template whose values have been overridden + // in this stack instance. + ParameterOverrides []Parameter `type:"list"` + + // The name of the AWS region that the stack instance is associated with. + Region *string `type:"string"` + + // The ID of the stack instance. + StackId *string `type:"string"` + + // The name or unique ID of the stack set that the stack instance is associated + // with. + StackSetId *string `type:"string"` + + // The status of the stack instance, in terms of its synchronization with its + // associated stack set. + // + // * INOPERABLE: A DeleteStackInstances operation has failed and left the + // stack in an unstable state. Stacks in this state are excluded from further + // UpdateStackSet operations. You might need to perform a DeleteStackInstances + // operation, with RetainStacks set to true, to delete the stack instance, + // and then delete the stack manually. + // + // * OUTDATED: The stack isn't currently up to date with the stack set because: + // + // The associated stack failed during a CreateStackSet or UpdateStackSet operation. + // + // + // The stack was part of a CreateStackSet or UpdateStackSet operation that failed + // or was stopped before the stack was created or updated. + // + // * CURRENT: The stack is currently up to date with the stack set. + Status StackInstanceStatus `type:"string" enum:"true"` + + // The explanation for the specific status code that is assigned to this stack + // instance. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s StackInstance) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackInstance) GoString() string { + return s.String() +} + +// The structure that contains summary information about a stack instance. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackInstanceSummary +type StackInstanceSummary struct { + _ struct{} `type:"structure"` + + // The name of the AWS account that the stack instance is associated with. + Account *string `type:"string"` + + // The name of the AWS region that the stack instance is associated with. + Region *string `type:"string"` + + // The ID of the stack instance. + StackId *string `type:"string"` + + // The name or unique ID of the stack set that the stack instance is associated + // with. + StackSetId *string `type:"string"` + + // The status of the stack instance, in terms of its synchronization with its + // associated stack set. + // + // * INOPERABLE: A DeleteStackInstances operation has failed and left the + // stack in an unstable state. Stacks in this state are excluded from further + // UpdateStackSet operations. You might need to perform a DeleteStackInstances + // operation, with RetainStacks set to true, to delete the stack instance, + // and then delete the stack manually. + // + // * OUTDATED: The stack isn't currently up to date with the stack set because: + // + // The associated stack failed during a CreateStackSet or UpdateStackSet operation. + // + // + // The stack was part of a CreateStackSet or UpdateStackSet operation that failed + // or was stopped before the stack was created or updated. + // + // * CURRENT: The stack is currently up to date with the stack set. + Status StackInstanceStatus `type:"string" enum:"true"` + + // The explanation for the specific status code assigned to this stack instance. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s StackInstanceSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackInstanceSummary) GoString() string { + return s.String() +} + +// The StackResource data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackResource +type StackResource struct { + _ struct{} `type:"structure"` + + // User defined description associated with the resource. + Description *string `min:"1" type:"string"` + + // The logical name of the resource specified in the template. + // + // LogicalResourceId is a required field + LogicalResourceId *string `type:"string" required:"true"` + + // The name or unique identifier that corresponds to a physical instance ID + // of a resource supported by AWS CloudFormation. + PhysicalResourceId *string `type:"string"` + + // Current status of the resource. + // + // ResourceStatus is a required field + ResourceStatus ResourceStatus `type:"string" required:"true" enum:"true"` + + // Success/failure message associated with the resource. + ResourceStatusReason *string `type:"string"` + + // Type of resource. (For more information, go to AWS Resource Types Reference + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide.) + // + // ResourceType is a required field + ResourceType *string `min:"1" type:"string" required:"true"` + + // Unique identifier of the stack. + StackId *string `type:"string"` + + // The name associated with the stack. + StackName *string `type:"string"` + + // Time the status was updated. + // + // Timestamp is a required field + Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` +} + +// String returns the string representation +func (s StackResource) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackResource) GoString() string { + return s.String() +} + +// Contains detailed information about the specified stack resource. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackResourceDetail +type StackResourceDetail struct { + _ struct{} `type:"structure"` + + // User defined description associated with the resource. + Description *string `min:"1" type:"string"` + + // Time the status was updated. + // + // LastUpdatedTimestamp is a required field + LastUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The logical name of the resource specified in the template. + // + // LogicalResourceId is a required field + LogicalResourceId *string `type:"string" required:"true"` + + // The content of the Metadata attribute declared for the resource. For more + // information, see Metadata Attribute (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-metadata.html) + // in the AWS CloudFormation User Guide. + Metadata *string `type:"string"` + + // The name or unique identifier that corresponds to a physical instance ID + // of a resource supported by AWS CloudFormation. + PhysicalResourceId *string `type:"string"` + + // Current status of the resource. + // + // ResourceStatus is a required field + ResourceStatus ResourceStatus `type:"string" required:"true" enum:"true"` + + // Success/failure message associated with the resource. + ResourceStatusReason *string `type:"string"` + + // Type of resource. ((For more information, go to AWS Resource Types Reference + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide.) + // + // ResourceType is a required field + ResourceType *string `min:"1" type:"string" required:"true"` + + // Unique identifier of the stack. + StackId *string `type:"string"` + + // The name associated with the stack. + StackName *string `type:"string"` +} + +// String returns the string representation +func (s StackResourceDetail) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackResourceDetail) GoString() string { + return s.String() +} + +// Contains high-level information about the specified stack resource. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackResourceSummary +type StackResourceSummary struct { + _ struct{} `type:"structure"` + + // Time the status was updated. + // + // LastUpdatedTimestamp is a required field + LastUpdatedTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The logical name of the resource specified in the template. + // + // LogicalResourceId is a required field + LogicalResourceId *string `type:"string" required:"true"` + + // The name or unique identifier that corresponds to a physical instance ID + // of the resource. + PhysicalResourceId *string `type:"string"` + + // Current status of the resource. + // + // ResourceStatus is a required field + ResourceStatus ResourceStatus `type:"string" required:"true" enum:"true"` + + // Success/failure message associated with the resource. + ResourceStatusReason *string `type:"string"` + + // Type of resource. (For more information, go to AWS Resource Types Reference + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html) + // in the AWS CloudFormation User Guide.) + // + // ResourceType is a required field + ResourceType *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s StackResourceSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackResourceSummary) GoString() string { + return s.String() +} + +// A structure that contains information about a stack set. A stack set enables +// you to provision stacks into AWS accounts and across regions by using a single +// CloudFormation template. In the stack set, you specify the template to use, +// as well as any parameters and capabilities that the template requires. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSet +type StackSet struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Number (ARN) of the IAM role used to create or update + // the stack set. + // + // Use customized administrator roles to control which users or groups can manage + // specific stack sets within the same administrator account. For more information, + // see Prerequisites: Granting Permissions for Stack Set Operations (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html) + // in the AWS CloudFormation User Guide. + AdministrationRoleARN *string `min:"20" type:"string"` + + // The capabilities that are allowed in the stack set. Some stack set templates + // might include resources that can affect permissions in your AWS account—for + // example, by creating new AWS Identity and Access Management (IAM) users. + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates. (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities) + Capabilities []Capability `type:"list"` + + // A description of the stack set that you specify when the stack set is created + // or updated. + Description *string `min:"1" type:"string"` + + // The name of the IAM execution role used to create or update the stack set. + // + // Use customized execution roles to control which stack resources users and + // groups can include in their stack sets. + ExecutionRoleName *string `min:"1" type:"string"` + + // A list of input parameters for a stack set. + Parameters []Parameter `type:"list"` + + // The Amazon Resource Number (ARN) of the stack set. + StackSetARN *string `type:"string"` + + // The ID of the stack set. + StackSetId *string `type:"string"` + + // The name that's associated with the stack set. + StackSetName *string `type:"string"` + + // The status of the stack set. + Status StackSetStatus `type:"string" enum:"true"` + + // A list of tags that specify information about the stack set. A maximum number + // of 50 tags can be specified. + Tags []Tag `type:"list"` + + // The structure that contains the body of the template that was used to create + // or update the stack set. + TemplateBody *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s StackSet) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSet) GoString() string { + return s.String() +} + +// The structure that contains information about a stack set operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSetOperation +type StackSetOperation struct { + _ struct{} `type:"structure"` + + // The type of stack set operation: CREATE, UPDATE, or DELETE. Create and delete + // operations affect only the specified stack set instances that are associated + // with the specified stack set. Update operations affect both the stack set + // itself, as well as all associated stack set instances. + Action StackSetOperationAction `type:"string" enum:"true"` + + // The Amazon Resource Number (ARN) of the IAM role used to perform this stack + // set operation. + // + // Use customized administrator roles to control which users or groups can manage + // specific stack sets within the same administrator account. For more information, + // see Define Permissions for Multiple Administrators (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html) + // in the AWS CloudFormation User Guide. + AdministrationRoleARN *string `min:"20" type:"string"` + + // The time at which the operation was initiated. Note that the creation times + // for the stack set operation might differ from the creation time of the individual + // stacks themselves. This is because AWS CloudFormation needs to perform preparatory + // work for the operation, such as dispatching the work to the requested regions, + // before actually creating the first stacks. + CreationTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The time at which the stack set operation ended, across all accounts and + // regions specified. Note that this doesn't necessarily mean that the stack + // set operation was successful, or even attempted, in each account or region. + EndTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The name of the IAM execution role used to create or update the stack set. + // + // Use customized execution roles to control which stack resources users and + // groups can include in their stack sets. + ExecutionRoleName *string `min:"1" type:"string"` + + // The unique ID of a stack set operation. + OperationId *string `min:"1" type:"string"` + + // The preferences for how AWS CloudFormation performs this stack set operation. + OperationPreferences *StackSetOperationPreferences `type:"structure"` + + // For stack set operations of action type DELETE, specifies whether to remove + // the stack instances from the specified stack set, but doesn't delete the + // stacks. You can't reassociate a retained stack, or add an existing, saved + // stack to a new stack set. + RetainStacks *bool `type:"boolean"` + + // The ID of the stack set. + StackSetId *string `type:"string"` + + // The status of the operation. + // + // * FAILED: The operation exceeded the specified failure tolerance. The + // failure tolerance value that you've set for an operation is applied for + // each region during stack create and update operations. If the number of + // failed stacks within a region exceeds the failure tolerance, the status + // of the operation in the region is set to FAILED. This in turn sets the + // status of the operation as a whole to FAILED, and AWS CloudFormation cancels + // the operation in any remaining regions. + // + // * RUNNING: The operation is currently being performed. + // + // * STOPPED: The user has cancelled the operation. + // + // * STOPPING: The operation is in the process of stopping, at user request. + // + // + // * SUCCEEDED: The operation completed creating or updating all the specified + // stacks without exceeding the failure tolerance for the operation. + Status StackSetOperationStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s StackSetOperation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSetOperation) GoString() string { + return s.String() +} + +// The user-specified preferences for how AWS CloudFormation performs a stack +// set operation. +// +// For more information on maximum concurrent accounts and failure tolerance, +// see Stack set operation options (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html#stackset-ops-options). +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSetOperationPreferences +type StackSetOperationPreferences struct { + _ struct{} `type:"structure"` + + // The number of accounts, per region, for which this operation can fail before + // AWS CloudFormation stops the operation in that region. If the operation is + // stopped in a region, AWS CloudFormation doesn't attempt the operation in + // any subsequent regions. + // + // Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage + // (but not both). + FailureToleranceCount *int64 `type:"integer"` + + // The percentage of accounts, per region, for which this stack operation can + // fail before AWS CloudFormation stops the operation in that region. If the + // operation is stopped in a region, AWS CloudFormation doesn't attempt the + // operation in any subsequent regions. + // + // When calculating the number of accounts based on the specified percentage, + // AWS CloudFormation rounds down to the next whole number. + // + // Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage, + // but not both. + FailureTolerancePercentage *int64 `type:"integer"` + + // The maximum number of accounts in which to perform this operation at one + // time. This is dependent on the value of FailureToleranceCount—MaxConcurrentCount + // is at most one more than the FailureToleranceCount . + // + // Note that this setting lets you specify the maximum for operations. For large + // deployments, under certain circumstances the actual number of accounts acted + // upon concurrently may be lower due to service throttling. + // + // Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage, + // but not both. + MaxConcurrentCount *int64 `min:"1" type:"integer"` + + // The maximum percentage of accounts in which to perform this operation at + // one time. + // + // When calculating the number of accounts based on the specified percentage, + // AWS CloudFormation rounds down to the next whole number. This is true except + // in cases where rounding down would result is zero. In this case, CloudFormation + // sets the number as one instead. + // + // Note that this setting lets you specify the maximum for operations. For large + // deployments, under certain circumstances the actual number of accounts acted + // upon concurrently may be lower due to service throttling. + // + // Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage, + // but not both. + MaxConcurrentPercentage *int64 `min:"1" type:"integer"` + + // The order of the regions in where you want to perform the stack operation. + RegionOrder []string `type:"list"` +} + +// String returns the string representation +func (s StackSetOperationPreferences) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSetOperationPreferences) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StackSetOperationPreferences) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "StackSetOperationPreferences"} + if s.MaxConcurrentCount != nil && *s.MaxConcurrentCount < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxConcurrentCount", 1)) + } + if s.MaxConcurrentPercentage != nil && *s.MaxConcurrentPercentage < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxConcurrentPercentage", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The structure that contains information about a specified operation's results +// for a given account in a given region. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSetOperationResultSummary +type StackSetOperationResultSummary struct { + _ struct{} `type:"structure"` + + // The name of the AWS account for this operation result. + Account *string `type:"string"` + + // The results of the account gate function AWS CloudFormation invokes, if present, + // before proceeding with stack set operations in an account + AccountGateResult *AccountGateResult `type:"structure"` + + // The name of the AWS region for this operation result. + Region *string `type:"string"` + + // The result status of the stack set operation for the given account in the + // given region. + // + // * CANCELLED: The operation in the specified account and region has been + // cancelled. This is either because a user has stopped the stack set operation, + // or because the failure tolerance of the stack set operation has been exceeded. + // + // * FAILED: The operation in the specified account and region failed. + // + // If the stack set operation fails in enough accounts within a region, the + // failure tolerance for the stack set operation as a whole might be exceeded. + // + // + // * RUNNING: The operation in the specified account and region is currently + // in progress. + // + // * PENDING: The operation in the specified account and region has yet to + // start. + // + // * SUCCEEDED: The operation in the specified account and region completed + // successfully. + Status StackSetOperationResultStatus `type:"string" enum:"true"` + + // The reason for the assigned result status. + StatusReason *string `type:"string"` +} + +// String returns the string representation +func (s StackSetOperationResultSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSetOperationResultSummary) GoString() string { + return s.String() +} + +// The structures that contain summary information about the specified operation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSetOperationSummary +type StackSetOperationSummary struct { + _ struct{} `type:"structure"` + + // The type of operation: CREATE, UPDATE, or DELETE. Create and delete operations + // affect only the specified stack instances that are associated with the specified + // stack set. Update operations affect both the stack set itself as well as + // all associated stack set instances. + Action StackSetOperationAction `type:"string" enum:"true"` + + // The time at which the operation was initiated. Note that the creation times + // for the stack set operation might differ from the creation time of the individual + // stacks themselves. This is because AWS CloudFormation needs to perform preparatory + // work for the operation, such as dispatching the work to the requested regions, + // before actually creating the first stacks. + CreationTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The time at which the stack set operation ended, across all accounts and + // regions specified. Note that this doesn't necessarily mean that the stack + // set operation was successful, or even attempted, in each account or region. + EndTimestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The unique ID of the stack set operation. + OperationId *string `min:"1" type:"string"` + + // The overall status of the operation. + // + // * FAILED: The operation exceeded the specified failure tolerance. The + // failure tolerance value that you've set for an operation is applied for + // each region during stack create and update operations. If the number of + // failed stacks within a region exceeds the failure tolerance, the status + // of the operation in the region is set to FAILED. This in turn sets the + // status of the operation as a whole to FAILED, and AWS CloudFormation cancels + // the operation in any remaining regions. + // + // * RUNNING: The operation is currently being performed. + // + // * STOPPED: The user has cancelled the operation. + // + // * STOPPING: The operation is in the process of stopping, at user request. + // + // + // * SUCCEEDED: The operation completed creating or updating all the specified + // stacks without exceeding the failure tolerance for the operation. + Status StackSetOperationStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s StackSetOperationSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSetOperationSummary) GoString() string { + return s.String() +} + +// The structures that contain summary information about the specified stack +// set. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSetSummary +type StackSetSummary struct { + _ struct{} `type:"structure"` + + // A description of the stack set that you specify when the stack set is created + // or updated. + Description *string `min:"1" type:"string"` + + // The ID of the stack set. + StackSetId *string `type:"string"` + + // The name of the stack set. + StackSetName *string `type:"string"` + + // The status of the stack set. + Status StackSetStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s StackSetSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSetSummary) GoString() string { + return s.String() +} + +// The StackSummary Data Type +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StackSummary +type StackSummary struct { + _ struct{} `type:"structure"` + + // The time the stack was created. + // + // CreationTime is a required field + CreationTime *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The time the stack was deleted. + DeletionTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The time the stack was last updated. This field will only be returned if + // the stack has been updated at least once. + LastUpdatedTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // For nested stacks--stacks created as resources for another stack--the stack + // ID of the direct parent of this stack. For the first level of nested stacks, + // the root stack is also the parent stack. + // + // For more information, see Working with Nested Stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) + // in the AWS CloudFormation User Guide. + ParentId *string `type:"string"` + + // For nested stacks--stacks created as resources for another stack--the stack + // ID of the the top-level stack to which the nested stack ultimately belongs. + // + // For more information, see Working with Nested Stacks (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) + // in the AWS CloudFormation User Guide. + RootId *string `type:"string"` + + // Unique stack identifier. + StackId *string `type:"string"` + + // The name associated with the stack. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // The current status of the stack. + // + // StackStatus is a required field + StackStatus StackStatus `type:"string" required:"true" enum:"true"` + + // Success/Failure message associated with the stack status. + StackStatusReason *string `type:"string"` + + // The template description of the template used to create the stack. + TemplateDescription *string `type:"string"` +} + +// String returns the string representation +func (s StackSummary) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StackSummary) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StopStackSetOperationInput +type StopStackSetOperationInput struct { + _ struct{} `type:"structure"` + + // The ID of the stack operation. + // + // OperationId is a required field + OperationId *string `min:"1" type:"string" required:"true"` + + // The name or unique ID of the stack set that you want to stop the operation + // for. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s StopStackSetOperationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopStackSetOperationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopStackSetOperationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "StopStackSetOperationInput"} + + if s.OperationId == nil { + invalidParams.Add(aws.NewErrParamRequired("OperationId")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/StopStackSetOperationOutput +type StopStackSetOperationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s StopStackSetOperationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopStackSetOperationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s StopStackSetOperationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The Tag type enables you to specify a key-value pair that can be used to +// store information about an AWS CloudFormation stack. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/Tag +type Tag struct { + _ struct{} `type:"structure"` + + // Required. A string used to identify this tag. You can specify a maximum of + // 128 characters for a tag key. Tags owned by Amazon Web Services (AWS) have + // the reserved prefix: aws:. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` + + // Required. A string containing the value for this tag. You can specify a maximum + // of 256 characters for a tag value. + // + // Value is a required field + Value *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Tag"} + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.Value == nil { + invalidParams.Add(aws.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The TemplateParameter data type. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/TemplateParameter +type TemplateParameter struct { + _ struct{} `type:"structure"` + + // The default value associated with the parameter. + DefaultValue *string `type:"string"` + + // User defined description associated with the parameter. + Description *string `min:"1" type:"string"` + + // Flag indicating whether the parameter should be displayed as plain text in + // logs and UIs. + NoEcho *bool `type:"boolean"` + + // The name associated with the parameter. + ParameterKey *string `type:"string"` +} + +// String returns the string representation +func (s TemplateParameter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TemplateParameter) GoString() string { + return s.String() +} + +// The input for an UpdateStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackInput +type UpdateStackInput struct { + _ struct{} `type:"structure"` + + // A list of values that you must specify before AWS CloudFormation can update + // certain stacks. Some stack templates might include resources that can affect + // permissions in your AWS account, for example, by creating new AWS Identity + // and Access Management (IAM) users. For those stacks, you must explicitly + // acknowledge their capabilities by specifying this parameter. + // + // The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following + // resources require you to specify this parameter: AWS::IAM::AccessKey (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html), + // AWS::IAM::Group (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-group.html), + // AWS::IAM::InstanceProfile (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-instanceprofile.html), + // AWS::IAM::Policy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-policy.html), + // AWS::IAM::Role (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html), + // AWS::IAM::User (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-user.html), + // and AWS::IAM::UserToGroupAddition (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-addusertogroup.html). + // If your stack template contains these resources, we recommend that you review + // all permissions associated with them and edit their permissions if necessary. + // + // If you have IAM resources, you can specify either capability. If you have + // IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If + // you don't specify this parameter, this action returns an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). + Capabilities []Capability `type:"list"` + + // A unique identifier for this UpdateStack request. Specify this token if you + // plan to retry requests so that AWS CloudFormation knows that you're not attempting + // to update a stack with the same name. You might retry UpdateStack requests + // to ensure that AWS CloudFormation successfully received them. + // + // All events triggered by a given stack operation are assigned the same client + // request token, which you can use to track operations. For example, if you + // execute a CreateStack operation with the token token1, then all the StackEvents + // generated by that operation will have ClientRequestToken set as token1. + // + // In the console, stack operations display the client request token on the + // Events tab. Stack operations that are initiated from the console use the + // token format Console-StackOperation-ID, which helps you easily identify the + // stack operation . For example, if you create a stack using the console, each + // stack event would be assigned the same token in the following format: Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002. + ClientRequestToken *string `min:"1" type:"string"` + + // Amazon Simple Notification Service topic Amazon Resource Names (ARNs) that + // AWS CloudFormation associates with the stack. Specify an empty list to remove + // all notification topics. + NotificationARNs []string `type:"list"` + + // A list of Parameter structures that specify input parameters for the stack. + // For more information, see the Parameter (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Parameter.html) + // data type. + Parameters []Parameter `type:"list"` + + // The template resource types that you have permissions to work with for this + // update stack action, such as AWS::EC2::Instance, AWS::EC2::*, or Custom::MyCustomInstance. + // + // If the list of resource types doesn't include a resource that you're updating, + // the stack update fails. By default, AWS CloudFormation grants permissions + // to all resource types. AWS Identity and Access Management (IAM) uses this + // parameter for AWS CloudFormation-specific condition keys in IAM policies. + // For more information, see Controlling Access with AWS Identity and Access + // Management (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html). + ResourceTypes []string `type:"list"` + + // The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) + // role that AWS CloudFormation assumes to update the stack. AWS CloudFormation + // uses the role's credentials to make calls on your behalf. AWS CloudFormation + // always uses this role for all future operations on the stack. As long as + // users have permission to operate on the stack, AWS CloudFormation uses this + // role even if the users don't have permission to pass it. Ensure that the + // role grants least privilege. + // + // If you don't specify a value, AWS CloudFormation uses the role that was previously + // associated with the stack. If no role is available, AWS CloudFormation uses + // a temporary session that is generated from your user credentials. + RoleARN *string `min:"20" type:"string"` + + // The rollback triggers for AWS CloudFormation to monitor during stack creation + // and updating operations, and for the specified monitoring period afterwards. + RollbackConfiguration *RollbackConfiguration `type:"structure"` + + // The name or unique stack ID of the stack to update. + // + // StackName is a required field + StackName *string `type:"string" required:"true"` + + // Structure containing a new stack policy body. You can specify either the + // StackPolicyBody or the StackPolicyURL parameter, but not both. + // + // You might update the stack policy, for example, in order to protect a new + // resource that you created during a stack update. If you do not specify a + // stack policy, the current policy that is associated with the stack is unchanged. + StackPolicyBody *string `min:"1" type:"string"` + + // Structure containing the temporary overriding stack policy body. You can + // specify either the StackPolicyDuringUpdateBody or the StackPolicyDuringUpdateURL + // parameter, but not both. + // + // If you want to update protected resources, specify a temporary overriding + // stack policy during this update. If you do not specify a stack policy, the + // current policy that is associated with the stack will be used. + StackPolicyDuringUpdateBody *string `min:"1" type:"string"` + + // Location of a file containing the temporary overriding stack policy. The + // URL must point to a policy (max size: 16KB) located in an S3 bucket in the + // same region as the stack. You can specify either the StackPolicyDuringUpdateBody + // or the StackPolicyDuringUpdateURL parameter, but not both. + // + // If you want to update protected resources, specify a temporary overriding + // stack policy during this update. If you do not specify a stack policy, the + // current policy that is associated with the stack will be used. + StackPolicyDuringUpdateURL *string `min:"1" type:"string"` + + // Location of a file containing the updated stack policy. The URL must point + // to a policy (max size: 16KB) located in an S3 bucket in the same region as + // the stack. You can specify either the StackPolicyBody or the StackPolicyURL + // parameter, but not both. + // + // You might update the stack policy, for example, in order to protect a new + // resource that you created during a stack update. If you do not specify a + // stack policy, the current policy that is associated with the stack is unchanged. + StackPolicyURL *string `min:"1" type:"string"` + + // Key-value pairs to associate with this stack. AWS CloudFormation also propagates + // these tags to supported resources in the stack. You can specify a maximum + // number of 50 tags. + // + // If you don't specify this parameter, AWS CloudFormation doesn't modify the + // stack's tags. If you specify an empty value, AWS CloudFormation removes all + // associated tags. + Tags []Tag `type:"list"` + + // Structure containing the template body with a minimum length of 1 byte and + // a maximum length of 51,200 bytes. (For more information, go to Template Anatomy + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide.) + // + // Conditional: You must specify only one of the following parameters: TemplateBody, + // TemplateURL, or set the UsePreviousTemplate to true. + TemplateBody *string `min:"1" type:"string"` + + // Location of file containing the template body. The URL must point to a template + // that is located in an Amazon S3 bucket. For more information, go to Template + // Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify only one of the following parameters: TemplateBody, + // TemplateURL, or set the UsePreviousTemplate to true. + TemplateURL *string `min:"1" type:"string"` + + // Reuse the existing template that is associated with the stack that you are + // updating. + // + // Conditional: You must specify only one of the following parameters: TemplateBody, + // TemplateURL, or set the UsePreviousTemplate to true. + UsePreviousTemplate *bool `type:"boolean"` +} + +// String returns the string representation +func (s UpdateStackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateStackInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateStackInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ClientRequestToken", 1)) + } + if s.RoleARN != nil && len(*s.RoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleARN", 20)) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackPolicyBody != nil && len(*s.StackPolicyBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyBody", 1)) + } + if s.StackPolicyDuringUpdateBody != nil && len(*s.StackPolicyDuringUpdateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyDuringUpdateBody", 1)) + } + if s.StackPolicyDuringUpdateURL != nil && len(*s.StackPolicyDuringUpdateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyDuringUpdateURL", 1)) + } + if s.StackPolicyURL != nil && len(*s.StackPolicyURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackPolicyURL", 1)) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + if s.RollbackConfiguration != nil { + if err := s.RollbackConfiguration.Validate(); err != nil { + invalidParams.AddNested("RollbackConfiguration", err.(aws.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackInstancesInput +type UpdateStackInstancesInput struct { + _ struct{} `type:"structure"` + + // The names of one or more AWS accounts for which you want to update parameter + // values for stack instances. The overridden parameter values will be applied + // to all stack instances in the specified accounts and regions. + // + // Accounts is a required field + Accounts []string `type:"list" required:"true"` + + // The unique identifier for this stack set operation. + // + // The operation ID also functions as an idempotency token, to ensure that AWS + // CloudFormation performs the stack set operation only once, even if you retry + // the request multiple times. You might retry stack set operation requests + // to ensure that AWS CloudFormation successfully received them. + // + // If you don't specify an operation ID, the SDK generates one automatically. + OperationId *string `min:"1" type:"string" idempotencyToken:"true"` + + // Preferences for how AWS CloudFormation performs this stack set operation. + OperationPreferences *StackSetOperationPreferences `type:"structure"` + + // A list of input parameters whose values you want to update for the specified + // stack instances. + // + // Any overridden parameter values will be applied to all stack instances in + // the specified accounts and regions. When specifying parameters and their + // values, be aware of how AWS CloudFormation sets parameter values during stack + // instance update operations: + // + // * To override the current value for a parameter, include the parameter + // and specify its value. + // + // * To leave a parameter set to its present value, you can do one of the + // following: + // + // Do not include the parameter in the list. + // + // Include the parameter and specify UsePreviousValue as true. (You cannot specify + // both a value and set UsePreviousValue to true.) + // + // * To set all overridden parameter back to the values specified in the + // stack set, specify a parameter list but do not include any parameters. + // + // * To leave all parameters set to their present values, do not specify + // this property at all. + // + // During stack set updates, any parameter values overridden for a stack instance + // are not updated, but retain their overridden value. + // + // You can only override the parameter values that are specified in the stack + // set; to add or delete a parameter itself, use UpdateStackSet to update the + // stack set template. If you add a parameter to a template, before you can + // override the parameter value specified in the stack set you must first use + // UpdateStackSet (http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStackSet.html) + // to update all stack instances with the updated template and parameter value + // specified in the stack set. Once a stack instance has been updated with the + // new parameter, you can then override the parameter value using UpdateStackInstances. + ParameterOverrides []Parameter `type:"list"` + + // The names of one or more regions in which you want to update parameter values + // for stack instances. The overridden parameter values will be applied to all + // stack instances in the specified accounts and regions. + // + // Regions is a required field + Regions []string `type:"list" required:"true"` + + // The name or unique ID of the stack set associated with the stack instances. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateStackInstancesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackInstancesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateStackInstancesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateStackInstancesInput"} + + if s.Accounts == nil { + invalidParams.Add(aws.NewErrParamRequired("Accounts")) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.Regions == nil { + invalidParams.Add(aws.NewErrParamRequired("Regions")) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + if s.OperationPreferences != nil { + if err := s.OperationPreferences.Validate(); err != nil { + invalidParams.AddNested("OperationPreferences", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackInstancesOutput +type UpdateStackInstancesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The unique identifier for this stack set operation. + OperationId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s UpdateStackInstancesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackInstancesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateStackInstancesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The output for an UpdateStack action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackOutput +type UpdateStackOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Unique identifier of the stack. + StackId *string `type:"string"` +} + +// String returns the string representation +func (s UpdateStackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateStackOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackSetInput +type UpdateStackSetInput struct { + _ struct{} `type:"structure"` + + // The accounts in which to update associated stack instances. If you specify + // accounts, you must also specify the regions in which to update stack set + // instances. + // + // To update all the stack instances associated with this stack set, do not + // specify the Accounts or Regions properties. + // + // If the stack set update includes changes to the template (that is, if the + // TemplateBody or TemplateURL properties are specified), or the Parameters + // property, AWS CloudFormation marks all stack instances with a status of OUTDATED + // prior to updating the stack instances in the specified accounts and regions. + // If the stack set update does not include changes to the template or parameters, + // AWS CloudFormation updates the stack instances in the specified accounts + // and regions, while leaving all other stack instances with their existing + // stack instance status. + Accounts []string `type:"list"` + + // The Amazon Resource Number (ARN) of the IAM role to use to update this stack + // set. + // + // Specify an IAM role only if you are using customized administrator roles + // to control which users or groups can manage specific stack sets within the + // same administrator account. For more information, see Define Permissions + // for Multiple Administrators (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html) + // in the AWS CloudFormation User Guide. + // + // If you specify a customized administrator role, AWS CloudFormation uses that + // role to update the stack. If you do not specify a customized administrator + // role, AWS CloudFormation performs the update using the role previously associated + // with the stack set, so long as you have permissions to perform operations + // on the stack set. + AdministrationRoleARN *string `min:"20" type:"string"` + + // A list of values that you must specify before AWS CloudFormation can create + // certain stack sets. Some stack set templates might include resources that + // can affect permissions in your AWS account—for example, by creating new AWS + // Identity and Access Management (IAM) users. For those stack sets, you must + // explicitly acknowledge their capabilities by specifying this parameter. + // + // The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following + // resources require you to specify this parameter: + // + // * AWS::IAM::AccessKey + // + // * AWS::IAM::Group + // + // * AWS::IAM::InstanceProfile + // + // * AWS::IAM::Policy + // + // * AWS::IAM::Role + // + // * AWS::IAM::User + // + // * AWS::IAM::UserToGroupAddition + // + // If your stack template contains these resources, we recommend that you review + // all permissions that are associated with them and edit their permissions + // if necessary. + // + // If you have IAM resources, you can specify either capability. If you have + // IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If + // you don't specify this parameter, this action returns an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates. (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities) + Capabilities []Capability `type:"list"` + + // A brief description of updates that you are making. + Description *string `min:"1" type:"string"` + + // The name of the IAM execution role to use to update the stack set. If you + // do not specify an execution role, AWS CloudFormation uses the AWSCloudFormationStackSetExecutionRole + // role for the stack set operation. + // + // Specify an IAM role only if you are using customized execution roles to control + // which stack resources users and groups can include in their stack sets. + // + // If you specify a customized execution role, AWS CloudFormation uses that + // role to update the stack. If you do not specify a customized execution role, + // AWS CloudFormation performs the update using the role previously associated + // with the stack set, so long as you have permissions to perform operations + // on the stack set. + ExecutionRoleName *string `min:"1" type:"string"` + + // The unique ID for this stack set operation. + // + // The operation ID also functions as an idempotency token, to ensure that AWS + // CloudFormation performs the stack set operation only once, even if you retry + // the request multiple times. You might retry stack set operation requests + // to ensure that AWS CloudFormation successfully received them. + // + // If you don't specify an operation ID, AWS CloudFormation generates one automatically. + // + // Repeating this stack set operation with a new operation ID retries all stack + // instances whose status is OUTDATED. + OperationId *string `min:"1" type:"string" idempotencyToken:"true"` + + // Preferences for how AWS CloudFormation performs this stack set operation. + OperationPreferences *StackSetOperationPreferences `type:"structure"` + + // A list of input parameters for the stack set template. + Parameters []Parameter `type:"list"` + + // The regions in which to update associated stack instances. If you specify + // regions, you must also specify accounts in which to update stack set instances. + // + // To update all the stack instances associated with this stack set, do not + // specify the Accounts or Regions properties. + // + // If the stack set update includes changes to the template (that is, if the + // TemplateBody or TemplateURL properties are specified), or the Parameters + // property, AWS CloudFormation marks all stack instances with a status of OUTDATED + // prior to updating the stack instances in the specified accounts and regions. + // If the stack set update does not include changes to the template or parameters, + // AWS CloudFormation updates the stack instances in the specified accounts + // and regions, while leaving all other stack instances with their existing + // stack instance status. + Regions []string `type:"list"` + + // The name or unique ID of the stack set that you want to update. + // + // StackSetName is a required field + StackSetName *string `type:"string" required:"true"` + + // The key-value pairs to associate with this stack set and the stacks created + // from it. AWS CloudFormation also propagates these tags to supported resources + // that are created in the stacks. You can specify a maximum number of 50 tags. + // + // If you specify tags for this parameter, those tags replace any list of tags + // that are currently associated with this stack set. This means: + // + // * If you don't specify this parameter, AWS CloudFormation doesn't modify + // the stack's tags. + // + // * If you specify any tags using this parameter, you must specify all the + // tags that you want associated with this stack set, even tags you've specifed + // before (for example, when creating the stack set or during a previous + // update of the stack set.). Any tags that you don't include in the updated + // list of tags are removed from the stack set, and therefore from the stacks + // and resources as well. + // + // * If you specify an empty value, AWS CloudFormation removes all currently + // associated tags. + // + // If you specify new tags as part of an UpdateStackSet action, AWS CloudFormation + // checks to see if you have the required IAM permission to tag resources. If + // you omit tags that are currently associated with the stack set from the list + // of tags you specify, AWS CloudFormation assumes that you want to remove those + // tags from the stack set, and checks to see if you have permission to untag + // resources. If you don't have the necessary permission(s), the entire UpdateStackSet + // action fails with an access denied error, and the stack set is not updated. + Tags []Tag `type:"list"` + + // The structure that contains the template body, with a minimum length of 1 + // byte and a maximum length of 51,200 bytes. For more information, see Template + // Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify only one of the following parameters: TemplateBody + // or TemplateURL—or set UsePreviousTemplate to true. + TemplateBody *string `min:"1" type:"string"` + + // The location of the file that contains the template body. The URL must point + // to a template (maximum size: 460,800 bytes) that is located in an Amazon + // S3 bucket. For more information, see Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must specify only one of the following parameters: TemplateBody + // or TemplateURL—or set UsePreviousTemplate to true. + TemplateURL *string `min:"1" type:"string"` + + // Use the existing template that's associated with the stack set that you're + // updating. + // + // Conditional: You must specify only one of the following parameters: TemplateBody + // or TemplateURL—or set UsePreviousTemplate to true. + UsePreviousTemplate *bool `type:"boolean"` +} + +// String returns the string representation +func (s UpdateStackSetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackSetInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateStackSetInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateStackSetInput"} + if s.AdministrationRoleARN != nil && len(*s.AdministrationRoleARN) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("AdministrationRoleARN", 20)) + } + if s.Description != nil && len(*s.Description) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Description", 1)) + } + if s.ExecutionRoleName != nil && len(*s.ExecutionRoleName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("ExecutionRoleName", 1)) + } + if s.OperationId != nil && len(*s.OperationId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("OperationId", 1)) + } + + if s.StackSetName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackSetName")) + } + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + if s.OperationPreferences != nil { + if err := s.OperationPreferences.Validate(); err != nil { + invalidParams.AddNested("OperationPreferences", err.(aws.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateStackSetOutput +type UpdateStackSetOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The unique ID for this stack set operation. + OperationId *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s UpdateStackSetOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateStackSetOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateStackSetOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateTerminationProtectionInput +type UpdateTerminationProtectionInput struct { + _ struct{} `type:"structure"` + + // Whether to enable termination protection on the specified stack. + // + // EnableTerminationProtection is a required field + EnableTerminationProtection *bool `type:"boolean" required:"true"` + + // The name or unique ID of the stack for which you want to set termination + // protection. + // + // StackName is a required field + StackName *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateTerminationProtectionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateTerminationProtectionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateTerminationProtectionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateTerminationProtectionInput"} + + if s.EnableTerminationProtection == nil { + invalidParams.Add(aws.NewErrParamRequired("EnableTerminationProtection")) + } + + if s.StackName == nil { + invalidParams.Add(aws.NewErrParamRequired("StackName")) + } + if s.StackName != nil && len(*s.StackName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StackName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/UpdateTerminationProtectionOutput +type UpdateTerminationProtectionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The unique ID of the stack. + StackId *string `type:"string"` +} + +// String returns the string representation +func (s UpdateTerminationProtectionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateTerminationProtectionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateTerminationProtectionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The input for ValidateTemplate action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ValidateTemplateInput +type ValidateTemplateInput struct { + _ struct{} `type:"structure"` + + // Structure containing the template body with a minimum length of 1 byte and + // a maximum length of 51,200 bytes. For more information, go to Template Anatomy + // (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must pass TemplateURL or TemplateBody. If both are passed, + // only TemplateBody is used. + TemplateBody *string `min:"1" type:"string"` + + // Location of file containing the template body. The URL must point to a template + // (max size: 460,800 bytes) that is located in an Amazon S3 bucket. For more + // information, go to Template Anatomy (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html) + // in the AWS CloudFormation User Guide. + // + // Conditional: You must pass TemplateURL or TemplateBody. If both are passed, + // only TemplateBody is used. + TemplateURL *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s ValidateTemplateInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ValidateTemplateInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ValidateTemplateInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ValidateTemplateInput"} + if s.TemplateBody != nil && len(*s.TemplateBody) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateBody", 1)) + } + if s.TemplateURL != nil && len(*s.TemplateURL) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TemplateURL", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// The output for ValidateTemplate action. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/ValidateTemplateOutput +type ValidateTemplateOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The capabilities found within the template. If your template contains IAM + // resources, you must specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value + // for this parameter when you use the CreateStack or UpdateStack actions with + // your template; otherwise, those actions return an InsufficientCapabilities + // error. + // + // For more information, see Acknowledging IAM Resources in AWS CloudFormation + // Templates (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities). + Capabilities []Capability `type:"list"` + + // The list of resources that generated the values in the Capabilities response + // element. + CapabilitiesReason *string `type:"string"` + + // A list of the transforms that are declared in the template. + DeclaredTransforms []string `type:"list"` + + // The description found within the template. + Description *string `min:"1" type:"string"` + + // A list of TemplateParameter structures. + Parameters []TemplateParameter `type:"list"` +} + +// String returns the string representation +func (s ValidateTemplateOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ValidateTemplateOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ValidateTemplateOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +type AccountGateStatus string + +// Enum values for AccountGateStatus +const ( + AccountGateStatusSucceeded AccountGateStatus = "SUCCEEDED" + AccountGateStatusFailed AccountGateStatus = "FAILED" + AccountGateStatusSkipped AccountGateStatus = "SKIPPED" +) + +func (enum AccountGateStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum AccountGateStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Capability string + +// Enum values for Capability +const ( + CapabilityCapabilityIam Capability = "CAPABILITY_IAM" + CapabilityCapabilityNamedIam Capability = "CAPABILITY_NAMED_IAM" +) + +func (enum Capability) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Capability) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ChangeAction string + +// Enum values for ChangeAction +const ( + ChangeActionAdd ChangeAction = "Add" + ChangeActionModify ChangeAction = "Modify" + ChangeActionRemove ChangeAction = "Remove" +) + +func (enum ChangeAction) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ChangeAction) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ChangeSetStatus string + +// Enum values for ChangeSetStatus +const ( + ChangeSetStatusCreatePending ChangeSetStatus = "CREATE_PENDING" + ChangeSetStatusCreateInProgress ChangeSetStatus = "CREATE_IN_PROGRESS" + ChangeSetStatusCreateComplete ChangeSetStatus = "CREATE_COMPLETE" + ChangeSetStatusDeleteComplete ChangeSetStatus = "DELETE_COMPLETE" + ChangeSetStatusFailed ChangeSetStatus = "FAILED" +) + +func (enum ChangeSetStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ChangeSetStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ChangeSetType string + +// Enum values for ChangeSetType +const ( + ChangeSetTypeCreate ChangeSetType = "CREATE" + ChangeSetTypeUpdate ChangeSetType = "UPDATE" +) + +func (enum ChangeSetType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ChangeSetType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ChangeSource string + +// Enum values for ChangeSource +const ( + ChangeSourceResourceReference ChangeSource = "ResourceReference" + ChangeSourceParameterReference ChangeSource = "ParameterReference" + ChangeSourceResourceAttribute ChangeSource = "ResourceAttribute" + ChangeSourceDirectModification ChangeSource = "DirectModification" + ChangeSourceAutomatic ChangeSource = "Automatic" +) + +func (enum ChangeSource) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ChangeSource) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ChangeType string + +// Enum values for ChangeType +const ( + ChangeTypeResource ChangeType = "Resource" +) + +func (enum ChangeType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ChangeType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type EvaluationType string + +// Enum values for EvaluationType +const ( + EvaluationTypeStatic EvaluationType = "Static" + EvaluationTypeDynamic EvaluationType = "Dynamic" +) + +func (enum EvaluationType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum EvaluationType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ExecutionStatus string + +// Enum values for ExecutionStatus +const ( + ExecutionStatusUnavailable ExecutionStatus = "UNAVAILABLE" + ExecutionStatusAvailable ExecutionStatus = "AVAILABLE" + ExecutionStatusExecuteInProgress ExecutionStatus = "EXECUTE_IN_PROGRESS" + ExecutionStatusExecuteComplete ExecutionStatus = "EXECUTE_COMPLETE" + ExecutionStatusExecuteFailed ExecutionStatus = "EXECUTE_FAILED" + ExecutionStatusObsolete ExecutionStatus = "OBSOLETE" +) + +func (enum ExecutionStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ExecutionStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type OnFailure string + +// Enum values for OnFailure +const ( + OnFailureDoNothing OnFailure = "DO_NOTHING" + OnFailureRollback OnFailure = "ROLLBACK" + OnFailureDelete OnFailure = "DELETE" +) + +func (enum OnFailure) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum OnFailure) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Replacement string + +// Enum values for Replacement +const ( + ReplacementTrue Replacement = "True" + ReplacementFalse Replacement = "False" + ReplacementConditional Replacement = "Conditional" +) + +func (enum Replacement) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Replacement) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type RequiresRecreation string + +// Enum values for RequiresRecreation +const ( + RequiresRecreationNever RequiresRecreation = "Never" + RequiresRecreationConditionally RequiresRecreation = "Conditionally" + RequiresRecreationAlways RequiresRecreation = "Always" +) + +func (enum RequiresRecreation) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum RequiresRecreation) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ResourceAttribute string + +// Enum values for ResourceAttribute +const ( + ResourceAttributeProperties ResourceAttribute = "Properties" + ResourceAttributeMetadata ResourceAttribute = "Metadata" + ResourceAttributeCreationPolicy ResourceAttribute = "CreationPolicy" + ResourceAttributeUpdatePolicy ResourceAttribute = "UpdatePolicy" + ResourceAttributeDeletionPolicy ResourceAttribute = "DeletionPolicy" + ResourceAttributeTags ResourceAttribute = "Tags" +) + +func (enum ResourceAttribute) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ResourceAttribute) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ResourceSignalStatus string + +// Enum values for ResourceSignalStatus +const ( + ResourceSignalStatusSuccess ResourceSignalStatus = "SUCCESS" + ResourceSignalStatusFailure ResourceSignalStatus = "FAILURE" +) + +func (enum ResourceSignalStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ResourceSignalStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ResourceStatus string + +// Enum values for ResourceStatus +const ( + ResourceStatusCreateInProgress ResourceStatus = "CREATE_IN_PROGRESS" + ResourceStatusCreateFailed ResourceStatus = "CREATE_FAILED" + ResourceStatusCreateComplete ResourceStatus = "CREATE_COMPLETE" + ResourceStatusDeleteInProgress ResourceStatus = "DELETE_IN_PROGRESS" + ResourceStatusDeleteFailed ResourceStatus = "DELETE_FAILED" + ResourceStatusDeleteComplete ResourceStatus = "DELETE_COMPLETE" + ResourceStatusDeleteSkipped ResourceStatus = "DELETE_SKIPPED" + ResourceStatusUpdateInProgress ResourceStatus = "UPDATE_IN_PROGRESS" + ResourceStatusUpdateFailed ResourceStatus = "UPDATE_FAILED" + ResourceStatusUpdateComplete ResourceStatus = "UPDATE_COMPLETE" +) + +func (enum ResourceStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ResourceStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackInstanceStatus string + +// Enum values for StackInstanceStatus +const ( + StackInstanceStatusCurrent StackInstanceStatus = "CURRENT" + StackInstanceStatusOutdated StackInstanceStatus = "OUTDATED" + StackInstanceStatusInoperable StackInstanceStatus = "INOPERABLE" +) + +func (enum StackInstanceStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackInstanceStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackSetOperationAction string + +// Enum values for StackSetOperationAction +const ( + StackSetOperationActionCreate StackSetOperationAction = "CREATE" + StackSetOperationActionUpdate StackSetOperationAction = "UPDATE" + StackSetOperationActionDelete StackSetOperationAction = "DELETE" +) + +func (enum StackSetOperationAction) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackSetOperationAction) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackSetOperationResultStatus string + +// Enum values for StackSetOperationResultStatus +const ( + StackSetOperationResultStatusPending StackSetOperationResultStatus = "PENDING" + StackSetOperationResultStatusRunning StackSetOperationResultStatus = "RUNNING" + StackSetOperationResultStatusSucceeded StackSetOperationResultStatus = "SUCCEEDED" + StackSetOperationResultStatusFailed StackSetOperationResultStatus = "FAILED" + StackSetOperationResultStatusCancelled StackSetOperationResultStatus = "CANCELLED" +) + +func (enum StackSetOperationResultStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackSetOperationResultStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackSetOperationStatus string + +// Enum values for StackSetOperationStatus +const ( + StackSetOperationStatusRunning StackSetOperationStatus = "RUNNING" + StackSetOperationStatusSucceeded StackSetOperationStatus = "SUCCEEDED" + StackSetOperationStatusFailed StackSetOperationStatus = "FAILED" + StackSetOperationStatusStopping StackSetOperationStatus = "STOPPING" + StackSetOperationStatusStopped StackSetOperationStatus = "STOPPED" +) + +func (enum StackSetOperationStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackSetOperationStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackSetStatus string + +// Enum values for StackSetStatus +const ( + StackSetStatusActive StackSetStatus = "ACTIVE" + StackSetStatusDeleted StackSetStatus = "DELETED" +) + +func (enum StackSetStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackSetStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StackStatus string + +// Enum values for StackStatus +const ( + StackStatusCreateInProgress StackStatus = "CREATE_IN_PROGRESS" + StackStatusCreateFailed StackStatus = "CREATE_FAILED" + StackStatusCreateComplete StackStatus = "CREATE_COMPLETE" + StackStatusRollbackInProgress StackStatus = "ROLLBACK_IN_PROGRESS" + StackStatusRollbackFailed StackStatus = "ROLLBACK_FAILED" + StackStatusRollbackComplete StackStatus = "ROLLBACK_COMPLETE" + StackStatusDeleteInProgress StackStatus = "DELETE_IN_PROGRESS" + StackStatusDeleteFailed StackStatus = "DELETE_FAILED" + StackStatusDeleteComplete StackStatus = "DELETE_COMPLETE" + StackStatusUpdateInProgress StackStatus = "UPDATE_IN_PROGRESS" + StackStatusUpdateCompleteCleanupInProgress StackStatus = "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" + StackStatusUpdateComplete StackStatus = "UPDATE_COMPLETE" + StackStatusUpdateRollbackInProgress StackStatus = "UPDATE_ROLLBACK_IN_PROGRESS" + StackStatusUpdateRollbackFailed StackStatus = "UPDATE_ROLLBACK_FAILED" + StackStatusUpdateRollbackCompleteCleanupInProgress StackStatus = "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS" + StackStatusUpdateRollbackComplete StackStatus = "UPDATE_ROLLBACK_COMPLETE" + StackStatusReviewInProgress StackStatus = "REVIEW_IN_PROGRESS" +) + +func (enum StackStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StackStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type TemplateStage string + +// Enum values for TemplateStage +const ( + TemplateStageOriginal TemplateStage = "Original" + TemplateStageProcessed TemplateStage = "Processed" +) + +func (enum TemplateStage) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum TemplateStage) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/doc.go new file mode 100644 index 000000000000..d4f56e356ece --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/doc.go @@ -0,0 +1,46 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package cloudformation provides the client and types for making API +// requests to AWS CloudFormation. +// +// AWS CloudFormation allows you to create and manage AWS infrastructure deployments +// predictably and repeatedly. You can use AWS CloudFormation to leverage AWS +// products, such as Amazon Elastic Compute Cloud, Amazon Elastic Block Store, +// Amazon Simple Notification Service, Elastic Load Balancing, and Auto Scaling +// to build highly-reliable, highly scalable, cost-effective applications without +// creating or configuring the underlying AWS infrastructure. +// +// With AWS CloudFormation, you declare all of your resources and dependencies +// in a template file. The template defines a collection of resources as a single +// unit called a stack. AWS CloudFormation creates and deletes all member resources +// of the stack together and manages all dependencies between the resources +// for you. +// +// For more information about AWS CloudFormation, see the AWS CloudFormation +// Product Page (http://aws.amazon.com/cloudformation/). +// +// Amazon CloudFormation makes use of other AWS products. If you need additional +// technical information about a specific AWS product, you can find the product's +// technical documentation at docs.aws.amazon.com (http://docs.aws.amazon.com/). +// +// See https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15 for more information on this service. +// +// See cloudformation package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudformation/ +// +// Using the Client +// +// To AWS CloudFormation with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the AWS CloudFormation client CloudFormation for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudformation/#New +package cloudformation diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/errors.go new file mode 100644 index 000000000000..8744a3b76bae --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/errors.go @@ -0,0 +1,112 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudformation + +const ( + + // ErrCodeAlreadyExistsException for service response error code + // "AlreadyExistsException". + // + // The resource with the name requested already exists. + ErrCodeAlreadyExistsException = "AlreadyExistsException" + + // ErrCodeChangeSetNotFoundException for service response error code + // "ChangeSetNotFound". + // + // The specified change set name or ID doesn't exit. To view valid change sets + // for a stack, use the ListChangeSets action. + ErrCodeChangeSetNotFoundException = "ChangeSetNotFound" + + // ErrCodeCreatedButModifiedException for service response error code + // "CreatedButModifiedException". + // + // The specified resource exists, but has been changed. + ErrCodeCreatedButModifiedException = "CreatedButModifiedException" + + // ErrCodeInsufficientCapabilitiesException for service response error code + // "InsufficientCapabilitiesException". + // + // The template contains resources with capabilities that weren't specified + // in the Capabilities parameter. + ErrCodeInsufficientCapabilitiesException = "InsufficientCapabilitiesException" + + // ErrCodeInvalidChangeSetStatusException for service response error code + // "InvalidChangeSetStatus". + // + // The specified change set can't be used to update the stack. For example, + // the change set status might be CREATE_IN_PROGRESS, or the stack status might + // be UPDATE_IN_PROGRESS. + ErrCodeInvalidChangeSetStatusException = "InvalidChangeSetStatus" + + // ErrCodeInvalidOperationException for service response error code + // "InvalidOperationException". + // + // The specified operation isn't valid. + ErrCodeInvalidOperationException = "InvalidOperationException" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // The quota for the resource has already been reached. + // + // For information on stack set limitations, see Limitations of StackSets (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-limitations.html). + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeNameAlreadyExistsException for service response error code + // "NameAlreadyExistsException". + // + // The specified name is already in use. + ErrCodeNameAlreadyExistsException = "NameAlreadyExistsException" + + // ErrCodeOperationIdAlreadyExistsException for service response error code + // "OperationIdAlreadyExistsException". + // + // The specified operation ID already exists. + ErrCodeOperationIdAlreadyExistsException = "OperationIdAlreadyExistsException" + + // ErrCodeOperationInProgressException for service response error code + // "OperationInProgressException". + // + // Another operation is currently in progress for this stack set. Only one operation + // can be performed for a stack set at a given time. + ErrCodeOperationInProgressException = "OperationInProgressException" + + // ErrCodeOperationNotFoundException for service response error code + // "OperationNotFoundException". + // + // The specified ID refers to an operation that doesn't exist. + ErrCodeOperationNotFoundException = "OperationNotFoundException" + + // ErrCodeStackInstanceNotFoundException for service response error code + // "StackInstanceNotFoundException". + // + // The specified stack instance doesn't exist. + ErrCodeStackInstanceNotFoundException = "StackInstanceNotFoundException" + + // ErrCodeStackSetNotEmptyException for service response error code + // "StackSetNotEmptyException". + // + // You can't yet delete this stack set, because it still contains one or more + // stack instances. Delete all stack instances from the stack set before deleting + // the stack set. + ErrCodeStackSetNotEmptyException = "StackSetNotEmptyException" + + // ErrCodeStackSetNotFoundException for service response error code + // "StackSetNotFoundException". + // + // The specified stack set doesn't exist. + ErrCodeStackSetNotFoundException = "StackSetNotFoundException" + + // ErrCodeStaleRequestException for service response error code + // "StaleRequestException". + // + // Another operation has been performed on this stack set since the specified + // operation was performed. + ErrCodeStaleRequestException = "StaleRequestException" + + // ErrCodeTokenAlreadyExistsException for service response error code + // "TokenAlreadyExistsException". + // + // A client request token already exists. + ErrCodeTokenAlreadyExistsException = "TokenAlreadyExistsException" +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/service.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/service.go new file mode 100644 index 000000000000..286394ca532a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/service.go @@ -0,0 +1,80 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudformation + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/private/protocol/query" +) + +// CloudFormation provides the API operation methods for making requests to +// AWS CloudFormation. See this package's package overview docs +// for details on the service. +// +// CloudFormation methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type CloudFormation struct { + *aws.Client +} + +// Used for custom client initialization logic +var initClient func(*CloudFormation) + +// Used for custom request initialization logic +var initRequest func(*CloudFormation, *aws.Request) + +// Service information constants +const ( + ServiceName = "cloudformation" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the CloudFormation client with a config. +// +// Example: +// // Create a CloudFormation client from just a config. +// svc := cloudformation.New(myConfig) +func New(config aws.Config) *CloudFormation { + var signingName string + signingRegion := config.Region + + svc := &CloudFormation{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + APIVersion: "2010-05-15", + }, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc) + } + + return svc +} + +// newRequest creates a new request for a CloudFormation operation and runs any +// custom request initialization. +func (c *CloudFormation) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(c, req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/waiters.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/waiters.go new file mode 100644 index 000000000000..7115896dc0cd --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudformation/waiters.go @@ -0,0 +1,334 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudformation + +import ( + "time" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// WaitUntilChangeSetCreateComplete uses the AWS CloudFormation API operation +// DescribeChangeSet to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudFormation) WaitUntilChangeSetCreateComplete(input *DescribeChangeSetInput) error { + return c.WaitUntilChangeSetCreateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilChangeSetCreateCompleteWithContext is an extended version of WaitUntilChangeSetCreateComplete. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudFormation) WaitUntilChangeSetCreateCompleteWithContext(ctx aws.Context, input *DescribeChangeSetInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilChangeSetCreateComplete", + MaxAttempts: 120, + Delay: aws.ConstantWaiterDelay(30 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.PathWaiterMatch, Argument: "Status", + Expected: "CREATE_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathWaiterMatch, Argument: "Status", + Expected: "FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.ErrorWaiterMatch, + Expected: "ValidationError", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *DescribeChangeSetInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.DescribeChangeSetRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilStackCreateComplete uses the AWS CloudFormation API operation +// DescribeStacks to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudFormation) WaitUntilStackCreateComplete(input *DescribeStacksInput) error { + return c.WaitUntilStackCreateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackCreateCompleteWithContext is an extended version of WaitUntilStackCreateComplete. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudFormation) WaitUntilStackCreateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilStackCreateComplete", + MaxAttempts: 120, + Delay: aws.ConstantWaiterDelay(30 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "CREATE_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "CREATE_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "DELETE_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "DELETE_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.ErrorWaiterMatch, + Expected: "ValidationError", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilStackDeleteComplete uses the AWS CloudFormation API operation +// DescribeStacks to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudFormation) WaitUntilStackDeleteComplete(input *DescribeStacksInput) error { + return c.WaitUntilStackDeleteCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackDeleteCompleteWithContext is an extended version of WaitUntilStackDeleteComplete. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudFormation) WaitUntilStackDeleteCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilStackDeleteComplete", + MaxAttempts: 120, + Delay: aws.ConstantWaiterDelay(30 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "DELETE_COMPLETE", + }, + { + State: aws.SuccessWaiterState, + Matcher: aws.ErrorWaiterMatch, + Expected: "ValidationError", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "DELETE_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "CREATE_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "ROLLBACK_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_IN_PROGRESS", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilStackExists uses the AWS CloudFormation API operation +// DescribeStacks to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudFormation) WaitUntilStackExists(input *DescribeStacksInput) error { + return c.WaitUntilStackExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackExistsWithContext is an extended version of WaitUntilStackExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudFormation) WaitUntilStackExistsWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilStackExists", + MaxAttempts: 20, + Delay: aws.ConstantWaiterDelay(5 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 200, + }, + { + State: aws.RetryWaiterState, + Matcher: aws.ErrorWaiterMatch, + Expected: "ValidationError", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilStackUpdateComplete uses the AWS CloudFormation API operation +// DescribeStacks to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *CloudFormation) WaitUntilStackUpdateComplete(input *DescribeStacksInput) error { + return c.WaitUntilStackUpdateCompleteWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilStackUpdateCompleteWithContext is an extended version of WaitUntilStackUpdateComplete. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *CloudFormation) WaitUntilStackUpdateCompleteWithContext(ctx aws.Context, input *DescribeStacksInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilStackUpdateComplete", + MaxAttempts: 120, + Delay: aws.ConstantWaiterDelay(30 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.PathAllWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_FAILED", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.PathAnyWaiterMatch, Argument: "Stacks[].StackStatus", + Expected: "UPDATE_ROLLBACK_COMPLETE", + }, + { + State: aws.FailureWaiterState, + Matcher: aws.ErrorWaiterMatch, + Expected: "ValidationError", + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *DescribeStacksInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.DescribeStacksRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/api.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/api.go new file mode 100644 index 000000000000..07fffcb4026c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/api.go @@ -0,0 +1,5461 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +import ( + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc" +) + +const opAssociateKmsKey = "AssociateKmsKey" + +// AssociateKmsKeyRequest is a API request type for the AssociateKmsKey API operation. +type AssociateKmsKeyRequest struct { + *aws.Request + Input *AssociateKmsKeyInput + Copy func(*AssociateKmsKeyInput) AssociateKmsKeyRequest +} + +// Send marshals and sends the AssociateKmsKey API request. +func (r AssociateKmsKeyRequest) Send() (*AssociateKmsKeyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AssociateKmsKeyOutput), nil +} + +// AssociateKmsKeyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Associates the specified AWS Key Management Service (AWS KMS) customer master +// key (CMK) with the specified log group. +// +// Associating an AWS KMS CMK with a log group overrides any existing associations +// between the log group and a CMK. After a CMK is associated with a log group, +// all newly ingested data for the log group is encrypted using the CMK. This +// association is stored as long as the data encrypted with the CMK is still +// within Amazon CloudWatch Logs. This enables Amazon CloudWatch Logs to decrypt +// this data whenever it is requested. +// +// Note that it can take up to 5 minutes for this operation to take effect. +// +// If you attempt to associate a CMK with a log group but the CMK does not exist +// or the CMK is disabled, you will receive an InvalidParameterException error. +// +// // Example sending a request using the AssociateKmsKeyRequest method. +// req := client.AssociateKmsKeyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/AssociateKmsKey +func (c *CloudWatchLogs) AssociateKmsKeyRequest(input *AssociateKmsKeyInput) AssociateKmsKeyRequest { + op := &aws.Operation{ + Name: opAssociateKmsKey, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AssociateKmsKeyInput{} + } + + output := &AssociateKmsKeyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return AssociateKmsKeyRequest{Request: req, Input: input, Copy: c.AssociateKmsKeyRequest} +} + +const opCancelExportTask = "CancelExportTask" + +// CancelExportTaskRequest is a API request type for the CancelExportTask API operation. +type CancelExportTaskRequest struct { + *aws.Request + Input *CancelExportTaskInput + Copy func(*CancelExportTaskInput) CancelExportTaskRequest +} + +// Send marshals and sends the CancelExportTask API request. +func (r CancelExportTaskRequest) Send() (*CancelExportTaskOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CancelExportTaskOutput), nil +} + +// CancelExportTaskRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Cancels the specified export task. +// +// The task must be in the PENDING or RUNNING state. +// +// // Example sending a request using the CancelExportTaskRequest method. +// req := client.CancelExportTaskRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTask +func (c *CloudWatchLogs) CancelExportTaskRequest(input *CancelExportTaskInput) CancelExportTaskRequest { + op := &aws.Operation{ + Name: opCancelExportTask, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CancelExportTaskInput{} + } + + output := &CancelExportTaskOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return CancelExportTaskRequest{Request: req, Input: input, Copy: c.CancelExportTaskRequest} +} + +const opCreateExportTask = "CreateExportTask" + +// CreateExportTaskRequest is a API request type for the CreateExportTask API operation. +type CreateExportTaskRequest struct { + *aws.Request + Input *CreateExportTaskInput + Copy func(*CreateExportTaskInput) CreateExportTaskRequest +} + +// Send marshals and sends the CreateExportTask API request. +func (r CreateExportTaskRequest) Send() (*CreateExportTaskOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateExportTaskOutput), nil +} + +// CreateExportTaskRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates an export task, which allows you to efficiently export data from +// a log group to an Amazon S3 bucket. +// +// This is an asynchronous call. If all the required information is provided, +// this operation initiates an export task and responds with the ID of the task. +// After the task has started, you can use DescribeExportTasks to get the status +// of the export task. Each account can only have one active (RUNNING or PENDING) +// export task at a time. To cancel an export task, use CancelExportTask. +// +// You can export logs from multiple log groups or multiple time ranges to the +// same S3 bucket. To separate out log data for each export task, you can specify +// a prefix to be used as the Amazon S3 key prefix for all exported objects. +// +// // Example sending a request using the CreateExportTaskRequest method. +// req := client.CreateExportTaskRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTask +func (c *CloudWatchLogs) CreateExportTaskRequest(input *CreateExportTaskInput) CreateExportTaskRequest { + op := &aws.Operation{ + Name: opCreateExportTask, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateExportTaskInput{} + } + + output := &CreateExportTaskOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateExportTaskRequest{Request: req, Input: input, Copy: c.CreateExportTaskRequest} +} + +const opCreateLogGroup = "CreateLogGroup" + +// CreateLogGroupRequest is a API request type for the CreateLogGroup API operation. +type CreateLogGroupRequest struct { + *aws.Request + Input *CreateLogGroupInput + Copy func(*CreateLogGroupInput) CreateLogGroupRequest +} + +// Send marshals and sends the CreateLogGroup API request. +func (r CreateLogGroupRequest) Send() (*CreateLogGroupOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateLogGroupOutput), nil +} + +// CreateLogGroupRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates a log group with the specified name. +// +// You can create up to 5000 log groups per account. +// +// You must use the following guidelines when naming a log group: +// +// * Log group names must be unique within a region for an AWS account. +// +// * Log group names can be between 1 and 512 characters long. +// +// * Log group names consist of the following characters: a-z, A-Z, 0-9, +// '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period). +// +// If you associate a AWS Key Management Service (AWS KMS) customer master key +// (CMK) with the log group, ingested data is encrypted using the CMK. This +// association is stored as long as the data encrypted with the CMK is still +// within Amazon CloudWatch Logs. This enables Amazon CloudWatch Logs to decrypt +// this data whenever it is requested. +// +// If you attempt to associate a CMK with the log group but the CMK does not +// exist or the CMK is disabled, you will receive an InvalidParameterException +// error. +// +// // Example sending a request using the CreateLogGroupRequest method. +// req := client.CreateLogGroupRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroup +func (c *CloudWatchLogs) CreateLogGroupRequest(input *CreateLogGroupInput) CreateLogGroupRequest { + op := &aws.Operation{ + Name: opCreateLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateLogGroupInput{} + } + + output := &CreateLogGroupOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return CreateLogGroupRequest{Request: req, Input: input, Copy: c.CreateLogGroupRequest} +} + +const opCreateLogStream = "CreateLogStream" + +// CreateLogStreamRequest is a API request type for the CreateLogStream API operation. +type CreateLogStreamRequest struct { + *aws.Request + Input *CreateLogStreamInput + Copy func(*CreateLogStreamInput) CreateLogStreamRequest +} + +// Send marshals and sends the CreateLogStream API request. +func (r CreateLogStreamRequest) Send() (*CreateLogStreamOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateLogStreamOutput), nil +} + +// CreateLogStreamRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates a log stream for the specified log group. +// +// There is no limit on the number of log streams that you can create for a +// log group. +// +// You must use the following guidelines when naming a log stream: +// +// * Log stream names must be unique within the log group. +// +// * Log stream names can be between 1 and 512 characters long. +// +// * The ':' (colon) and '*' (asterisk) characters are not allowed. +// +// // Example sending a request using the CreateLogStreamRequest method. +// req := client.CreateLogStreamRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStream +func (c *CloudWatchLogs) CreateLogStreamRequest(input *CreateLogStreamInput) CreateLogStreamRequest { + op := &aws.Operation{ + Name: opCreateLogStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateLogStreamInput{} + } + + output := &CreateLogStreamOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return CreateLogStreamRequest{Request: req, Input: input, Copy: c.CreateLogStreamRequest} +} + +const opDeleteDestination = "DeleteDestination" + +// DeleteDestinationRequest is a API request type for the DeleteDestination API operation. +type DeleteDestinationRequest struct { + *aws.Request + Input *DeleteDestinationInput + Copy func(*DeleteDestinationInput) DeleteDestinationRequest +} + +// Send marshals and sends the DeleteDestination API request. +func (r DeleteDestinationRequest) Send() (*DeleteDestinationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteDestinationOutput), nil +} + +// DeleteDestinationRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified destination, and eventually disables all the subscription +// filters that publish to it. This operation does not delete the physical resource +// encapsulated by the destination. +// +// // Example sending a request using the DeleteDestinationRequest method. +// req := client.DeleteDestinationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestination +func (c *CloudWatchLogs) DeleteDestinationRequest(input *DeleteDestinationInput) DeleteDestinationRequest { + op := &aws.Operation{ + Name: opDeleteDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteDestinationInput{} + } + + output := &DeleteDestinationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteDestinationRequest{Request: req, Input: input, Copy: c.DeleteDestinationRequest} +} + +const opDeleteLogGroup = "DeleteLogGroup" + +// DeleteLogGroupRequest is a API request type for the DeleteLogGroup API operation. +type DeleteLogGroupRequest struct { + *aws.Request + Input *DeleteLogGroupInput + Copy func(*DeleteLogGroupInput) DeleteLogGroupRequest +} + +// Send marshals and sends the DeleteLogGroup API request. +func (r DeleteLogGroupRequest) Send() (*DeleteLogGroupOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteLogGroupOutput), nil +} + +// DeleteLogGroupRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified log group and permanently deletes all the archived +// log events associated with the log group. +// +// // Example sending a request using the DeleteLogGroupRequest method. +// req := client.DeleteLogGroupRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroup +func (c *CloudWatchLogs) DeleteLogGroupRequest(input *DeleteLogGroupInput) DeleteLogGroupRequest { + op := &aws.Operation{ + Name: opDeleteLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteLogGroupInput{} + } + + output := &DeleteLogGroupOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteLogGroupRequest{Request: req, Input: input, Copy: c.DeleteLogGroupRequest} +} + +const opDeleteLogStream = "DeleteLogStream" + +// DeleteLogStreamRequest is a API request type for the DeleteLogStream API operation. +type DeleteLogStreamRequest struct { + *aws.Request + Input *DeleteLogStreamInput + Copy func(*DeleteLogStreamInput) DeleteLogStreamRequest +} + +// Send marshals and sends the DeleteLogStream API request. +func (r DeleteLogStreamRequest) Send() (*DeleteLogStreamOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteLogStreamOutput), nil +} + +// DeleteLogStreamRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified log stream and permanently deletes all the archived +// log events associated with the log stream. +// +// // Example sending a request using the DeleteLogStreamRequest method. +// req := client.DeleteLogStreamRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStream +func (c *CloudWatchLogs) DeleteLogStreamRequest(input *DeleteLogStreamInput) DeleteLogStreamRequest { + op := &aws.Operation{ + Name: opDeleteLogStream, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteLogStreamInput{} + } + + output := &DeleteLogStreamOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteLogStreamRequest{Request: req, Input: input, Copy: c.DeleteLogStreamRequest} +} + +const opDeleteMetricFilter = "DeleteMetricFilter" + +// DeleteMetricFilterRequest is a API request type for the DeleteMetricFilter API operation. +type DeleteMetricFilterRequest struct { + *aws.Request + Input *DeleteMetricFilterInput + Copy func(*DeleteMetricFilterInput) DeleteMetricFilterRequest +} + +// Send marshals and sends the DeleteMetricFilter API request. +func (r DeleteMetricFilterRequest) Send() (*DeleteMetricFilterOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteMetricFilterOutput), nil +} + +// DeleteMetricFilterRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified metric filter. +// +// // Example sending a request using the DeleteMetricFilterRequest method. +// req := client.DeleteMetricFilterRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilter +func (c *CloudWatchLogs) DeleteMetricFilterRequest(input *DeleteMetricFilterInput) DeleteMetricFilterRequest { + op := &aws.Operation{ + Name: opDeleteMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteMetricFilterInput{} + } + + output := &DeleteMetricFilterOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteMetricFilterRequest{Request: req, Input: input, Copy: c.DeleteMetricFilterRequest} +} + +const opDeleteResourcePolicy = "DeleteResourcePolicy" + +// DeleteResourcePolicyRequest is a API request type for the DeleteResourcePolicy API operation. +type DeleteResourcePolicyRequest struct { + *aws.Request + Input *DeleteResourcePolicyInput + Copy func(*DeleteResourcePolicyInput) DeleteResourcePolicyRequest +} + +// Send marshals and sends the DeleteResourcePolicy API request. +func (r DeleteResourcePolicyRequest) Send() (*DeleteResourcePolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteResourcePolicyOutput), nil +} + +// DeleteResourcePolicyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes a resource policy from this account. This revokes the access of the +// identities in that policy to put log events to this account. +// +// // Example sending a request using the DeleteResourcePolicyRequest method. +// req := client.DeleteResourcePolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteResourcePolicy +func (c *CloudWatchLogs) DeleteResourcePolicyRequest(input *DeleteResourcePolicyInput) DeleteResourcePolicyRequest { + op := &aws.Operation{ + Name: opDeleteResourcePolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteResourcePolicyInput{} + } + + output := &DeleteResourcePolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteResourcePolicyRequest{Request: req, Input: input, Copy: c.DeleteResourcePolicyRequest} +} + +const opDeleteRetentionPolicy = "DeleteRetentionPolicy" + +// DeleteRetentionPolicyRequest is a API request type for the DeleteRetentionPolicy API operation. +type DeleteRetentionPolicyRequest struct { + *aws.Request + Input *DeleteRetentionPolicyInput + Copy func(*DeleteRetentionPolicyInput) DeleteRetentionPolicyRequest +} + +// Send marshals and sends the DeleteRetentionPolicy API request. +func (r DeleteRetentionPolicyRequest) Send() (*DeleteRetentionPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteRetentionPolicyOutput), nil +} + +// DeleteRetentionPolicyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified retention policy. +// +// Log events do not expire if they belong to log groups without a retention +// policy. +// +// // Example sending a request using the DeleteRetentionPolicyRequest method. +// req := client.DeleteRetentionPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicy +func (c *CloudWatchLogs) DeleteRetentionPolicyRequest(input *DeleteRetentionPolicyInput) DeleteRetentionPolicyRequest { + op := &aws.Operation{ + Name: opDeleteRetentionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRetentionPolicyInput{} + } + + output := &DeleteRetentionPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteRetentionPolicyRequest{Request: req, Input: input, Copy: c.DeleteRetentionPolicyRequest} +} + +const opDeleteSubscriptionFilter = "DeleteSubscriptionFilter" + +// DeleteSubscriptionFilterRequest is a API request type for the DeleteSubscriptionFilter API operation. +type DeleteSubscriptionFilterRequest struct { + *aws.Request + Input *DeleteSubscriptionFilterInput + Copy func(*DeleteSubscriptionFilterInput) DeleteSubscriptionFilterRequest +} + +// Send marshals and sends the DeleteSubscriptionFilter API request. +func (r DeleteSubscriptionFilterRequest) Send() (*DeleteSubscriptionFilterOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteSubscriptionFilterOutput), nil +} + +// DeleteSubscriptionFilterRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Deletes the specified subscription filter. +// +// // Example sending a request using the DeleteSubscriptionFilterRequest method. +// req := client.DeleteSubscriptionFilterRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilter +func (c *CloudWatchLogs) DeleteSubscriptionFilterRequest(input *DeleteSubscriptionFilterInput) DeleteSubscriptionFilterRequest { + op := &aws.Operation{ + Name: opDeleteSubscriptionFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteSubscriptionFilterInput{} + } + + output := &DeleteSubscriptionFilterOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteSubscriptionFilterRequest{Request: req, Input: input, Copy: c.DeleteSubscriptionFilterRequest} +} + +const opDescribeDestinations = "DescribeDestinations" + +// DescribeDestinationsRequest is a API request type for the DescribeDestinations API operation. +type DescribeDestinationsRequest struct { + *aws.Request + Input *DescribeDestinationsInput + Copy func(*DescribeDestinationsInput) DescribeDestinationsRequest +} + +// Send marshals and sends the DescribeDestinations API request. +func (r DescribeDestinationsRequest) Send() (*DescribeDestinationsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeDestinationsOutput), nil +} + +// DescribeDestinationsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists all your destinations. The results are ASCII-sorted by destination +// name. +// +// // Example sending a request using the DescribeDestinationsRequest method. +// req := client.DescribeDestinationsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinations +func (c *CloudWatchLogs) DescribeDestinationsRequest(input *DescribeDestinationsInput) DescribeDestinationsRequest { + op := &aws.Operation{ + Name: opDescribeDestinations, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeDestinationsInput{} + } + + output := &DescribeDestinationsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeDestinationsRequest{Request: req, Input: input, Copy: c.DescribeDestinationsRequest} +} + +// Paginate pages iterates over the pages of a DescribeDestinationsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeDestinations operation. +// req := client.DescribeDestinationsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeDestinationsRequest) Paginate(opts ...aws.Option) DescribeDestinationsPager { + return DescribeDestinationsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeDestinationsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeDestinationsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeDestinationsPager struct { + aws.Pager +} + +func (p *DescribeDestinationsPager) CurrentPage() *DescribeDestinationsOutput { + return p.Pager.CurrentPage().(*DescribeDestinationsOutput) +} + +const opDescribeExportTasks = "DescribeExportTasks" + +// DescribeExportTasksRequest is a API request type for the DescribeExportTasks API operation. +type DescribeExportTasksRequest struct { + *aws.Request + Input *DescribeExportTasksInput + Copy func(*DescribeExportTasksInput) DescribeExportTasksRequest +} + +// Send marshals and sends the DescribeExportTasks API request. +func (r DescribeExportTasksRequest) Send() (*DescribeExportTasksOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeExportTasksOutput), nil +} + +// DescribeExportTasksRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the specified export tasks. You can list all your export tasks or filter +// the results based on task ID or task status. +// +// // Example sending a request using the DescribeExportTasksRequest method. +// req := client.DescribeExportTasksRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasks +func (c *CloudWatchLogs) DescribeExportTasksRequest(input *DescribeExportTasksInput) DescribeExportTasksRequest { + op := &aws.Operation{ + Name: opDescribeExportTasks, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeExportTasksInput{} + } + + output := &DescribeExportTasksOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeExportTasksRequest{Request: req, Input: input, Copy: c.DescribeExportTasksRequest} +} + +const opDescribeLogGroups = "DescribeLogGroups" + +// DescribeLogGroupsRequest is a API request type for the DescribeLogGroups API operation. +type DescribeLogGroupsRequest struct { + *aws.Request + Input *DescribeLogGroupsInput + Copy func(*DescribeLogGroupsInput) DescribeLogGroupsRequest +} + +// Send marshals and sends the DescribeLogGroups API request. +func (r DescribeLogGroupsRequest) Send() (*DescribeLogGroupsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeLogGroupsOutput), nil +} + +// DescribeLogGroupsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the specified log groups. You can list all your log groups or filter +// the results by prefix. The results are ASCII-sorted by log group name. +// +// // Example sending a request using the DescribeLogGroupsRequest method. +// req := client.DescribeLogGroupsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroups +func (c *CloudWatchLogs) DescribeLogGroupsRequest(input *DescribeLogGroupsInput) DescribeLogGroupsRequest { + op := &aws.Operation{ + Name: opDescribeLogGroups, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeLogGroupsInput{} + } + + output := &DescribeLogGroupsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeLogGroupsRequest{Request: req, Input: input, Copy: c.DescribeLogGroupsRequest} +} + +// Paginate pages iterates over the pages of a DescribeLogGroupsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLogGroups operation. +// req := client.DescribeLogGroupsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeLogGroupsRequest) Paginate(opts ...aws.Option) DescribeLogGroupsPager { + return DescribeLogGroupsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeLogGroupsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeLogGroupsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeLogGroupsPager struct { + aws.Pager +} + +func (p *DescribeLogGroupsPager) CurrentPage() *DescribeLogGroupsOutput { + return p.Pager.CurrentPage().(*DescribeLogGroupsOutput) +} + +const opDescribeLogStreams = "DescribeLogStreams" + +// DescribeLogStreamsRequest is a API request type for the DescribeLogStreams API operation. +type DescribeLogStreamsRequest struct { + *aws.Request + Input *DescribeLogStreamsInput + Copy func(*DescribeLogStreamsInput) DescribeLogStreamsRequest +} + +// Send marshals and sends the DescribeLogStreams API request. +func (r DescribeLogStreamsRequest) Send() (*DescribeLogStreamsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeLogStreamsOutput), nil +} + +// DescribeLogStreamsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the log streams for the specified log group. You can list all the log +// streams or filter the results by prefix. You can also control how the results +// are ordered. +// +// This operation has a limit of five transactions per second, after which transactions +// are throttled. +// +// // Example sending a request using the DescribeLogStreamsRequest method. +// req := client.DescribeLogStreamsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreams +func (c *CloudWatchLogs) DescribeLogStreamsRequest(input *DescribeLogStreamsInput) DescribeLogStreamsRequest { + op := &aws.Operation{ + Name: opDescribeLogStreams, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeLogStreamsInput{} + } + + output := &DescribeLogStreamsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeLogStreamsRequest{Request: req, Input: input, Copy: c.DescribeLogStreamsRequest} +} + +// Paginate pages iterates over the pages of a DescribeLogStreamsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeLogStreams operation. +// req := client.DescribeLogStreamsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeLogStreamsRequest) Paginate(opts ...aws.Option) DescribeLogStreamsPager { + return DescribeLogStreamsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeLogStreamsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeLogStreamsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeLogStreamsPager struct { + aws.Pager +} + +func (p *DescribeLogStreamsPager) CurrentPage() *DescribeLogStreamsOutput { + return p.Pager.CurrentPage().(*DescribeLogStreamsOutput) +} + +const opDescribeMetricFilters = "DescribeMetricFilters" + +// DescribeMetricFiltersRequest is a API request type for the DescribeMetricFilters API operation. +type DescribeMetricFiltersRequest struct { + *aws.Request + Input *DescribeMetricFiltersInput + Copy func(*DescribeMetricFiltersInput) DescribeMetricFiltersRequest +} + +// Send marshals and sends the DescribeMetricFilters API request. +func (r DescribeMetricFiltersRequest) Send() (*DescribeMetricFiltersOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeMetricFiltersOutput), nil +} + +// DescribeMetricFiltersRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the specified metric filters. You can list all the metric filters or +// filter the results by log name, prefix, metric name, or metric namespace. +// The results are ASCII-sorted by filter name. +// +// // Example sending a request using the DescribeMetricFiltersRequest method. +// req := client.DescribeMetricFiltersRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFilters +func (c *CloudWatchLogs) DescribeMetricFiltersRequest(input *DescribeMetricFiltersInput) DescribeMetricFiltersRequest { + op := &aws.Operation{ + Name: opDescribeMetricFilters, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeMetricFiltersInput{} + } + + output := &DescribeMetricFiltersOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeMetricFiltersRequest{Request: req, Input: input, Copy: c.DescribeMetricFiltersRequest} +} + +// Paginate pages iterates over the pages of a DescribeMetricFiltersRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeMetricFilters operation. +// req := client.DescribeMetricFiltersRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeMetricFiltersRequest) Paginate(opts ...aws.Option) DescribeMetricFiltersPager { + return DescribeMetricFiltersPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeMetricFiltersInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeMetricFiltersPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeMetricFiltersPager struct { + aws.Pager +} + +func (p *DescribeMetricFiltersPager) CurrentPage() *DescribeMetricFiltersOutput { + return p.Pager.CurrentPage().(*DescribeMetricFiltersOutput) +} + +const opDescribeResourcePolicies = "DescribeResourcePolicies" + +// DescribeResourcePoliciesRequest is a API request type for the DescribeResourcePolicies API operation. +type DescribeResourcePoliciesRequest struct { + *aws.Request + Input *DescribeResourcePoliciesInput + Copy func(*DescribeResourcePoliciesInput) DescribeResourcePoliciesRequest +} + +// Send marshals and sends the DescribeResourcePolicies API request. +func (r DescribeResourcePoliciesRequest) Send() (*DescribeResourcePoliciesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeResourcePoliciesOutput), nil +} + +// DescribeResourcePoliciesRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the resource policies in this account. +// +// // Example sending a request using the DescribeResourcePoliciesRequest method. +// req := client.DescribeResourcePoliciesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeResourcePolicies +func (c *CloudWatchLogs) DescribeResourcePoliciesRequest(input *DescribeResourcePoliciesInput) DescribeResourcePoliciesRequest { + op := &aws.Operation{ + Name: opDescribeResourcePolicies, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DescribeResourcePoliciesInput{} + } + + output := &DescribeResourcePoliciesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeResourcePoliciesRequest{Request: req, Input: input, Copy: c.DescribeResourcePoliciesRequest} +} + +const opDescribeSubscriptionFilters = "DescribeSubscriptionFilters" + +// DescribeSubscriptionFiltersRequest is a API request type for the DescribeSubscriptionFilters API operation. +type DescribeSubscriptionFiltersRequest struct { + *aws.Request + Input *DescribeSubscriptionFiltersInput + Copy func(*DescribeSubscriptionFiltersInput) DescribeSubscriptionFiltersRequest +} + +// Send marshals and sends the DescribeSubscriptionFilters API request. +func (r DescribeSubscriptionFiltersRequest) Send() (*DescribeSubscriptionFiltersOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DescribeSubscriptionFiltersOutput), nil +} + +// DescribeSubscriptionFiltersRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the subscription filters for the specified log group. You can list +// all the subscription filters or filter the results by prefix. The results +// are ASCII-sorted by filter name. +// +// // Example sending a request using the DescribeSubscriptionFiltersRequest method. +// req := client.DescribeSubscriptionFiltersRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFilters +func (c *CloudWatchLogs) DescribeSubscriptionFiltersRequest(input *DescribeSubscriptionFiltersInput) DescribeSubscriptionFiltersRequest { + op := &aws.Operation{ + Name: opDescribeSubscriptionFilters, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeSubscriptionFiltersInput{} + } + + output := &DescribeSubscriptionFiltersOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DescribeSubscriptionFiltersRequest{Request: req, Input: input, Copy: c.DescribeSubscriptionFiltersRequest} +} + +// Paginate pages iterates over the pages of a DescribeSubscriptionFiltersRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a DescribeSubscriptionFilters operation. +// req := client.DescribeSubscriptionFiltersRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *DescribeSubscriptionFiltersRequest) Paginate(opts ...aws.Option) DescribeSubscriptionFiltersPager { + return DescribeSubscriptionFiltersPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *DescribeSubscriptionFiltersInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// DescribeSubscriptionFiltersPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type DescribeSubscriptionFiltersPager struct { + aws.Pager +} + +func (p *DescribeSubscriptionFiltersPager) CurrentPage() *DescribeSubscriptionFiltersOutput { + return p.Pager.CurrentPage().(*DescribeSubscriptionFiltersOutput) +} + +const opDisassociateKmsKey = "DisassociateKmsKey" + +// DisassociateKmsKeyRequest is a API request type for the DisassociateKmsKey API operation. +type DisassociateKmsKeyRequest struct { + *aws.Request + Input *DisassociateKmsKeyInput + Copy func(*DisassociateKmsKeyInput) DisassociateKmsKeyRequest +} + +// Send marshals and sends the DisassociateKmsKey API request. +func (r DisassociateKmsKeyRequest) Send() (*DisassociateKmsKeyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DisassociateKmsKeyOutput), nil +} + +// DisassociateKmsKeyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Disassociates the associated AWS Key Management Service (AWS KMS) customer +// master key (CMK) from the specified log group. +// +// After the AWS KMS CMK is disassociated from the log group, AWS CloudWatch +// Logs stops encrypting newly ingested data for the log group. All previously +// ingested data remains encrypted, and AWS CloudWatch Logs requires permissions +// for the CMK whenever the encrypted data is requested. +// +// Note that it can take up to 5 minutes for this operation to take effect. +// +// // Example sending a request using the DisassociateKmsKeyRequest method. +// req := client.DisassociateKmsKeyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DisassociateKmsKey +func (c *CloudWatchLogs) DisassociateKmsKeyRequest(input *DisassociateKmsKeyInput) DisassociateKmsKeyRequest { + op := &aws.Operation{ + Name: opDisassociateKmsKey, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DisassociateKmsKeyInput{} + } + + output := &DisassociateKmsKeyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DisassociateKmsKeyRequest{Request: req, Input: input, Copy: c.DisassociateKmsKeyRequest} +} + +const opFilterLogEvents = "FilterLogEvents" + +// FilterLogEventsRequest is a API request type for the FilterLogEvents API operation. +type FilterLogEventsRequest struct { + *aws.Request + Input *FilterLogEventsInput + Copy func(*FilterLogEventsInput) FilterLogEventsRequest +} + +// Send marshals and sends the FilterLogEvents API request. +func (r FilterLogEventsRequest) Send() (*FilterLogEventsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*FilterLogEventsOutput), nil +} + +// FilterLogEventsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists log events from the specified log group. You can list all the log events +// or filter the results using a filter pattern, a time range, and the name +// of the log stream. +// +// By default, this operation returns as many log events as can fit in 1 MB +// (up to 10,000 log events), or all the events found within the time range +// that you specify. If the results include a token, then there are more log +// events available, and you can get additional results by specifying the token +// in a subsequent call. +// +// // Example sending a request using the FilterLogEventsRequest method. +// req := client.FilterLogEventsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEvents +func (c *CloudWatchLogs) FilterLogEventsRequest(input *FilterLogEventsInput) FilterLogEventsRequest { + op := &aws.Operation{ + Name: opFilterLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &FilterLogEventsInput{} + } + + output := &FilterLogEventsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return FilterLogEventsRequest{Request: req, Input: input, Copy: c.FilterLogEventsRequest} +} + +// Paginate pages iterates over the pages of a FilterLogEventsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a FilterLogEvents operation. +// req := client.FilterLogEventsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *FilterLogEventsRequest) Paginate(opts ...aws.Option) FilterLogEventsPager { + return FilterLogEventsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *FilterLogEventsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// FilterLogEventsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type FilterLogEventsPager struct { + aws.Pager +} + +func (p *FilterLogEventsPager) CurrentPage() *FilterLogEventsOutput { + return p.Pager.CurrentPage().(*FilterLogEventsOutput) +} + +const opGetLogEvents = "GetLogEvents" + +// GetLogEventsRequest is a API request type for the GetLogEvents API operation. +type GetLogEventsRequest struct { + *aws.Request + Input *GetLogEventsInput + Copy func(*GetLogEventsInput) GetLogEventsRequest +} + +// Send marshals and sends the GetLogEvents API request. +func (r GetLogEventsRequest) Send() (*GetLogEventsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetLogEventsOutput), nil +} + +// GetLogEventsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists log events from the specified log stream. You can list all the log +// events or filter using a time range. +// +// By default, this operation returns as many log events as can fit in a response +// size of 1MB (up to 10,000 log events). You can get additional log events +// by specifying one of the tokens in a subsequent call. +// +// // Example sending a request using the GetLogEventsRequest method. +// req := client.GetLogEventsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEvents +func (c *CloudWatchLogs) GetLogEventsRequest(input *GetLogEventsInput) GetLogEventsRequest { + op := &aws.Operation{ + Name: opGetLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &aws.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextForwardToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &GetLogEventsInput{} + } + + output := &GetLogEventsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetLogEventsRequest{Request: req, Input: input, Copy: c.GetLogEventsRequest} +} + +// Paginate pages iterates over the pages of a GetLogEventsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetLogEvents operation. +// req := client.GetLogEventsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *GetLogEventsRequest) Paginate(opts ...aws.Option) GetLogEventsPager { + return GetLogEventsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *GetLogEventsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// GetLogEventsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type GetLogEventsPager struct { + aws.Pager +} + +func (p *GetLogEventsPager) CurrentPage() *GetLogEventsOutput { + return p.Pager.CurrentPage().(*GetLogEventsOutput) +} + +const opListTagsLogGroup = "ListTagsLogGroup" + +// ListTagsLogGroupRequest is a API request type for the ListTagsLogGroup API operation. +type ListTagsLogGroupRequest struct { + *aws.Request + Input *ListTagsLogGroupInput + Copy func(*ListTagsLogGroupInput) ListTagsLogGroupRequest +} + +// Send marshals and sends the ListTagsLogGroup API request. +func (r ListTagsLogGroupRequest) Send() (*ListTagsLogGroupOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListTagsLogGroupOutput), nil +} + +// ListTagsLogGroupRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Lists the tags for the specified log group. +// +// // Example sending a request using the ListTagsLogGroupRequest method. +// req := client.ListTagsLogGroupRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroup +func (c *CloudWatchLogs) ListTagsLogGroupRequest(input *ListTagsLogGroupInput) ListTagsLogGroupRequest { + op := &aws.Operation{ + Name: opListTagsLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ListTagsLogGroupInput{} + } + + output := &ListTagsLogGroupOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListTagsLogGroupRequest{Request: req, Input: input, Copy: c.ListTagsLogGroupRequest} +} + +const opPutDestination = "PutDestination" + +// PutDestinationRequest is a API request type for the PutDestination API operation. +type PutDestinationRequest struct { + *aws.Request + Input *PutDestinationInput + Copy func(*PutDestinationInput) PutDestinationRequest +} + +// Send marshals and sends the PutDestination API request. +func (r PutDestinationRequest) Send() (*PutDestinationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutDestinationOutput), nil +} + +// PutDestinationRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates or updates a destination. A destination encapsulates a physical resource +// (such as an Amazon Kinesis stream) and enables you to subscribe to a real-time +// stream of log events for a different account, ingested using PutLogEvents. +// Currently, the only supported physical resource is a Kinesis stream belonging +// to the same account as the destination. +// +// Through an access policy, a destination controls what is written to its Kinesis +// stream. By default, PutDestination does not set any access policy with the +// destination, which means a cross-account user cannot call PutSubscriptionFilter +// against this destination. To enable this, the destination owner must call +// PutDestinationPolicy after PutDestination. +// +// // Example sending a request using the PutDestinationRequest method. +// req := client.PutDestinationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestination +func (c *CloudWatchLogs) PutDestinationRequest(input *PutDestinationInput) PutDestinationRequest { + op := &aws.Operation{ + Name: opPutDestination, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDestinationInput{} + } + + output := &PutDestinationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutDestinationRequest{Request: req, Input: input, Copy: c.PutDestinationRequest} +} + +const opPutDestinationPolicy = "PutDestinationPolicy" + +// PutDestinationPolicyRequest is a API request type for the PutDestinationPolicy API operation. +type PutDestinationPolicyRequest struct { + *aws.Request + Input *PutDestinationPolicyInput + Copy func(*PutDestinationPolicyInput) PutDestinationPolicyRequest +} + +// Send marshals and sends the PutDestinationPolicy API request. +func (r PutDestinationPolicyRequest) Send() (*PutDestinationPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutDestinationPolicyOutput), nil +} + +// PutDestinationPolicyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates or updates an access policy associated with an existing destination. +// An access policy is an IAM policy document (http://docs.aws.amazon.com/IAM/latest/UserGuide/policies_overview.html) +// that is used to authorize claims to register a subscription filter against +// a given destination. +// +// // Example sending a request using the PutDestinationPolicyRequest method. +// req := client.PutDestinationPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicy +func (c *CloudWatchLogs) PutDestinationPolicyRequest(input *PutDestinationPolicyInput) PutDestinationPolicyRequest { + op := &aws.Operation{ + Name: opPutDestinationPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutDestinationPolicyInput{} + } + + output := &PutDestinationPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutDestinationPolicyRequest{Request: req, Input: input, Copy: c.PutDestinationPolicyRequest} +} + +const opPutLogEvents = "PutLogEvents" + +// PutLogEventsRequest is a API request type for the PutLogEvents API operation. +type PutLogEventsRequest struct { + *aws.Request + Input *PutLogEventsInput + Copy func(*PutLogEventsInput) PutLogEventsRequest +} + +// Send marshals and sends the PutLogEvents API request. +func (r PutLogEventsRequest) Send() (*PutLogEventsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutLogEventsOutput), nil +} + +// PutLogEventsRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Uploads a batch of log events to the specified log stream. +// +// You must include the sequence token obtained from the response of the previous +// call. An upload in a newly created log stream does not require a sequence +// token. You can also get the sequence token using DescribeLogStreams. If you +// call PutLogEvents twice within a narrow time period using the same value +// for sequenceToken, both calls may be successful, or one may be rejected. +// +// The batch of events must satisfy the following constraints: +// +// * The maximum batch size is 1,048,576 bytes, and this size is calculated +// as the sum of all event messages in UTF-8, plus 26 bytes for each log +// event. +// +// * None of the log events in the batch can be more than 2 hours in the +// future. +// +// * None of the log events in the batch can be older than 14 days or the +// retention period of the log group. +// +// * The log events in the batch must be in chronological ordered by their +// time stamp. The time stamp is the time the event occurred, expressed as +// the number of milliseconds after Jan 1, 1970 00:00:00 UTC. (In AWS Tools +// for PowerShell and the AWS SDK for .NET, the timestamp is specified in +// .NET format: yyyy-mm-ddThh:mm:ss. For example, 2017-09-15T13:45:30.) +// +// * The maximum number of log events in a batch is 10,000. +// +// * A batch of log events in a single request cannot span more than 24 hours. +// Otherwise, the operation fails. +// +// If a call to PutLogEvents returns "UnrecognizedClientException" the most +// likely cause is an invalid AWS access key ID or secret key. +// +// // Example sending a request using the PutLogEventsRequest method. +// req := client.PutLogEventsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEvents +func (c *CloudWatchLogs) PutLogEventsRequest(input *PutLogEventsInput) PutLogEventsRequest { + op := &aws.Operation{ + Name: opPutLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutLogEventsInput{} + } + + output := &PutLogEventsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutLogEventsRequest{Request: req, Input: input, Copy: c.PutLogEventsRequest} +} + +const opPutMetricFilter = "PutMetricFilter" + +// PutMetricFilterRequest is a API request type for the PutMetricFilter API operation. +type PutMetricFilterRequest struct { + *aws.Request + Input *PutMetricFilterInput + Copy func(*PutMetricFilterInput) PutMetricFilterRequest +} + +// Send marshals and sends the PutMetricFilter API request. +func (r PutMetricFilterRequest) Send() (*PutMetricFilterOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutMetricFilterOutput), nil +} + +// PutMetricFilterRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates or updates a metric filter and associates it with the specified log +// group. Metric filters allow you to configure rules to extract metric data +// from log events ingested through PutLogEvents. +// +// The maximum number of metric filters that can be associated with a log group +// is 100. +// +// // Example sending a request using the PutMetricFilterRequest method. +// req := client.PutMetricFilterRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilter +func (c *CloudWatchLogs) PutMetricFilterRequest(input *PutMetricFilterInput) PutMetricFilterRequest { + op := &aws.Operation{ + Name: opPutMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutMetricFilterInput{} + } + + output := &PutMetricFilterOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutMetricFilterRequest{Request: req, Input: input, Copy: c.PutMetricFilterRequest} +} + +const opPutResourcePolicy = "PutResourcePolicy" + +// PutResourcePolicyRequest is a API request type for the PutResourcePolicy API operation. +type PutResourcePolicyRequest struct { + *aws.Request + Input *PutResourcePolicyInput + Copy func(*PutResourcePolicyInput) PutResourcePolicyRequest +} + +// Send marshals and sends the PutResourcePolicy API request. +func (r PutResourcePolicyRequest) Send() (*PutResourcePolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutResourcePolicyOutput), nil +} + +// PutResourcePolicyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates or updates a resource policy allowing other AWS services to put log +// events to this account, such as Amazon Route 53. An account can have up to +// 10 resource policies per region. +// +// // Example sending a request using the PutResourcePolicyRequest method. +// req := client.PutResourcePolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutResourcePolicy +func (c *CloudWatchLogs) PutResourcePolicyRequest(input *PutResourcePolicyInput) PutResourcePolicyRequest { + op := &aws.Operation{ + Name: opPutResourcePolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutResourcePolicyInput{} + } + + output := &PutResourcePolicyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutResourcePolicyRequest{Request: req, Input: input, Copy: c.PutResourcePolicyRequest} +} + +const opPutRetentionPolicy = "PutRetentionPolicy" + +// PutRetentionPolicyRequest is a API request type for the PutRetentionPolicy API operation. +type PutRetentionPolicyRequest struct { + *aws.Request + Input *PutRetentionPolicyInput + Copy func(*PutRetentionPolicyInput) PutRetentionPolicyRequest +} + +// Send marshals and sends the PutRetentionPolicy API request. +func (r PutRetentionPolicyRequest) Send() (*PutRetentionPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutRetentionPolicyOutput), nil +} + +// PutRetentionPolicyRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Sets the retention of the specified log group. A retention policy allows +// you to configure the number of days for which to retain log events in the +// specified log group. +// +// // Example sending a request using the PutRetentionPolicyRequest method. +// req := client.PutRetentionPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicy +func (c *CloudWatchLogs) PutRetentionPolicyRequest(input *PutRetentionPolicyInput) PutRetentionPolicyRequest { + op := &aws.Operation{ + Name: opPutRetentionPolicy, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutRetentionPolicyInput{} + } + + output := &PutRetentionPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutRetentionPolicyRequest{Request: req, Input: input, Copy: c.PutRetentionPolicyRequest} +} + +const opPutSubscriptionFilter = "PutSubscriptionFilter" + +// PutSubscriptionFilterRequest is a API request type for the PutSubscriptionFilter API operation. +type PutSubscriptionFilterRequest struct { + *aws.Request + Input *PutSubscriptionFilterInput + Copy func(*PutSubscriptionFilterInput) PutSubscriptionFilterRequest +} + +// Send marshals and sends the PutSubscriptionFilter API request. +func (r PutSubscriptionFilterRequest) Send() (*PutSubscriptionFilterOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutSubscriptionFilterOutput), nil +} + +// PutSubscriptionFilterRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Creates or updates a subscription filter and associates it with the specified +// log group. Subscription filters allow you to subscribe to a real-time stream +// of log events ingested through PutLogEvents and have them delivered to a +// specific destination. Currently, the supported destinations are: +// +// * An Amazon Kinesis stream belonging to the same account as the subscription +// filter, for same-account delivery. +// +// * A logical destination that belongs to a different account, for cross-account +// delivery. +// +// * An Amazon Kinesis Firehose delivery stream that belongs to the same +// account as the subscription filter, for same-account delivery. +// +// * An AWS Lambda function that belongs to the same account as the subscription +// filter, for same-account delivery. +// +// There can only be one subscription filter associated with a log group. If +// you are updating an existing filter, you must specify the correct name in +// filterName. Otherwise, the call fails because you cannot associate a second +// filter with a log group. +// +// // Example sending a request using the PutSubscriptionFilterRequest method. +// req := client.PutSubscriptionFilterRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilter +func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilterInput) PutSubscriptionFilterRequest { + op := &aws.Operation{ + Name: opPutSubscriptionFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutSubscriptionFilterInput{} + } + + output := &PutSubscriptionFilterOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutSubscriptionFilterRequest{Request: req, Input: input, Copy: c.PutSubscriptionFilterRequest} +} + +const opTagLogGroup = "TagLogGroup" + +// TagLogGroupRequest is a API request type for the TagLogGroup API operation. +type TagLogGroupRequest struct { + *aws.Request + Input *TagLogGroupInput + Copy func(*TagLogGroupInput) TagLogGroupRequest +} + +// Send marshals and sends the TagLogGroup API request. +func (r TagLogGroupRequest) Send() (*TagLogGroupOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*TagLogGroupOutput), nil +} + +// TagLogGroupRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Adds or updates the specified tags for the specified log group. +// +// To list the tags for a log group, use ListTagsLogGroup. To remove tags, use +// UntagLogGroup. +// +// For more information about tags, see Tag Log Groups in Amazon CloudWatch +// Logs (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/log-group-tagging.html) +// in the Amazon CloudWatch Logs User Guide. +// +// // Example sending a request using the TagLogGroupRequest method. +// req := client.TagLogGroupRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroup +func (c *CloudWatchLogs) TagLogGroupRequest(input *TagLogGroupInput) TagLogGroupRequest { + op := &aws.Operation{ + Name: opTagLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagLogGroupInput{} + } + + output := &TagLogGroupOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return TagLogGroupRequest{Request: req, Input: input, Copy: c.TagLogGroupRequest} +} + +const opTestMetricFilter = "TestMetricFilter" + +// TestMetricFilterRequest is a API request type for the TestMetricFilter API operation. +type TestMetricFilterRequest struct { + *aws.Request + Input *TestMetricFilterInput + Copy func(*TestMetricFilterInput) TestMetricFilterRequest +} + +// Send marshals and sends the TestMetricFilter API request. +func (r TestMetricFilterRequest) Send() (*TestMetricFilterOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*TestMetricFilterOutput), nil +} + +// TestMetricFilterRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Tests the filter pattern of a metric filter against a sample of log event +// messages. You can use this operation to validate the correctness of a metric +// filter pattern. +// +// // Example sending a request using the TestMetricFilterRequest method. +// req := client.TestMetricFilterRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilter +func (c *CloudWatchLogs) TestMetricFilterRequest(input *TestMetricFilterInput) TestMetricFilterRequest { + op := &aws.Operation{ + Name: opTestMetricFilter, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TestMetricFilterInput{} + } + + output := &TestMetricFilterOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return TestMetricFilterRequest{Request: req, Input: input, Copy: c.TestMetricFilterRequest} +} + +const opUntagLogGroup = "UntagLogGroup" + +// UntagLogGroupRequest is a API request type for the UntagLogGroup API operation. +type UntagLogGroupRequest struct { + *aws.Request + Input *UntagLogGroupInput + Copy func(*UntagLogGroupInput) UntagLogGroupRequest +} + +// Send marshals and sends the UntagLogGroup API request. +func (r UntagLogGroupRequest) Send() (*UntagLogGroupOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UntagLogGroupOutput), nil +} + +// UntagLogGroupRequest returns a request value for making API operation for +// Amazon CloudWatch Logs. +// +// Removes the specified tags from the specified log group. +// +// To list the tags for a log group, use ListTagsLogGroup. To add tags, use +// UntagLogGroup. +// +// // Example sending a request using the UntagLogGroupRequest method. +// req := client.UntagLogGroupRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroup +func (c *CloudWatchLogs) UntagLogGroupRequest(input *UntagLogGroupInput) UntagLogGroupRequest { + op := &aws.Operation{ + Name: opUntagLogGroup, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagLogGroupInput{} + } + + output := &UntagLogGroupOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return UntagLogGroupRequest{Request: req, Input: input, Copy: c.UntagLogGroupRequest} +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/AssociateKmsKeyRequest +type AssociateKmsKeyInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. + // For more information, see Amazon Resource Names - AWS Key Management Service + // (AWS KMS) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms). + // + // KmsKeyId is a required field + KmsKeyId *string `locationName:"kmsKeyId" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s AssociateKmsKeyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssociateKmsKeyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssociateKmsKeyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AssociateKmsKeyInput"} + + if s.KmsKeyId == nil { + invalidParams.Add(aws.NewErrParamRequired("KmsKeyId")) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/AssociateKmsKeyOutput +type AssociateKmsKeyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s AssociateKmsKeyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssociateKmsKeyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AssociateKmsKeyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTaskRequest +type CancelExportTaskInput struct { + _ struct{} `type:"structure"` + + // The ID of the export task. + // + // TaskId is a required field + TaskId *string `locationName:"taskId" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CancelExportTaskInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelExportTaskInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CancelExportTaskInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CancelExportTaskInput"} + + if s.TaskId == nil { + invalidParams.Add(aws.NewErrParamRequired("TaskId")) + } + if s.TaskId != nil && len(*s.TaskId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TaskId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CancelExportTaskOutput +type CancelExportTaskOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s CancelExportTaskOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CancelExportTaskOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CancelExportTaskOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTaskRequest +type CreateExportTaskInput struct { + _ struct{} `type:"structure"` + + // The name of S3 bucket for the exported log data. The bucket must be in the + // same AWS region. + // + // Destination is a required field + Destination *string `locationName:"destination" min:"1" type:"string" required:"true"` + + // The prefix used as the start of the key for every object exported. If you + // don't specify a value, the default is exportedlogs. + DestinationPrefix *string `locationName:"destinationPrefix" type:"string"` + + // The start time of the range for the request, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. Events with a time stamp earlier than this + // time are not exported. + // + // From is a required field + From *int64 `locationName:"from" type:"long" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // Export only log streams that match the provided prefix. If you don't specify + // a value, no prefix filter is applied. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // The name of the export task. + TaskName *string `locationName:"taskName" min:"1" type:"string"` + + // The end time of the range for the request, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. Events with a time stamp later than this + // time are not exported. + // + // To is a required field + To *int64 `locationName:"to" type:"long" required:"true"` +} + +// String returns the string representation +func (s CreateExportTaskInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateExportTaskInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateExportTaskInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateExportTaskInput"} + + if s.Destination == nil { + invalidParams.Add(aws.NewErrParamRequired("Destination")) + } + if s.Destination != nil && len(*s.Destination) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Destination", 1)) + } + + if s.From == nil { + invalidParams.Add(aws.NewErrParamRequired("From")) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.TaskName != nil && len(*s.TaskName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TaskName", 1)) + } + + if s.To == nil { + invalidParams.Add(aws.NewErrParamRequired("To")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateExportTaskResponse +type CreateExportTaskOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The ID of the export task. + TaskId *string `locationName:"taskId" min:"1" type:"string"` +} + +// String returns the string representation +func (s CreateExportTaskOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateExportTaskOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateExportTaskOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroupRequest +type CreateLogGroupInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. + // For more information, see Amazon Resource Names - AWS Key Management Service + // (AWS KMS) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms). + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The key-value pairs to use for the tags. + Tags map[string]string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation +func (s CreateLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateLogGroupInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateLogGroupInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogGroupOutput +type CreateLogGroupOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s CreateLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateLogGroupOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateLogGroupOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStreamRequest +type CreateLogStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateLogStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateLogStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateLogStreamInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateLogStreamInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.LogStreamName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/CreateLogStreamOutput +type CreateLogStreamOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s CreateLogStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateLogStreamOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateLogStreamOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestinationRequest +type DeleteDestinationInput struct { + _ struct{} `type:"structure"` + + // The name of the destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteDestinationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteDestinationInput"} + + if s.DestinationName == nil { + invalidParams.Add(aws.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("DestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteDestinationOutput +type DeleteDestinationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteDestinationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteDestinationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroupRequest +type DeleteLogGroupInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteLogGroupInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteLogGroupInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogGroupOutput +type DeleteLogGroupOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteLogGroupOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteLogGroupOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStreamRequest +type DeleteLogStreamInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteLogStreamInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteLogStreamInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteLogStreamInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteLogStreamInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.LogStreamName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteLogStreamOutput +type DeleteLogStreamOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteLogStreamOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteLogStreamOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteLogStreamOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilterRequest +type DeleteMetricFilterInput struct { + _ struct{} `type:"structure"` + + // The name of the metric filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteMetricFilterInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteMetricFilterInput"} + + if s.FilterName == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterName", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteMetricFilterOutput +type DeleteMetricFilterOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMetricFilterOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteMetricFilterOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteResourcePolicyRequest +type DeleteResourcePolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the policy to be revoked. This parameter is required. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation +func (s DeleteResourcePolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteResourcePolicyInput) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteResourcePolicyOutput +type DeleteResourcePolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteResourcePolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteResourcePolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteResourcePolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicyRequest +type DeleteRetentionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRetentionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRetentionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRetentionPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteRetentionPolicyInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteRetentionPolicyOutput +type DeleteRetentionPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteRetentionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRetentionPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteRetentionPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilterRequest +type DeleteSubscriptionFilterInput struct { + _ struct{} `type:"structure"` + + // The name of the subscription filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteSubscriptionFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteSubscriptionFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteSubscriptionFilterInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteSubscriptionFilterInput"} + + if s.FilterName == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterName", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DeleteSubscriptionFilterOutput +type DeleteSubscriptionFilterOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteSubscriptionFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteSubscriptionFilterOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteSubscriptionFilterOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinationsRequest +type DescribeDestinationsInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. If you don't specify a value, no prefix filter is applied. + DestinationNamePrefix *string `min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeDestinationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDestinationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeDestinationsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeDestinationsInput"} + if s.DestinationNamePrefix != nil && len(*s.DestinationNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("DestinationNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeDestinationsResponse +type DescribeDestinationsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The destinations. + Destinations []Destination `locationName:"destinations" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeDestinationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeDestinationsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeDestinationsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasksRequest +type DescribeExportTasksInput struct { + _ struct{} `type:"structure"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The status code of the export task. Specifying a status code filters the + // results to zero or more export tasks. + StatusCode ExportTaskStatusCode `locationName:"statusCode" type:"string" enum:"true"` + + // The ID of the export task. Specifying a task ID filters the results to zero + // or one export tasks. + TaskId *string `locationName:"taskId" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeExportTasksInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeExportTasksInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeExportTasksInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeExportTasksInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + if s.TaskId != nil && len(*s.TaskId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TaskId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeExportTasksResponse +type DescribeExportTasksOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The export tasks. + ExportTasks []ExportTask `locationName:"exportTasks" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeExportTasksOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeExportTasksOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeExportTasksOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroupsRequest +type DescribeLogGroupsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The prefix to match. + LogGroupNamePrefix *string `locationName:"logGroupNamePrefix" min:"1" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeLogGroupsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLogGroupsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeLogGroupsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeLogGroupsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupNamePrefix != nil && len(*s.LogGroupNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupNamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogGroupsResponse +type DescribeLogGroupsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The log groups. + LogGroups []LogGroup `locationName:"logGroups" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeLogGroupsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLogGroupsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeLogGroupsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreamsRequest +type DescribeLogStreamsInput struct { + _ struct{} `type:"structure"` + + // If the value is true, results are returned in descending order. If the value + // is to false, results are returned in ascending order. The default value is + // false. + Descending *bool `locationName:"descending" type:"boolean"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The prefix to match. + // + // If orderBy is LastEventTime,you cannot specify this parameter. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // If the value is LogStreamName, the results are ordered by log stream name. + // If the value is LastEventTime, the results are ordered by the event time. + // The default value is LogStreamName. + // + // If you order the results by event time, you cannot specify the logStreamNamePrefix + // parameter. + // + // lastEventTimestamp represents the time of the most recent log event in the + // log stream in CloudWatch Logs. This number is expressed as the number of + // milliseconds after Jan 1, 1970 00:00:00 UTC. lastEventTimeStamp updates on + // an eventual consistency basis. It typically updates in less than an hour + // from ingestion, but may take longer in some rare situations. + OrderBy OrderBy `locationName:"orderBy" type:"string" enum:"true"` +} + +// String returns the string representation +func (s DescribeLogStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLogStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeLogStreamsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeLogStreamsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeLogStreamsResponse +type DescribeLogStreamsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The log streams. + LogStreams []LogStream `locationName:"logStreams" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeLogStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeLogStreamsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeLogStreamsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFiltersRequest +type DescribeMetricFiltersInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. + FilterNamePrefix *string `locationName:"filterNamePrefix" min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // Filters results to include only those with the specified metric name. If + // you include this parameter in your request, you must also include the metricNamespace + // parameter. + MetricName *string `locationName:"metricName" type:"string"` + + // Filters results to include only those in the specified namespace. If you + // include this parameter in your request, you must also include the metricName + // parameter. + MetricNamespace *string `locationName:"metricNamespace" type:"string"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeMetricFiltersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeMetricFiltersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeMetricFiltersInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeMetricFiltersInput"} + if s.FilterNamePrefix != nil && len(*s.FilterNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeMetricFiltersResponse +type DescribeMetricFiltersOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The metric filters. + MetricFilters []MetricFilter `locationName:"metricFilters" type:"list"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeMetricFiltersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeMetricFiltersOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeMetricFiltersOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeResourcePoliciesRequest +type DescribeResourcePoliciesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of resource policies to be displayed with one call of + // this API. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeResourcePoliciesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeResourcePoliciesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeResourcePoliciesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeResourcePoliciesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeResourcePoliciesResponse +type DescribeResourcePoliciesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The resource policies that exist in this account. + ResourcePolicies []ResourcePolicy `locationName:"resourcePolicies" type:"list"` +} + +// String returns the string representation +func (s DescribeResourcePoliciesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeResourcePoliciesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeResourcePoliciesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFiltersRequest +type DescribeSubscriptionFiltersInput struct { + _ struct{} `type:"structure"` + + // The prefix to match. If you don't specify a value, no prefix filter is applied. + FilterNamePrefix *string `locationName:"filterNamePrefix" min:"1" type:"string"` + + // The maximum number of items returned. If you don't specify a value, the default + // is up to 50 items. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s DescribeSubscriptionFiltersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSubscriptionFiltersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeSubscriptionFiltersInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DescribeSubscriptionFiltersInput"} + if s.FilterNamePrefix != nil && len(*s.FilterNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterNamePrefix", 1)) + } + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DescribeSubscriptionFiltersResponse +type DescribeSubscriptionFiltersOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The token for the next set of items to return. The token expires after 24 + // hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The subscription filters. + SubscriptionFilters []SubscriptionFilter `locationName:"subscriptionFilters" type:"list"` +} + +// String returns the string representation +func (s DescribeSubscriptionFiltersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeSubscriptionFiltersOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DescribeSubscriptionFiltersOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents a cross-account destination that receives subscription log events. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/Destination +type Destination struct { + _ struct{} `type:"structure"` + + // An IAM policy document that governs which AWS accounts can create subscription + // filters against this destination. + AccessPolicy *string `locationName:"accessPolicy" min:"1" type:"string"` + + // The ARN of this destination. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the destination, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The name of the destination. + DestinationName *string `locationName:"destinationName" min:"1" type:"string"` + + // A role for impersonation, used when delivering log events to the target. + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` + + // The Amazon Resource Name (ARN) of the physical target to where the log events + // are delivered (for example, a Kinesis stream). + TargetArn *string `locationName:"targetArn" min:"1" type:"string"` +} + +// String returns the string representation +func (s Destination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Destination) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DisassociateKmsKeyRequest +type DisassociateKmsKeyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DisassociateKmsKeyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisassociateKmsKeyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DisassociateKmsKeyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DisassociateKmsKeyInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/DisassociateKmsKeyOutput +type DisassociateKmsKeyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DisassociateKmsKeyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DisassociateKmsKeyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DisassociateKmsKeyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents an export task. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ExportTask +type ExportTask struct { + _ struct{} `type:"structure"` + + // The name of Amazon S3 bucket to which the log data was exported. + Destination *string `locationName:"destination" min:"1" type:"string"` + + // The prefix that was used as the start of Amazon S3 key for every object exported. + DestinationPrefix *string `locationName:"destinationPrefix" type:"string"` + + // Execution info about the export task. + ExecutionInfo *ExportTaskExecutionInfo `locationName:"executionInfo" type:"structure"` + + // The start time, expressed as the number of milliseconds after Jan 1, 1970 + // 00:00:00 UTC. Events with a time stamp before this time are not exported. + From *int64 `locationName:"from" type:"long"` + + // The name of the log group from which logs data was exported. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The status of the export task. + Status *ExportTaskStatus `locationName:"status" type:"structure"` + + // The ID of the export task. + TaskId *string `locationName:"taskId" min:"1" type:"string"` + + // The name of the export task. + TaskName *string `locationName:"taskName" min:"1" type:"string"` + + // The end time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 + // UTC. Events with a time stamp later than this time are not exported. + To *int64 `locationName:"to" type:"long"` +} + +// String returns the string representation +func (s ExportTask) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportTask) GoString() string { + return s.String() +} + +// Represents the status of an export task. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ExportTaskExecutionInfo +type ExportTaskExecutionInfo struct { + _ struct{} `type:"structure"` + + // The completion time of the export task, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CompletionTime *int64 `locationName:"completionTime" type:"long"` + + // The creation time of the export task, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` +} + +// String returns the string representation +func (s ExportTaskExecutionInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportTaskExecutionInfo) GoString() string { + return s.String() +} + +// Represents the status of an export task. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ExportTaskStatus +type ExportTaskStatus struct { + _ struct{} `type:"structure"` + + // The status code of the export task. + Code ExportTaskStatusCode `locationName:"code" type:"string" enum:"true"` + + // The status message related to the status code. + Message *string `locationName:"message" type:"string"` +} + +// String returns the string representation +func (s ExportTaskStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportTaskStatus) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEventsRequest +type FilterLogEventsInput struct { + _ struct{} `type:"structure"` + + // The end of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a time stamp later than this time are + // not returned. + EndTime *int64 `locationName:"endTime" type:"long"` + + // The filter pattern to use. For more information, see Filter and Pattern Syntax + // (http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + // + // If not provided, all the events are matched. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // If the value is true, the operation makes a best effort to provide responses + // that contain events from multiple log streams within the log group, interleaved + // in a single response. If the value is false, all the matched log events in + // the first log stream are searched first, then those in the next log stream, + // and so on. The default is false. + Interleaved *bool `locationName:"interleaved" type:"boolean"` + + // The maximum number of events to return. The default is 10,000 events. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group to search. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // Filters the results to include only events from log streams that have names + // starting with this prefix. + // + // If you specify a value for both logStreamNamePrefix and logStreamNames, but + // the value for logStreamNamePrefix does not match any log stream names specified + // in logStreamNames, the action returns an InvalidParameterException error. + LogStreamNamePrefix *string `locationName:"logStreamNamePrefix" min:"1" type:"string"` + + // Filters the results to only logs from the log streams in this list. + // + // If you specify a value for both logStreamNamePrefix and logStreamNames, but + // the value for logStreamNamePrefix does not match any log stream names specified + // in logStreamNames, the action returns an InvalidParameterException error. + LogStreamNames []string `locationName:"logStreamNames" min:"1" type:"list"` + + // The token for the next set of events to return. (You received this token + // from a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // The start of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a time stamp before this time are not + // returned. + StartTime *int64 `locationName:"startTime" type:"long"` +} + +// String returns the string representation +func (s FilterLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FilterLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *FilterLogEventsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "FilterLogEventsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.LogStreamNamePrefix != nil && len(*s.LogStreamNamePrefix) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamNamePrefix", 1)) + } + if s.LogStreamNames != nil && len(s.LogStreamNames) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamNames", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilterLogEventsResponse +type FilterLogEventsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The matched events. + Events []FilteredLogEvent `locationName:"events" type:"list"` + + // The token to use when requesting the next set of items. The token expires + // after 24 hours. + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // Indicates which log streams have been searched and whether each has been + // searched completely. + SearchedLogStreams []SearchedLogStream `locationName:"searchedLogStreams" type:"list"` +} + +// String returns the string representation +func (s FilterLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FilterLogEventsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s FilterLogEventsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents a matched event. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/FilteredLogEvent +type FilteredLogEvent struct { + _ struct{} `type:"structure"` + + // The ID of the event. + EventId *string `locationName:"eventId" type:"string"` + + // The time the event was ingested, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + IngestionTime *int64 `locationName:"ingestionTime" type:"long"` + + // The name of the log stream this event belongs to. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // The data contained in the log event. + Message *string `locationName:"message" min:"1" type:"string"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation +func (s FilteredLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FilteredLogEvent) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEventsRequest +type GetLogEventsInput struct { + _ struct{} `type:"structure"` + + // The end of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a time stamp equal to or later than + // this time are not included. + EndTime *int64 `locationName:"endTime" type:"long"` + + // The maximum number of log events returned. If you don't specify a value, + // the maximum is as many log events as can fit in a response size of 1 MB, + // up to 10,000 log events. + Limit *int64 `locationName:"limit" min:"1" type:"integer"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` + + // The token for the next set of items to return. (You received this token from + // a previous call.) + NextToken *string `locationName:"nextToken" min:"1" type:"string"` + + // If the value is true, the earliest log events are returned first. If the + // value is false, the latest log events are returned first. The default value + // is false. + StartFromHead *bool `locationName:"startFromHead" type:"boolean"` + + // The start of the time range, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. Events with a time stamp equal to this time or + // later than this time are included. Events with a time stamp earlier than + // this time are not included. + StartTime *int64 `locationName:"startTime" type:"long"` +} + +// String returns the string representation +func (s GetLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetLogEventsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetLogEventsInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Limit", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.LogStreamName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamName", 1)) + } + if s.NextToken != nil && len(*s.NextToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("NextToken", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/GetLogEventsResponse +type GetLogEventsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The events. + Events []OutputLogEvent `locationName:"events" type:"list"` + + // The token for the next set of items in the backward direction. The token + // expires after 24 hours. This token will never be null. If you have reached + // the end of the stream, it will return the same token you passed in. + NextBackwardToken *string `locationName:"nextBackwardToken" min:"1" type:"string"` + + // The token for the next set of items in the forward direction. The token expires + // after 24 hours. If you have reached the end of the stream, it will return + // the same token you passed in. + NextForwardToken *string `locationName:"nextForwardToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s GetLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetLogEventsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetLogEventsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents a log event, which is a record of activity that was recorded by +// the application or resource being monitored. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/InputLogEvent +type InputLogEvent struct { + _ struct{} `type:"structure"` + + // The raw event message. + // + // Message is a required field + Message *string `locationName:"message" min:"1" type:"string" required:"true"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + // + // Timestamp is a required field + Timestamp *int64 `locationName:"timestamp" type:"long" required:"true"` +} + +// String returns the string representation +func (s InputLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InputLogEvent) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InputLogEvent) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InputLogEvent"} + + if s.Message == nil { + invalidParams.Add(aws.NewErrParamRequired("Message")) + } + if s.Message != nil && len(*s.Message) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Message", 1)) + } + + if s.Timestamp == nil { + invalidParams.Add(aws.NewErrParamRequired("Timestamp")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroupRequest +type ListTagsLogGroupInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListTagsLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsLogGroupInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListTagsLogGroupInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListTagsLogGroupResponse +type ListTagsLogGroupOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The tags for the log group. + Tags map[string]string `locationName:"tags" min:"1" type:"map"` +} + +// String returns the string representation +func (s ListTagsLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsLogGroupOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListTagsLogGroupOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents a log group. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/LogGroup +type LogGroup struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the log group. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the log group, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The Amazon Resource Name (ARN) of the CMK to use when encrypting log data. + KmsKeyId *string `locationName:"kmsKeyId" type:"string"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The number of metric filters. + MetricFilterCount *int64 `locationName:"metricFilterCount" type:"integer"` + + // The number of days to retain the log events in the specified log group. Possible + // values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, + // 1827, and 3653. + RetentionInDays *int64 `locationName:"retentionInDays" type:"integer"` + + // The number of bytes stored. + StoredBytes *int64 `locationName:"storedBytes" type:"long"` +} + +// String returns the string representation +func (s LogGroup) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LogGroup) GoString() string { + return s.String() +} + +// Represents a log stream, which is a sequence of log events from a single +// emitter of logs. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/LogStream +type LogStream struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the log stream. + Arn *string `locationName:"arn" type:"string"` + + // The creation time of the stream, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The time of the first event, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + FirstEventTimestamp *int64 `locationName:"firstEventTimestamp" type:"long"` + + // the time of the most recent log event in the log stream in CloudWatch Logs. + // This number is expressed as the number of milliseconds after Jan 1, 1970 + // 00:00:00 UTC. lastEventTime updates on an eventual consistency basis. It + // typically updates in less than an hour from ingestion, but may take longer + // in some rare situations. + LastEventTimestamp *int64 `locationName:"lastEventTimestamp" type:"long"` + + // The ingestion time, expressed as the number of milliseconds after Jan 1, + // 1970 00:00:00 UTC. + LastIngestionTime *int64 `locationName:"lastIngestionTime" type:"long"` + + // The name of the log stream. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // The number of bytes stored. + StoredBytes *int64 `locationName:"storedBytes" type:"long"` + + // The sequence token. + UploadSequenceToken *string `locationName:"uploadSequenceToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s LogStream) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LogStream) GoString() string { + return s.String() +} + +// Metric filters express how CloudWatch Logs would extract metric observations +// from ingested log events and transform them into metric data in a CloudWatch +// metric. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/MetricFilter +type MetricFilter struct { + _ struct{} `type:"structure"` + + // The creation time of the metric filter, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The name of the metric filter. + FilterName *string `locationName:"filterName" min:"1" type:"string"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain time stamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + // The metric transformations. + MetricTransformations []MetricTransformation `locationName:"metricTransformations" min:"1" type:"list"` +} + +// String returns the string representation +func (s MetricFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricFilter) GoString() string { + return s.String() +} + +// Represents a matched event. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/MetricFilterMatchRecord +type MetricFilterMatchRecord struct { + _ struct{} `type:"structure"` + + // The raw event data. + EventMessage *string `locationName:"eventMessage" min:"1" type:"string"` + + // The event number. + EventNumber *int64 `locationName:"eventNumber" type:"long"` + + // The values extracted from the event data by the filter. + ExtractedValues map[string]string `locationName:"extractedValues" type:"map"` +} + +// String returns the string representation +func (s MetricFilterMatchRecord) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricFilterMatchRecord) GoString() string { + return s.String() +} + +// Indicates how to transform ingested log events in to metric data in a CloudWatch +// metric. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/MetricTransformation +type MetricTransformation struct { + _ struct{} `type:"structure"` + + // (Optional) The value to emit when a filter pattern does not match a log event. + // This value can be null. + DefaultValue *float64 `locationName:"defaultValue" type:"double"` + + // The name of the CloudWatch metric. + // + // MetricName is a required field + MetricName *string `locationName:"metricName" type:"string" required:"true"` + + // The namespace of the CloudWatch metric. + // + // MetricNamespace is a required field + MetricNamespace *string `locationName:"metricNamespace" type:"string" required:"true"` + + // The value to publish to the CloudWatch metric when a filter pattern matches + // a log event. + // + // MetricValue is a required field + MetricValue *string `locationName:"metricValue" type:"string" required:"true"` +} + +// String returns the string representation +func (s MetricTransformation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricTransformation) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricTransformation) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "MetricTransformation"} + + if s.MetricName == nil { + invalidParams.Add(aws.NewErrParamRequired("MetricName")) + } + + if s.MetricNamespace == nil { + invalidParams.Add(aws.NewErrParamRequired("MetricNamespace")) + } + + if s.MetricValue == nil { + invalidParams.Add(aws.NewErrParamRequired("MetricValue")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Represents a log event. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/OutputLogEvent +type OutputLogEvent struct { + _ struct{} `type:"structure"` + + // The time the event was ingested, expressed as the number of milliseconds + // after Jan 1, 1970 00:00:00 UTC. + IngestionTime *int64 `locationName:"ingestionTime" type:"long"` + + // The data contained in the log event. + Message *string `locationName:"message" min:"1" type:"string"` + + // The time the event occurred, expressed as the number of milliseconds after + // Jan 1, 1970 00:00:00 UTC. + Timestamp *int64 `locationName:"timestamp" type:"long"` +} + +// String returns the string representation +func (s OutputLogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OutputLogEvent) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationRequest +type PutDestinationInput struct { + _ struct{} `type:"structure"` + + // A name for the destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` + + // The ARN of an IAM role that grants CloudWatch Logs permissions to call the + // Amazon Kinesis PutRecord operation on the destination stream. + // + // RoleArn is a required field + RoleArn *string `locationName:"roleArn" min:"1" type:"string" required:"true"` + + // The ARN of an Amazon Kinesis stream to which to deliver matching log events. + // + // TargetArn is a required field + TargetArn *string `locationName:"targetArn" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutDestinationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutDestinationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDestinationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutDestinationInput"} + + if s.DestinationName == nil { + invalidParams.Add(aws.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("DestinationName", 1)) + } + + if s.RoleArn == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("RoleArn", 1)) + } + + if s.TargetArn == nil { + invalidParams.Add(aws.NewErrParamRequired("TargetArn")) + } + if s.TargetArn != nil && len(*s.TargetArn) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("TargetArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationResponse +type PutDestinationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The destination. + Destination *Destination `locationName:"destination" type:"structure"` +} + +// String returns the string representation +func (s PutDestinationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutDestinationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutDestinationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicyRequest +type PutDestinationPolicyInput struct { + _ struct{} `type:"structure"` + + // An IAM policy document that authorizes cross-account users to deliver their + // log events to the associated destination. + // + // AccessPolicy is a required field + AccessPolicy *string `locationName:"accessPolicy" min:"1" type:"string" required:"true"` + + // A name for an existing destination. + // + // DestinationName is a required field + DestinationName *string `locationName:"destinationName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutDestinationPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutDestinationPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutDestinationPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutDestinationPolicyInput"} + + if s.AccessPolicy == nil { + invalidParams.Add(aws.NewErrParamRequired("AccessPolicy")) + } + if s.AccessPolicy != nil && len(*s.AccessPolicy) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("AccessPolicy", 1)) + } + + if s.DestinationName == nil { + invalidParams.Add(aws.NewErrParamRequired("DestinationName")) + } + if s.DestinationName != nil && len(*s.DestinationName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("DestinationName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutDestinationPolicyOutput +type PutDestinationPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutDestinationPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutDestinationPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutDestinationPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEventsRequest +type PutLogEventsInput struct { + _ struct{} `type:"structure"` + + // The log events. + // + // LogEvents is a required field + LogEvents []InputLogEvent `locationName:"logEvents" min:"1" type:"list" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The name of the log stream. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string" required:"true"` + + // The sequence token obtained from the response of the previous PutLogEvents + // call. An upload in a newly created log stream does not require a sequence + // token. You can also get the sequence token using DescribeLogStreams. If you + // call PutLogEvents twice within a narrow time period using the same value + // for sequenceToken, both calls may be successful, or one may be rejected. + SequenceToken *string `locationName:"sequenceToken" min:"1" type:"string"` +} + +// String returns the string representation +func (s PutLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutLogEventsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutLogEventsInput"} + + if s.LogEvents == nil { + invalidParams.Add(aws.NewErrParamRequired("LogEvents")) + } + if s.LogEvents != nil && len(s.LogEvents) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogEvents", 1)) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.LogStreamName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogStreamName")) + } + if s.LogStreamName != nil && len(*s.LogStreamName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogStreamName", 1)) + } + if s.SequenceToken != nil && len(*s.SequenceToken) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("SequenceToken", 1)) + } + if s.LogEvents != nil { + for i, v := range s.LogEvents { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LogEvents", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutLogEventsResponse +type PutLogEventsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The next sequence token. + NextSequenceToken *string `locationName:"nextSequenceToken" min:"1" type:"string"` + + // The rejected events. + RejectedLogEventsInfo *RejectedLogEventsInfo `locationName:"rejectedLogEventsInfo" type:"structure"` +} + +// String returns the string representation +func (s PutLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutLogEventsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutLogEventsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilterRequest +type PutMetricFilterInput struct { + _ struct{} `type:"structure"` + + // A name for the metric filter. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // A filter pattern for extracting metric data out of ingested log events. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // A collection of information that defines how metric data gets emitted. + // + // MetricTransformations is a required field + MetricTransformations []MetricTransformation `locationName:"metricTransformations" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s PutMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutMetricFilterInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutMetricFilterInput"} + + if s.FilterName == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterName", 1)) + } + + if s.FilterPattern == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterPattern")) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.MetricTransformations == nil { + invalidParams.Add(aws.NewErrParamRequired("MetricTransformations")) + } + if s.MetricTransformations != nil && len(s.MetricTransformations) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("MetricTransformations", 1)) + } + if s.MetricTransformations != nil { + for i, v := range s.MetricTransformations { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "MetricTransformations", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutMetricFilterOutput +type PutMetricFilterOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutMetricFilterOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutMetricFilterOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutResourcePolicyRequest +type PutResourcePolicyInput struct { + _ struct{} `type:"structure"` + + // Details of the new policy, including the identity of the principal that is + // enabled to put logs to this account. This is formatted as a JSON string. + // + // The following example creates a resource policy enabling the Route 53 service + // to put DNS query logs in to the specified log group. Replace "logArn" with + // the ARN of your CloudWatch Logs resource, such as a log group or log stream. + // + // { "Version": "2012-10-17", "Statement": [ { "Sid": "Route53LogsToCloudWatchLogs", + // "Effect": "Allow", "Principal": { "Service": [ "route53.amazonaws.com" ] + // }, "Action":"logs:PutLogEvents", "Resource": "logArn" } ] } + PolicyDocument *string `locationName:"policyDocument" min:"1" type:"string"` + + // Name of the new policy. This parameter is required. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation +func (s PutResourcePolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutResourcePolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutResourcePolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutResourcePolicyInput"} + if s.PolicyDocument != nil && len(*s.PolicyDocument) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("PolicyDocument", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutResourcePolicyResponse +type PutResourcePolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The new policy. + ResourcePolicy *ResourcePolicy `locationName:"resourcePolicy" type:"structure"` +} + +// String returns the string representation +func (s PutResourcePolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutResourcePolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutResourcePolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicyRequest +type PutRetentionPolicyInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The number of days to retain the log events in the specified log group. Possible + // values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, + // 1827, and 3653. + // + // RetentionInDays is a required field + RetentionInDays *int64 `locationName:"retentionInDays" type:"integer" required:"true"` +} + +// String returns the string representation +func (s PutRetentionPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutRetentionPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutRetentionPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutRetentionPolicyInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.RetentionInDays == nil { + invalidParams.Add(aws.NewErrParamRequired("RetentionInDays")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutRetentionPolicyOutput +type PutRetentionPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutRetentionPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutRetentionPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutRetentionPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilterRequest +type PutSubscriptionFilterInput struct { + _ struct{} `type:"structure"` + + // The ARN of the destination to deliver matching log events to. Currently, + // the supported destinations are: + // + // * An Amazon Kinesis stream belonging to the same account as the subscription + // filter, for same-account delivery. + // + // * A logical destination (specified using an ARN) belonging to a different + // account, for cross-account delivery. + // + // * An Amazon Kinesis Firehose delivery stream belonging to the same account + // as the subscription filter, for same-account delivery. + // + // * An AWS Lambda function belonging to the same account as the subscription + // filter, for same-account delivery. + // + // DestinationArn is a required field + DestinationArn *string `locationName:"destinationArn" min:"1" type:"string" required:"true"` + + // The method used to distribute log data to the destination. By default log + // data is grouped by log stream, but the grouping can be set to random for + // a more even distribution. This property is only applicable when the destination + // is an Amazon Kinesis stream. + Distribution Distribution `locationName:"distribution" type:"string" enum:"true"` + + // A name for the subscription filter. If you are updating an existing filter, + // you must specify the correct name in filterName. Otherwise, the call fails + // because you cannot associate a second filter with a log group. To find the + // name of the filter currently associated with a log group, use DescribeSubscriptionFilters. + // + // FilterName is a required field + FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` + + // A filter pattern for subscribing to a filtered stream of log events. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The ARN of an IAM role that grants CloudWatch Logs permissions to deliver + // ingested log events to the destination stream. You don't need to provide + // the ARN when you are working with a logical destination for cross-account + // delivery. + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` +} + +// String returns the string representation +func (s PutSubscriptionFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutSubscriptionFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutSubscriptionFilterInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutSubscriptionFilterInput"} + + if s.DestinationArn == nil { + invalidParams.Add(aws.NewErrParamRequired("DestinationArn")) + } + if s.DestinationArn != nil && len(*s.DestinationArn) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("DestinationArn", 1)) + } + + if s.FilterName == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterName")) + } + if s.FilterName != nil && len(*s.FilterName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FilterName", 1)) + } + + if s.FilterPattern == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterPattern")) + } + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + if s.RoleArn != nil && len(*s.RoleArn) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("RoleArn", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/PutSubscriptionFilterOutput +type PutSubscriptionFilterOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutSubscriptionFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutSubscriptionFilterOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutSubscriptionFilterOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Represents the rejected events. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/RejectedLogEventsInfo +type RejectedLogEventsInfo struct { + _ struct{} `type:"structure"` + + // The expired log events. + ExpiredLogEventEndIndex *int64 `locationName:"expiredLogEventEndIndex" type:"integer"` + + // The log events that are too new. + TooNewLogEventStartIndex *int64 `locationName:"tooNewLogEventStartIndex" type:"integer"` + + // The log events that are too old. + TooOldLogEventEndIndex *int64 `locationName:"tooOldLogEventEndIndex" type:"integer"` +} + +// String returns the string representation +func (s RejectedLogEventsInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RejectedLogEventsInfo) GoString() string { + return s.String() +} + +// A policy enabling one or more entities to put logs to a log group in this +// account. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ResourcePolicy +type ResourcePolicy struct { + _ struct{} `type:"structure"` + + // Time stamp showing when this policy was last updated, expressed as the number + // of milliseconds after Jan 1, 1970 00:00:00 UTC. + LastUpdatedTime *int64 `locationName:"lastUpdatedTime" type:"long"` + + // The details of the policy. + PolicyDocument *string `locationName:"policyDocument" min:"1" type:"string"` + + // The name of the resource policy. + PolicyName *string `locationName:"policyName" type:"string"` +} + +// String returns the string representation +func (s ResourcePolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourcePolicy) GoString() string { + return s.String() +} + +// Represents the search status of a log stream. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/SearchedLogStream +type SearchedLogStream struct { + _ struct{} `type:"structure"` + + // The name of the log stream. + LogStreamName *string `locationName:"logStreamName" min:"1" type:"string"` + + // Indicates whether all the events in this log stream were searched. + SearchedCompletely *bool `locationName:"searchedCompletely" type:"boolean"` +} + +// String returns the string representation +func (s SearchedLogStream) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SearchedLogStream) GoString() string { + return s.String() +} + +// Represents a subscription filter. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/SubscriptionFilter +type SubscriptionFilter struct { + _ struct{} `type:"structure"` + + // The creation time of the subscription filter, expressed as the number of + // milliseconds after Jan 1, 1970 00:00:00 UTC. + CreationTime *int64 `locationName:"creationTime" type:"long"` + + // The Amazon Resource Name (ARN) of the destination. + DestinationArn *string `locationName:"destinationArn" min:"1" type:"string"` + + // The method used to distribute log data to the destination, which can be either + // random or grouped by log stream. + Distribution Distribution `locationName:"distribution" type:"string" enum:"true"` + + // The name of the subscription filter. + FilterName *string `locationName:"filterName" min:"1" type:"string"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain time stamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + FilterPattern *string `locationName:"filterPattern" type:"string"` + + // The name of the log group. + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string"` + + RoleArn *string `locationName:"roleArn" min:"1" type:"string"` +} + +// String returns the string representation +func (s SubscriptionFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SubscriptionFilter) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroupRequest +type TagLogGroupInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The key-value pairs to use for the tags. + // + // Tags is a required field + Tags map[string]string `locationName:"tags" min:"1" type:"map" required:"true"` +} + +// String returns the string representation +func (s TagLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagLogGroupInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "TagLogGroupInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.Tags == nil { + invalidParams.Add(aws.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TagLogGroupOutput +type TagLogGroupOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s TagLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagLogGroupOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s TagLogGroupOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilterRequest +type TestMetricFilterInput struct { + _ struct{} `type:"structure"` + + // A symbolic description of how CloudWatch Logs should interpret the data in + // each log event. For example, a log event may contain time stamps, IP addresses, + // strings, and so on. You use the filter pattern to specify what to look for + // in the log event message. + // + // FilterPattern is a required field + FilterPattern *string `locationName:"filterPattern" type:"string" required:"true"` + + // The log event messages to test. + // + // LogEventMessages is a required field + LogEventMessages []string `locationName:"logEventMessages" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s TestMetricFilterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TestMetricFilterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TestMetricFilterInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "TestMetricFilterInput"} + + if s.FilterPattern == nil { + invalidParams.Add(aws.NewErrParamRequired("FilterPattern")) + } + + if s.LogEventMessages == nil { + invalidParams.Add(aws.NewErrParamRequired("LogEventMessages")) + } + if s.LogEventMessages != nil && len(s.LogEventMessages) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogEventMessages", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/TestMetricFilterResponse +type TestMetricFilterOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The matched events. + Matches []MetricFilterMatchRecord `locationName:"matches" type:"list"` +} + +// String returns the string representation +func (s TestMetricFilterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TestMetricFilterOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s TestMetricFilterOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroupRequest +type UntagLogGroupInput struct { + _ struct{} `type:"structure"` + + // The name of the log group. + // + // LogGroupName is a required field + LogGroupName *string `locationName:"logGroupName" min:"1" type:"string" required:"true"` + + // The tag keys. The corresponding tags are removed from the log group. + // + // Tags is a required field + Tags []string `locationName:"tags" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagLogGroupInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagLogGroupInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagLogGroupInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UntagLogGroupInput"} + + if s.LogGroupName == nil { + invalidParams.Add(aws.NewErrParamRequired("LogGroupName")) + } + if s.LogGroupName != nil && len(*s.LogGroupName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("LogGroupName", 1)) + } + + if s.Tags == nil { + invalidParams.Add(aws.NewErrParamRequired("Tags")) + } + if s.Tags != nil && len(s.Tags) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Tags", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/UntagLogGroupOutput +type UntagLogGroupOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s UntagLogGroupOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagLogGroupOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UntagLogGroupOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The method used to distribute log data to the destination, which can be either +// random or grouped by log stream. +type Distribution string + +// Enum values for Distribution +const ( + DistributionRandom Distribution = "Random" + DistributionByLogStream Distribution = "ByLogStream" +) + +func (enum Distribution) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Distribution) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ExportTaskStatusCode string + +// Enum values for ExportTaskStatusCode +const ( + ExportTaskStatusCodeCancelled ExportTaskStatusCode = "CANCELLED" + ExportTaskStatusCodeCompleted ExportTaskStatusCode = "COMPLETED" + ExportTaskStatusCodeFailed ExportTaskStatusCode = "FAILED" + ExportTaskStatusCodePending ExportTaskStatusCode = "PENDING" + ExportTaskStatusCodePendingCancel ExportTaskStatusCode = "PENDING_CANCEL" + ExportTaskStatusCodeRunning ExportTaskStatusCode = "RUNNING" +) + +func (enum ExportTaskStatusCode) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ExportTaskStatusCode) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type OrderBy string + +// Enum values for OrderBy +const ( + OrderByLogStreamName OrderBy = "LogStreamName" + OrderByLastEventTime OrderBy = "LastEventTime" +) + +func (enum OrderBy) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum OrderBy) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/doc.go new file mode 100644 index 000000000000..6e5145a1576d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/doc.go @@ -0,0 +1,57 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package cloudwatchlogs provides the client and types for making API +// requests to Amazon CloudWatch Logs. +// +// You can use Amazon CloudWatch Logs to monitor, store, and access your log +// files from Amazon EC2 instances, AWS CloudTrail, or other sources. You can +// then retrieve the associated log data from CloudWatch Logs using the CloudWatch +// console, CloudWatch Logs commands in the AWS CLI, CloudWatch Logs API, or +// CloudWatch Logs SDK. +// +// You can use CloudWatch Logs to: +// +// * Monitor logs from EC2 instances in real-time: You can use CloudWatch +// Logs to monitor applications and systems using log data. For example, +// CloudWatch Logs can track the number of errors that occur in your application +// logs and send you a notification whenever the rate of errors exceeds a +// threshold that you specify. CloudWatch Logs uses your log data for monitoring; +// so, no code changes are required. For example, you can monitor application +// logs for specific literal terms (such as "NullReferenceException") or +// count the number of occurrences of a literal term at a particular position +// in log data (such as "404" status codes in an Apache access log). When +// the term you are searching for is found, CloudWatch Logs reports the data +// to a CloudWatch metric that you specify. +// +// * Monitor AWS CloudTrail logged events: You can create alarms in CloudWatch +// and receive notifications of particular API activity as captured by CloudTrail +// and use the notification to perform troubleshooting. +// +// * Archive log data: You can use CloudWatch Logs to store your log data +// in highly durable storage. You can change the log retention setting so +// that any log events older than this setting are automatically deleted. +// The CloudWatch Logs agent makes it easy to quickly send both rotated and +// non-rotated log data off of a host and into the log service. You can then +// access the raw log data when you need it. +// +// See https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28 for more information on this service. +// +// See cloudwatchlogs package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchlogs/ +// +// Using the Client +// +// To Amazon CloudWatch Logs with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the Amazon CloudWatch Logs client CloudWatchLogs for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/cloudwatchlogs/#New +package cloudwatchlogs diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/errors.go new file mode 100644 index 000000000000..d8f3338b355e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/errors.go @@ -0,0 +1,66 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +const ( + + // ErrCodeDataAlreadyAcceptedException for service response error code + // "DataAlreadyAcceptedException". + // + // The event was already logged. + ErrCodeDataAlreadyAcceptedException = "DataAlreadyAcceptedException" + + // ErrCodeInvalidOperationException for service response error code + // "InvalidOperationException". + // + // The operation is not valid on the specified resource. + ErrCodeInvalidOperationException = "InvalidOperationException" + + // ErrCodeInvalidParameterException for service response error code + // "InvalidParameterException". + // + // A parameter is specified incorrectly. + ErrCodeInvalidParameterException = "InvalidParameterException" + + // ErrCodeInvalidSequenceTokenException for service response error code + // "InvalidSequenceTokenException". + // + // The sequence token is not valid. + ErrCodeInvalidSequenceTokenException = "InvalidSequenceTokenException" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // You have reached the maximum number of resources that can be created. + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeOperationAbortedException for service response error code + // "OperationAbortedException". + // + // Multiple requests to update the same resource were in conflict. + ErrCodeOperationAbortedException = "OperationAbortedException" + + // ErrCodeResourceAlreadyExistsException for service response error code + // "ResourceAlreadyExistsException". + // + // The specified resource already exists. + ErrCodeResourceAlreadyExistsException = "ResourceAlreadyExistsException" + + // ErrCodeResourceNotFoundException for service response error code + // "ResourceNotFoundException". + // + // The specified resource does not exist. + ErrCodeResourceNotFoundException = "ResourceNotFoundException" + + // ErrCodeServiceUnavailableException for service response error code + // "ServiceUnavailableException". + // + // The service cannot complete the request. + ErrCodeServiceUnavailableException = "ServiceUnavailableException" + + // ErrCodeUnrecognizedClientException for service response error code + // "UnrecognizedClientException". + // + // The most likely cause is an invalid AWS access key ID or secret key. + ErrCodeUnrecognizedClientException = "UnrecognizedClientException" +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/service.go b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/service.go new file mode 100644 index 000000000000..52eea9bc08af --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/service.go @@ -0,0 +1,82 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package cloudwatchlogs + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc" +) + +// CloudWatchLogs provides the API operation methods for making requests to +// Amazon CloudWatch Logs. See this package's package overview docs +// for details on the service. +// +// CloudWatchLogs methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type CloudWatchLogs struct { + *aws.Client +} + +// Used for custom client initialization logic +var initClient func(*CloudWatchLogs) + +// Used for custom request initialization logic +var initRequest func(*CloudWatchLogs, *aws.Request) + +// Service information constants +const ( + ServiceName = "logs" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the CloudWatchLogs client with a config. +// +// Example: +// // Create a CloudWatchLogs client from just a config. +// svc := cloudwatchlogs.New(myConfig) +func New(config aws.Config) *CloudWatchLogs { + var signingName string + signingRegion := config.Region + + svc := &CloudWatchLogs{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + APIVersion: "2014-03-28", + JSONVersion: "1.1", + TargetPrefix: "Logs_20140328", + }, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc) + } + + return svc +} + +// newRequest creates a new request for a CloudWatchLogs operation and runs any +// custom request initialization. +func (c *CloudWatchLogs) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(c, req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/api.go b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/api.go new file mode 100644 index 000000000000..70232a464166 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/api.go @@ -0,0 +1,6610 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package lambda + +import ( + "io" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/restjson" +) + +const opAddPermission = "AddPermission" + +// AddPermissionRequest is a API request type for the AddPermission API operation. +type AddPermissionRequest struct { + *aws.Request + Input *AddPermissionInput + Copy func(*AddPermissionInput) AddPermissionRequest +} + +// Send marshals and sends the AddPermission API request. +func (r AddPermissionRequest) Send() (*AddPermissionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AddPermissionOutput), nil +} + +// AddPermissionRequest returns a request value for making API operation for +// AWS Lambda. +// +// Adds a permission to the resource policy associated with the specified AWS +// Lambda function. You use resource policies to grant permissions to event +// sources that use push model. In a push model, event sources (such as Amazon +// S3 and custom applications) invoke your Lambda function. Each permission +// you add to the resource policy allows an event source, permission to invoke +// the Lambda function. +// +// For information about the push model, see Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html). +// +// If you are using versioning, the permissions you add are specific to the +// Lambda function version or alias you specify in the AddPermission request +// via the Qualifier parameter. For more information about versioning, see AWS +// Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:AddPermission action. +// +// // Example sending a request using the AddPermissionRequest method. +// req := client.AddPermissionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermission +func (c *Lambda) AddPermissionRequest(input *AddPermissionInput) AddPermissionRequest { + op := &aws.Operation{ + Name: opAddPermission, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/functions/{FunctionName}/policy", + } + + if input == nil { + input = &AddPermissionInput{} + } + + output := &AddPermissionOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return AddPermissionRequest{Request: req, Input: input, Copy: c.AddPermissionRequest} +} + +const opCreateAlias = "CreateAlias" + +// CreateAliasRequest is a API request type for the CreateAlias API operation. +type CreateAliasRequest struct { + *aws.Request + Input *CreateAliasInput + Copy func(*CreateAliasInput) CreateAliasRequest +} + +// Send marshals and sends the CreateAlias API request. +func (r CreateAliasRequest) Send() (*UpdateAliasOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateAliasOutput), nil +} + +// CreateAliasRequest returns a request value for making API operation for +// AWS Lambda. +// +// Creates an alias that points to the specified Lambda function version. For +// more information, see Introduction to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). +// +// Alias names are unique for a given function. This requires permission for +// the lambda:CreateAlias action. +// +// // Example sending a request using the CreateAliasRequest method. +// req := client.CreateAliasRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateAlias +func (c *Lambda) CreateAliasRequest(input *CreateAliasInput) CreateAliasRequest { + op := &aws.Operation{ + Name: opCreateAlias, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/functions/{FunctionName}/aliases", + } + + if input == nil { + input = &CreateAliasInput{} + } + + output := &UpdateAliasOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateAliasRequest{Request: req, Input: input, Copy: c.CreateAliasRequest} +} + +const opCreateEventSourceMapping = "CreateEventSourceMapping" + +// CreateEventSourceMappingRequest is a API request type for the CreateEventSourceMapping API operation. +type CreateEventSourceMappingRequest struct { + *aws.Request + Input *CreateEventSourceMappingInput + Copy func(*CreateEventSourceMappingInput) CreateEventSourceMappingRequest +} + +// Send marshals and sends the CreateEventSourceMapping API request. +func (r CreateEventSourceMappingRequest) Send() (*UpdateEventSourceMappingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateEventSourceMappingOutput), nil +} + +// CreateEventSourceMappingRequest returns a request value for making API operation for +// AWS Lambda. +// +// Identifies a poll-based event source for a Lambda function. It can be either +// an Amazon Kinesis or DynamoDB stream, or an Amazon SQS queue. AWS Lambda +// invokes the specified function when records are posted to the event source. +// +// This association between a poll-based source and a Lambda function is called +// the event source mapping. +// +// You provide mapping information (for example, which stream or SQS queue to +// read from and which Lambda function to invoke) in the request body. +// +// Amazon Kinesis or DynamoDB stream event sources can be associated with multiple +// AWS Lambda functions and a given Lambda function can be associated with multiple +// AWS event sources. For Amazon SQS, you can configure multiple queues as event +// sources for a single Lambda function, but an SQS queue can be mapped only +// to a single Lambda function. +// +// If you are using versioning, you can specify a specific function version +// or an alias via the function name parameter. For more information about versioning, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:CreateEventSourceMapping +// action. +// +// // Example sending a request using the CreateEventSourceMappingRequest method. +// req := client.CreateEventSourceMappingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateEventSourceMapping +func (c *Lambda) CreateEventSourceMappingRequest(input *CreateEventSourceMappingInput) CreateEventSourceMappingRequest { + op := &aws.Operation{ + Name: opCreateEventSourceMapping, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/event-source-mappings/", + } + + if input == nil { + input = &CreateEventSourceMappingInput{} + } + + output := &UpdateEventSourceMappingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateEventSourceMappingRequest{Request: req, Input: input, Copy: c.CreateEventSourceMappingRequest} +} + +const opCreateFunction = "CreateFunction" + +// CreateFunctionRequest is a API request type for the CreateFunction API operation. +type CreateFunctionRequest struct { + *aws.Request + Input *CreateFunctionInput + Copy func(*CreateFunctionInput) CreateFunctionRequest +} + +// Send marshals and sends the CreateFunction API request. +func (r CreateFunctionRequest) Send() (*UpdateFunctionConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateFunctionConfigurationOutput), nil +} + +// CreateFunctionRequest returns a request value for making API operation for +// AWS Lambda. +// +// Creates a new Lambda function. The function metadata is created from the +// request parameters, and the code for the function is provided by a .zip file +// in the request body. If the function name already exists, the operation will +// fail. Note that the function name is case-sensitive. +// +// If you are using versioning, you can also publish a version of the Lambda +// function you are creating using the Publish parameter. For more information +// about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:CreateFunction action. +// +// // Example sending a request using the CreateFunctionRequest method. +// req := client.CreateFunctionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateFunction +func (c *Lambda) CreateFunctionRequest(input *CreateFunctionInput) CreateFunctionRequest { + op := &aws.Operation{ + Name: opCreateFunction, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/functions", + } + + if input == nil { + input = &CreateFunctionInput{} + } + + output := &UpdateFunctionConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateFunctionRequest{Request: req, Input: input, Copy: c.CreateFunctionRequest} +} + +const opDeleteAlias = "DeleteAlias" + +// DeleteAliasRequest is a API request type for the DeleteAlias API operation. +type DeleteAliasRequest struct { + *aws.Request + Input *DeleteAliasInput + Copy func(*DeleteAliasInput) DeleteAliasRequest +} + +// Send marshals and sends the DeleteAlias API request. +func (r DeleteAliasRequest) Send() (*DeleteAliasOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteAliasOutput), nil +} + +// DeleteAliasRequest returns a request value for making API operation for +// AWS Lambda. +// +// Deletes the specified Lambda function alias. For more information, see Introduction +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). +// +// This requires permission for the lambda:DeleteAlias action. +// +// // Example sending a request using the DeleteAliasRequest method. +// req := client.DeleteAliasRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAlias +func (c *Lambda) DeleteAliasRequest(input *DeleteAliasInput) DeleteAliasRequest { + op := &aws.Operation{ + Name: opDeleteAlias, + HTTPMethod: "DELETE", + HTTPPath: "/2015-03-31/functions/{FunctionName}/aliases/{Name}", + } + + if input == nil { + input = &DeleteAliasInput{} + } + + output := &DeleteAliasOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteAliasRequest{Request: req, Input: input, Copy: c.DeleteAliasRequest} +} + +const opDeleteEventSourceMapping = "DeleteEventSourceMapping" + +// DeleteEventSourceMappingRequest is a API request type for the DeleteEventSourceMapping API operation. +type DeleteEventSourceMappingRequest struct { + *aws.Request + Input *DeleteEventSourceMappingInput + Copy func(*DeleteEventSourceMappingInput) DeleteEventSourceMappingRequest +} + +// Send marshals and sends the DeleteEventSourceMapping API request. +func (r DeleteEventSourceMappingRequest) Send() (*UpdateEventSourceMappingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateEventSourceMappingOutput), nil +} + +// DeleteEventSourceMappingRequest returns a request value for making API operation for +// AWS Lambda. +// +// Removes an event source mapping. This means AWS Lambda will no longer invoke +// the function for events in the associated source. +// +// This operation requires permission for the lambda:DeleteEventSourceMapping +// action. +// +// // Example sending a request using the DeleteEventSourceMappingRequest method. +// req := client.DeleteEventSourceMappingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteEventSourceMapping +func (c *Lambda) DeleteEventSourceMappingRequest(input *DeleteEventSourceMappingInput) DeleteEventSourceMappingRequest { + op := &aws.Operation{ + Name: opDeleteEventSourceMapping, + HTTPMethod: "DELETE", + HTTPPath: "/2015-03-31/event-source-mappings/{UUID}", + } + + if input == nil { + input = &DeleteEventSourceMappingInput{} + } + + output := &UpdateEventSourceMappingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteEventSourceMappingRequest{Request: req, Input: input, Copy: c.DeleteEventSourceMappingRequest} +} + +const opDeleteFunction = "DeleteFunction" + +// DeleteFunctionRequest is a API request type for the DeleteFunction API operation. +type DeleteFunctionRequest struct { + *aws.Request + Input *DeleteFunctionInput + Copy func(*DeleteFunctionInput) DeleteFunctionRequest +} + +// Send marshals and sends the DeleteFunction API request. +func (r DeleteFunctionRequest) Send() (*DeleteFunctionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteFunctionOutput), nil +} + +// DeleteFunctionRequest returns a request value for making API operation for +// AWS Lambda. +// +// Deletes the specified Lambda function code and configuration. +// +// If you are using the versioning feature and you don't specify a function +// version in your DeleteFunction request, AWS Lambda will delete the function, +// including all its versions, and any aliases pointing to the function versions. +// To delete a specific function version, you must provide the function version +// via the Qualifier parameter. For information about function versioning, see +// AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// When you delete a function the associated resource policy is also deleted. +// You will need to delete the event source mappings explicitly. +// +// This operation requires permission for the lambda:DeleteFunction action. +// +// // Example sending a request using the DeleteFunctionRequest method. +// req := client.DeleteFunctionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunction +func (c *Lambda) DeleteFunctionRequest(input *DeleteFunctionInput) DeleteFunctionRequest { + op := &aws.Operation{ + Name: opDeleteFunction, + HTTPMethod: "DELETE", + HTTPPath: "/2015-03-31/functions/{FunctionName}", + } + + if input == nil { + input = &DeleteFunctionInput{} + } + + output := &DeleteFunctionOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteFunctionRequest{Request: req, Input: input, Copy: c.DeleteFunctionRequest} +} + +const opDeleteFunctionConcurrency = "DeleteFunctionConcurrency" + +// DeleteFunctionConcurrencyRequest is a API request type for the DeleteFunctionConcurrency API operation. +type DeleteFunctionConcurrencyRequest struct { + *aws.Request + Input *DeleteFunctionConcurrencyInput + Copy func(*DeleteFunctionConcurrencyInput) DeleteFunctionConcurrencyRequest +} + +// Send marshals and sends the DeleteFunctionConcurrency API request. +func (r DeleteFunctionConcurrencyRequest) Send() (*DeleteFunctionConcurrencyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteFunctionConcurrencyOutput), nil +} + +// DeleteFunctionConcurrencyRequest returns a request value for making API operation for +// AWS Lambda. +// +// Removes concurrent execution limits from this function. For more information, +// see concurrent-executions. +// +// // Example sending a request using the DeleteFunctionConcurrencyRequest method. +// req := client.DeleteFunctionConcurrencyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrency +func (c *Lambda) DeleteFunctionConcurrencyRequest(input *DeleteFunctionConcurrencyInput) DeleteFunctionConcurrencyRequest { + op := &aws.Operation{ + Name: opDeleteFunctionConcurrency, + HTTPMethod: "DELETE", + HTTPPath: "/2017-10-31/functions/{FunctionName}/concurrency", + } + + if input == nil { + input = &DeleteFunctionConcurrencyInput{} + } + + output := &DeleteFunctionConcurrencyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteFunctionConcurrencyRequest{Request: req, Input: input, Copy: c.DeleteFunctionConcurrencyRequest} +} + +const opGetAccountSettings = "GetAccountSettings" + +// GetAccountSettingsRequest is a API request type for the GetAccountSettings API operation. +type GetAccountSettingsRequest struct { + *aws.Request + Input *GetAccountSettingsInput + Copy func(*GetAccountSettingsInput) GetAccountSettingsRequest +} + +// Send marshals and sends the GetAccountSettings API request. +func (r GetAccountSettingsRequest) Send() (*GetAccountSettingsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetAccountSettingsOutput), nil +} + +// GetAccountSettingsRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns a customer's account settings. +// +// You can use this operation to retrieve Lambda limits information, such as +// code size and concurrency limits. For more information about limits, see +// AWS Lambda Limits (http://docs.aws.amazon.com/lambda/latest/dg/limits.html). +// You can also retrieve resource usage statistics, such as code storage usage +// and function count. +// +// // Example sending a request using the GetAccountSettingsRequest method. +// req := client.GetAccountSettingsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettings +func (c *Lambda) GetAccountSettingsRequest(input *GetAccountSettingsInput) GetAccountSettingsRequest { + op := &aws.Operation{ + Name: opGetAccountSettings, + HTTPMethod: "GET", + HTTPPath: "/2016-08-19/account-settings/", + } + + if input == nil { + input = &GetAccountSettingsInput{} + } + + output := &GetAccountSettingsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetAccountSettingsRequest{Request: req, Input: input, Copy: c.GetAccountSettingsRequest} +} + +const opGetAlias = "GetAlias" + +// GetAliasRequest is a API request type for the GetAlias API operation. +type GetAliasRequest struct { + *aws.Request + Input *GetAliasInput + Copy func(*GetAliasInput) GetAliasRequest +} + +// Send marshals and sends the GetAlias API request. +func (r GetAliasRequest) Send() (*UpdateAliasOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateAliasOutput), nil +} + +// GetAliasRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns the specified alias information such as the alias ARN, description, +// and function version it is pointing to. For more information, see Introduction +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). +// +// This requires permission for the lambda:GetAlias action. +// +// // Example sending a request using the GetAliasRequest method. +// req := client.GetAliasRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAlias +func (c *Lambda) GetAliasRequest(input *GetAliasInput) GetAliasRequest { + op := &aws.Operation{ + Name: opGetAlias, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}/aliases/{Name}", + } + + if input == nil { + input = &GetAliasInput{} + } + + output := &UpdateAliasOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetAliasRequest{Request: req, Input: input, Copy: c.GetAliasRequest} +} + +const opGetEventSourceMapping = "GetEventSourceMapping" + +// GetEventSourceMappingRequest is a API request type for the GetEventSourceMapping API operation. +type GetEventSourceMappingRequest struct { + *aws.Request + Input *GetEventSourceMappingInput + Copy func(*GetEventSourceMappingInput) GetEventSourceMappingRequest +} + +// Send marshals and sends the GetEventSourceMapping API request. +func (r GetEventSourceMappingRequest) Send() (*UpdateEventSourceMappingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateEventSourceMappingOutput), nil +} + +// GetEventSourceMappingRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns configuration information for the specified event source mapping +// (see CreateEventSourceMapping). +// +// This operation requires permission for the lambda:GetEventSourceMapping action. +// +// // Example sending a request using the GetEventSourceMappingRequest method. +// req := client.GetEventSourceMappingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMapping +func (c *Lambda) GetEventSourceMappingRequest(input *GetEventSourceMappingInput) GetEventSourceMappingRequest { + op := &aws.Operation{ + Name: opGetEventSourceMapping, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/event-source-mappings/{UUID}", + } + + if input == nil { + input = &GetEventSourceMappingInput{} + } + + output := &UpdateEventSourceMappingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetEventSourceMappingRequest{Request: req, Input: input, Copy: c.GetEventSourceMappingRequest} +} + +const opGetFunction = "GetFunction" + +// GetFunctionRequest is a API request type for the GetFunction API operation. +type GetFunctionRequest struct { + *aws.Request + Input *GetFunctionInput + Copy func(*GetFunctionInput) GetFunctionRequest +} + +// Send marshals and sends the GetFunction API request. +func (r GetFunctionRequest) Send() (*GetFunctionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetFunctionOutput), nil +} + +// GetFunctionRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns the configuration information of the Lambda function and a presigned +// URL link to the .zip file you uploaded with CreateFunction so you can download +// the .zip file. Note that the URL is valid for up to 10 minutes. The configuration +// information is the same information you provided as parameters when uploading +// the function. +// +// Using the optional Qualifier parameter, you can specify a specific function +// version for which you want this information. If you don't specify this parameter, +// the API uses unqualified function ARN which return information about the +// $LATEST version of the Lambda function. For more information, see AWS Lambda +// Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:GetFunction action. +// +// // Example sending a request using the GetFunctionRequest method. +// req := client.GetFunctionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunction +func (c *Lambda) GetFunctionRequest(input *GetFunctionInput) GetFunctionRequest { + op := &aws.Operation{ + Name: opGetFunction, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}", + } + + if input == nil { + input = &GetFunctionInput{} + } + + output := &GetFunctionOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetFunctionRequest{Request: req, Input: input, Copy: c.GetFunctionRequest} +} + +const opGetFunctionConfiguration = "GetFunctionConfiguration" + +// GetFunctionConfigurationRequest is a API request type for the GetFunctionConfiguration API operation. +type GetFunctionConfigurationRequest struct { + *aws.Request + Input *GetFunctionConfigurationInput + Copy func(*GetFunctionConfigurationInput) GetFunctionConfigurationRequest +} + +// Send marshals and sends the GetFunctionConfiguration API request. +func (r GetFunctionConfigurationRequest) Send() (*UpdateFunctionConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateFunctionConfigurationOutput), nil +} + +// GetFunctionConfigurationRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns the configuration information of the Lambda function. This the same +// information you provided as parameters when uploading the function by using +// CreateFunction. +// +// If you are using the versioning feature, you can retrieve this information +// for a specific function version by using the optional Qualifier parameter +// and specifying the function version or alias that points to it. If you don't +// provide it, the API returns information about the $LATEST version of the +// function. For more information about versioning, see AWS Lambda Function +// Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:GetFunctionConfiguration +// operation. +// +// // Example sending a request using the GetFunctionConfigurationRequest method. +// req := client.GetFunctionConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfiguration +func (c *Lambda) GetFunctionConfigurationRequest(input *GetFunctionConfigurationInput) GetFunctionConfigurationRequest { + op := &aws.Operation{ + Name: opGetFunctionConfiguration, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}/configuration", + } + + if input == nil { + input = &GetFunctionConfigurationInput{} + } + + output := &UpdateFunctionConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetFunctionConfigurationRequest{Request: req, Input: input, Copy: c.GetFunctionConfigurationRequest} +} + +const opGetPolicy = "GetPolicy" + +// GetPolicyRequest is a API request type for the GetPolicy API operation. +type GetPolicyRequest struct { + *aws.Request + Input *GetPolicyInput + Copy func(*GetPolicyInput) GetPolicyRequest +} + +// Send marshals and sends the GetPolicy API request. +func (r GetPolicyRequest) Send() (*GetPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetPolicyOutput), nil +} + +// GetPolicyRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns the resource policy associated with the specified Lambda function. +// +// If you are using the versioning feature, you can get the resource policy +// associated with the specific Lambda function version or alias by specifying +// the version or alias name using the Qualifier parameter. For more information +// about versioning, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// You need permission for the lambda:GetPolicy action. +// +// // Example sending a request using the GetPolicyRequest method. +// req := client.GetPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicy +func (c *Lambda) GetPolicyRequest(input *GetPolicyInput) GetPolicyRequest { + op := &aws.Operation{ + Name: opGetPolicy, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}/policy", + } + + if input == nil { + input = &GetPolicyInput{} + } + + output := &GetPolicyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetPolicyRequest{Request: req, Input: input, Copy: c.GetPolicyRequest} +} + +const opInvoke = "Invoke" + +// InvokeRequest is a API request type for the Invoke API operation. +type InvokeRequest struct { + *aws.Request + Input *InvokeInput + Copy func(*InvokeInput) InvokeRequest +} + +// Send marshals and sends the Invoke API request. +func (r InvokeRequest) Send() (*InvokeOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*InvokeOutput), nil +} + +// InvokeRequest returns a request value for making API operation for +// AWS Lambda. +// +// Invokes a specific Lambda function. For an example, see Create the Lambda +// Function and Test It Manually (http://docs.aws.amazon.com/lambda/latest/dg/with-dynamodb-create-function.html#with-dbb-invoke-manually). +// +// If you are using the versioning feature, you can invoke the specific function +// version by providing function version or alias name that is pointing to the +// function version using the Qualifier parameter in the request. If you don't +// provide the Qualifier parameter, the $LATEST version of the Lambda function +// is invoked. Invocations occur at least once in response to an event and functions +// must be idempotent to handle this. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:InvokeFunction action. +// +// The TooManyRequestsException noted below will return the following: ConcurrentInvocationLimitExceeded +// will be returned if you have no functions with reserved concurrency and have +// exceeded your account concurrent limit or if a function without reserved +// concurrency exceeds the account's unreserved concurrency limit. ReservedFunctionConcurrentInvocationLimitExceeded +// will be returned when a function with reserved concurrency exceeds its configured +// concurrency limit. +// +// // Example sending a request using the InvokeRequest method. +// req := client.InvokeRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Invoke +func (c *Lambda) InvokeRequest(input *InvokeInput) InvokeRequest { + op := &aws.Operation{ + Name: opInvoke, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/functions/{FunctionName}/invocations", + } + + if input == nil { + input = &InvokeInput{} + } + + output := &InvokeOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return InvokeRequest{Request: req, Input: input, Copy: c.InvokeRequest} +} + +const opInvokeAsync = "InvokeAsync" + +// InvokeAsyncRequest is a API request type for the InvokeAsync API operation. +type InvokeAsyncRequest struct { + *aws.Request + Input *InvokeAsyncInput + Copy func(*InvokeAsyncInput) InvokeAsyncRequest +} + +// Send marshals and sends the InvokeAsync API request. +func (r InvokeAsyncRequest) Send() (*InvokeAsyncOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*InvokeAsyncOutput), nil +} + +// InvokeAsyncRequest returns a request value for making API operation for +// AWS Lambda. +// +// This API is deprecated. We recommend you use Invoke API (see Invoke). +// +// Submits an invocation request to AWS Lambda. Upon receiving the request, +// Lambda executes the specified function asynchronously. To see the logs generated +// by the Lambda function execution, see the CloudWatch Logs console. +// +// This operation requires permission for the lambda:InvokeFunction action. +// +// // Example sending a request using the InvokeAsyncRequest method. +// req := client.InvokeAsyncRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsync +func (c *Lambda) InvokeAsyncRequest(input *InvokeAsyncInput) InvokeAsyncRequest { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, InvokeAsync, has been deprecated") + } + op := &aws.Operation{ + Name: opInvokeAsync, + HTTPMethod: "POST", + HTTPPath: "/2014-11-13/functions/{FunctionName}/invoke-async/", + } + + if input == nil { + input = &InvokeAsyncInput{} + } + + output := &InvokeAsyncOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return InvokeAsyncRequest{Request: req, Input: input, Copy: c.InvokeAsyncRequest} +} + +const opListAliases = "ListAliases" + +// ListAliasesRequest is a API request type for the ListAliases API operation. +type ListAliasesRequest struct { + *aws.Request + Input *ListAliasesInput + Copy func(*ListAliasesInput) ListAliasesRequest +} + +// Send marshals and sends the ListAliases API request. +func (r ListAliasesRequest) Send() (*ListAliasesOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListAliasesOutput), nil +} + +// ListAliasesRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns list of aliases created for a Lambda function. For each alias, the +// response includes information such as the alias ARN, description, alias name, +// and the function version to which it points. For more information, see Introduction +// to AWS Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). +// +// This requires permission for the lambda:ListAliases action. +// +// // Example sending a request using the ListAliasesRequest method. +// req := client.ListAliasesRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliases +func (c *Lambda) ListAliasesRequest(input *ListAliasesInput) ListAliasesRequest { + op := &aws.Operation{ + Name: opListAliases, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}/aliases", + } + + if input == nil { + input = &ListAliasesInput{} + } + + output := &ListAliasesOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListAliasesRequest{Request: req, Input: input, Copy: c.ListAliasesRequest} +} + +const opListEventSourceMappings = "ListEventSourceMappings" + +// ListEventSourceMappingsRequest is a API request type for the ListEventSourceMappings API operation. +type ListEventSourceMappingsRequest struct { + *aws.Request + Input *ListEventSourceMappingsInput + Copy func(*ListEventSourceMappingsInput) ListEventSourceMappingsRequest +} + +// Send marshals and sends the ListEventSourceMappings API request. +func (r ListEventSourceMappingsRequest) Send() (*ListEventSourceMappingsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListEventSourceMappingsOutput), nil +} + +// ListEventSourceMappingsRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns a list of event source mappings you created using the CreateEventSourceMapping +// (see CreateEventSourceMapping). +// +// For each mapping, the API returns configuration information. You can optionally +// specify filters to retrieve specific event source mappings. +// +// If you are using the versioning feature, you can get list of event source +// mappings for a specific Lambda function version or an alias as described +// in the FunctionName parameter. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:ListEventSourceMappings +// action. +// +// // Example sending a request using the ListEventSourceMappingsRequest method. +// req := client.ListEventSourceMappingsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappings +func (c *Lambda) ListEventSourceMappingsRequest(input *ListEventSourceMappingsInput) ListEventSourceMappingsRequest { + op := &aws.Operation{ + Name: opListEventSourceMappings, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/event-source-mappings/", + Paginator: &aws.Paginator{ + InputTokens: []string{"Marker"}, + OutputTokens: []string{"NextMarker"}, + LimitToken: "MaxItems", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListEventSourceMappingsInput{} + } + + output := &ListEventSourceMappingsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListEventSourceMappingsRequest{Request: req, Input: input, Copy: c.ListEventSourceMappingsRequest} +} + +// Paginate pages iterates over the pages of a ListEventSourceMappingsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListEventSourceMappings operation. +// req := client.ListEventSourceMappingsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListEventSourceMappingsRequest) Paginate(opts ...aws.Option) ListEventSourceMappingsPager { + return ListEventSourceMappingsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListEventSourceMappingsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListEventSourceMappingsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListEventSourceMappingsPager struct { + aws.Pager +} + +func (p *ListEventSourceMappingsPager) CurrentPage() *ListEventSourceMappingsOutput { + return p.Pager.CurrentPage().(*ListEventSourceMappingsOutput) +} + +const opListFunctions = "ListFunctions" + +// ListFunctionsRequest is a API request type for the ListFunctions API operation. +type ListFunctionsRequest struct { + *aws.Request + Input *ListFunctionsInput + Copy func(*ListFunctionsInput) ListFunctionsRequest +} + +// Send marshals and sends the ListFunctions API request. +func (r ListFunctionsRequest) Send() (*ListFunctionsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListFunctionsOutput), nil +} + +// ListFunctionsRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns a list of your Lambda functions. For each function, the response +// includes the function configuration information. You must use GetFunction +// to retrieve the code for your function. +// +// This operation requires permission for the lambda:ListFunctions action. +// +// If you are using the versioning feature, you can list all of your functions +// or only $LATEST versions. For information about the versioning feature, see +// AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// // Example sending a request using the ListFunctionsRequest method. +// req := client.ListFunctionsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctions +func (c *Lambda) ListFunctionsRequest(input *ListFunctionsInput) ListFunctionsRequest { + op := &aws.Operation{ + Name: opListFunctions, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/", + Paginator: &aws.Paginator{ + InputTokens: []string{"Marker"}, + OutputTokens: []string{"NextMarker"}, + LimitToken: "MaxItems", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListFunctionsInput{} + } + + output := &ListFunctionsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListFunctionsRequest{Request: req, Input: input, Copy: c.ListFunctionsRequest} +} + +// Paginate pages iterates over the pages of a ListFunctionsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListFunctions operation. +// req := client.ListFunctionsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListFunctionsRequest) Paginate(opts ...aws.Option) ListFunctionsPager { + return ListFunctionsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListFunctionsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListFunctionsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListFunctionsPager struct { + aws.Pager +} + +func (p *ListFunctionsPager) CurrentPage() *ListFunctionsOutput { + return p.Pager.CurrentPage().(*ListFunctionsOutput) +} + +const opListTags = "ListTags" + +// ListTagsRequest is a API request type for the ListTags API operation. +type ListTagsRequest struct { + *aws.Request + Input *ListTagsInput + Copy func(*ListTagsInput) ListTagsRequest +} + +// Send marshals and sends the ListTags API request. +func (r ListTagsRequest) Send() (*ListTagsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListTagsOutput), nil +} + +// ListTagsRequest returns a request value for making API operation for +// AWS Lambda. +// +// Returns a list of tags assigned to a function when supplied the function +// ARN (Amazon Resource Name). For more information on Tagging, see Tagging +// Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) +// in the AWS Lambda Developer Guide. +// +// // Example sending a request using the ListTagsRequest method. +// req := client.ListTagsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTags +func (c *Lambda) ListTagsRequest(input *ListTagsInput) ListTagsRequest { + op := &aws.Operation{ + Name: opListTags, + HTTPMethod: "GET", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &ListTagsInput{} + } + + output := &ListTagsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListTagsRequest{Request: req, Input: input, Copy: c.ListTagsRequest} +} + +const opListVersionsByFunction = "ListVersionsByFunction" + +// ListVersionsByFunctionRequest is a API request type for the ListVersionsByFunction API operation. +type ListVersionsByFunctionRequest struct { + *aws.Request + Input *ListVersionsByFunctionInput + Copy func(*ListVersionsByFunctionInput) ListVersionsByFunctionRequest +} + +// Send marshals and sends the ListVersionsByFunction API request. +func (r ListVersionsByFunctionRequest) Send() (*ListVersionsByFunctionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListVersionsByFunctionOutput), nil +} + +// ListVersionsByFunctionRequest returns a request value for making API operation for +// AWS Lambda. +// +// List all versions of a function. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// // Example sending a request using the ListVersionsByFunctionRequest method. +// req := client.ListVersionsByFunctionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunction +func (c *Lambda) ListVersionsByFunctionRequest(input *ListVersionsByFunctionInput) ListVersionsByFunctionRequest { + op := &aws.Operation{ + Name: opListVersionsByFunction, + HTTPMethod: "GET", + HTTPPath: "/2015-03-31/functions/{FunctionName}/versions", + } + + if input == nil { + input = &ListVersionsByFunctionInput{} + } + + output := &ListVersionsByFunctionOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListVersionsByFunctionRequest{Request: req, Input: input, Copy: c.ListVersionsByFunctionRequest} +} + +const opPublishVersion = "PublishVersion" + +// PublishVersionRequest is a API request type for the PublishVersion API operation. +type PublishVersionRequest struct { + *aws.Request + Input *PublishVersionInput + Copy func(*PublishVersionInput) PublishVersionRequest +} + +// Send marshals and sends the PublishVersion API request. +func (r PublishVersionRequest) Send() (*UpdateFunctionConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateFunctionConfigurationOutput), nil +} + +// PublishVersionRequest returns a request value for making API operation for +// AWS Lambda. +// +// Publishes a version of your function from the current snapshot of $LATEST. +// That is, AWS Lambda takes a snapshot of the function code and configuration +// information from $LATEST and publishes a new version. The code and configuration +// cannot be modified after publication. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// // Example sending a request using the PublishVersionRequest method. +// req := client.PublishVersionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishVersion +func (c *Lambda) PublishVersionRequest(input *PublishVersionInput) PublishVersionRequest { + op := &aws.Operation{ + Name: opPublishVersion, + HTTPMethod: "POST", + HTTPPath: "/2015-03-31/functions/{FunctionName}/versions", + } + + if input == nil { + input = &PublishVersionInput{} + } + + output := &UpdateFunctionConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PublishVersionRequest{Request: req, Input: input, Copy: c.PublishVersionRequest} +} + +const opPutFunctionConcurrency = "PutFunctionConcurrency" + +// PutFunctionConcurrencyRequest is a API request type for the PutFunctionConcurrency API operation. +type PutFunctionConcurrencyRequest struct { + *aws.Request + Input *PutFunctionConcurrencyInput + Copy func(*PutFunctionConcurrencyInput) PutFunctionConcurrencyRequest +} + +// Send marshals and sends the PutFunctionConcurrency API request. +func (r PutFunctionConcurrencyRequest) Send() (*PutFunctionConcurrencyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutFunctionConcurrencyOutput), nil +} + +// PutFunctionConcurrencyRequest returns a request value for making API operation for +// AWS Lambda. +// +// Sets a limit on the number of concurrent executions available to this function. +// It is a subset of your account's total concurrent execution limit per region. +// Note that Lambda automatically reserves a buffer of 100 concurrent executions +// for functions without any reserved concurrency limit. This means if your +// account limit is 1000, you have a total of 900 available to allocate to individual +// functions. For more information, see concurrent-executions. +// +// // Example sending a request using the PutFunctionConcurrencyRequest method. +// req := client.PutFunctionConcurrencyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionConcurrency +func (c *Lambda) PutFunctionConcurrencyRequest(input *PutFunctionConcurrencyInput) PutFunctionConcurrencyRequest { + op := &aws.Operation{ + Name: opPutFunctionConcurrency, + HTTPMethod: "PUT", + HTTPPath: "/2017-10-31/functions/{FunctionName}/concurrency", + } + + if input == nil { + input = &PutFunctionConcurrencyInput{} + } + + output := &PutFunctionConcurrencyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutFunctionConcurrencyRequest{Request: req, Input: input, Copy: c.PutFunctionConcurrencyRequest} +} + +const opRemovePermission = "RemovePermission" + +// RemovePermissionRequest is a API request type for the RemovePermission API operation. +type RemovePermissionRequest struct { + *aws.Request + Input *RemovePermissionInput + Copy func(*RemovePermissionInput) RemovePermissionRequest +} + +// Send marshals and sends the RemovePermission API request. +func (r RemovePermissionRequest) Send() (*RemovePermissionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*RemovePermissionOutput), nil +} + +// RemovePermissionRequest returns a request value for making API operation for +// AWS Lambda. +// +// You can remove individual permissions from an resource policy associated +// with a Lambda function by providing a statement ID that you provided when +// you added the permission. +// +// If you are using versioning, the permissions you remove are specific to the +// Lambda function version or alias you specify in the AddPermission request +// via the Qualifier parameter. For more information about versioning, see AWS +// Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// Note that removal of a permission will cause an active event source to lose +// permission to the function. +// +// You need permission for the lambda:RemovePermission action. +// +// // Example sending a request using the RemovePermissionRequest method. +// req := client.RemovePermissionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermission +func (c *Lambda) RemovePermissionRequest(input *RemovePermissionInput) RemovePermissionRequest { + op := &aws.Operation{ + Name: opRemovePermission, + HTTPMethod: "DELETE", + HTTPPath: "/2015-03-31/functions/{FunctionName}/policy/{StatementId}", + } + + if input == nil { + input = &RemovePermissionInput{} + } + + output := &RemovePermissionOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return RemovePermissionRequest{Request: req, Input: input, Copy: c.RemovePermissionRequest} +} + +const opTagResource = "TagResource" + +// TagResourceRequest is a API request type for the TagResource API operation. +type TagResourceRequest struct { + *aws.Request + Input *TagResourceInput + Copy func(*TagResourceInput) TagResourceRequest +} + +// Send marshals and sends the TagResource API request. +func (r TagResourceRequest) Send() (*TagResourceOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*TagResourceOutput), nil +} + +// TagResourceRequest returns a request value for making API operation for +// AWS Lambda. +// +// Creates a list of tags (key-value pairs) on the Lambda function. Requires +// the Lambda function ARN (Amazon Resource Name). If a key is specified without +// a value, Lambda creates a tag with the specified key and a value of null. +// For more information, see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) +// in the AWS Lambda Developer Guide. +// +// // Example sending a request using the TagResourceRequest method. +// req := client.TagResourceRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResource +func (c *Lambda) TagResourceRequest(input *TagResourceInput) TagResourceRequest { + op := &aws.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &TagResourceInput{} + } + + output := &TagResourceOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return TagResourceRequest{Request: req, Input: input, Copy: c.TagResourceRequest} +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest is a API request type for the UntagResource API operation. +type UntagResourceRequest struct { + *aws.Request + Input *UntagResourceInput + Copy func(*UntagResourceInput) UntagResourceRequest +} + +// Send marshals and sends the UntagResource API request. +func (r UntagResourceRequest) Send() (*UntagResourceOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UntagResourceOutput), nil +} + +// UntagResourceRequest returns a request value for making API operation for +// AWS Lambda. +// +// Removes tags from a Lambda function. Requires the function ARN (Amazon Resource +// Name). For more information, see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) +// in the AWS Lambda Developer Guide. +// +// // Example sending a request using the UntagResourceRequest method. +// req := client.UntagResourceRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResource +func (c *Lambda) UntagResourceRequest(input *UntagResourceInput) UntagResourceRequest { + op := &aws.Operation{ + Name: opUntagResource, + HTTPMethod: "DELETE", + HTTPPath: "/2017-03-31/tags/{ARN}", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output := &UntagResourceOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restjson.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return UntagResourceRequest{Request: req, Input: input, Copy: c.UntagResourceRequest} +} + +const opUpdateAlias = "UpdateAlias" + +// UpdateAliasRequest is a API request type for the UpdateAlias API operation. +type UpdateAliasRequest struct { + *aws.Request + Input *UpdateAliasInput + Copy func(*UpdateAliasInput) UpdateAliasRequest +} + +// Send marshals and sends the UpdateAlias API request. +func (r UpdateAliasRequest) Send() (*UpdateAliasOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateAliasOutput), nil +} + +// UpdateAliasRequest returns a request value for making API operation for +// AWS Lambda. +// +// Using this API you can update the function version to which the alias points +// and the alias description. For more information, see Introduction to AWS +// Lambda Aliases (http://docs.aws.amazon.com/lambda/latest/dg/aliases-intro.html). +// +// This requires permission for the lambda:UpdateAlias action. +// +// // Example sending a request using the UpdateAliasRequest method. +// req := client.UpdateAliasRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateAlias +func (c *Lambda) UpdateAliasRequest(input *UpdateAliasInput) UpdateAliasRequest { + op := &aws.Operation{ + Name: opUpdateAlias, + HTTPMethod: "PUT", + HTTPPath: "/2015-03-31/functions/{FunctionName}/aliases/{Name}", + } + + if input == nil { + input = &UpdateAliasInput{} + } + + output := &UpdateAliasOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateAliasRequest{Request: req, Input: input, Copy: c.UpdateAliasRequest} +} + +const opUpdateEventSourceMapping = "UpdateEventSourceMapping" + +// UpdateEventSourceMappingRequest is a API request type for the UpdateEventSourceMapping API operation. +type UpdateEventSourceMappingRequest struct { + *aws.Request + Input *UpdateEventSourceMappingInput + Copy func(*UpdateEventSourceMappingInput) UpdateEventSourceMappingRequest +} + +// Send marshals and sends the UpdateEventSourceMapping API request. +func (r UpdateEventSourceMappingRequest) Send() (*UpdateEventSourceMappingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateEventSourceMappingOutput), nil +} + +// UpdateEventSourceMappingRequest returns a request value for making API operation for +// AWS Lambda. +// +// You can update an event source mapping. This is useful if you want to change +// the parameters of the existing mapping without losing your position in the +// stream. You can change which function will receive the stream records, but +// to change the stream itself, you must create a new mapping. +// +// If you are using the versioning feature, you can update the event source +// mapping to map to a specific Lambda function version or alias as described +// in the FunctionName parameter. For information about the versioning feature, +// see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// If you disable the event source mapping, AWS Lambda stops polling. If you +// enable again, it will resume polling from the time it had stopped polling, +// so you don't lose processing of any records. However, if you delete event +// source mapping and create it again, it will reset. +// +// This operation requires permission for the lambda:UpdateEventSourceMapping +// action. +// +// // Example sending a request using the UpdateEventSourceMappingRequest method. +// req := client.UpdateEventSourceMappingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateEventSourceMapping +func (c *Lambda) UpdateEventSourceMappingRequest(input *UpdateEventSourceMappingInput) UpdateEventSourceMappingRequest { + op := &aws.Operation{ + Name: opUpdateEventSourceMapping, + HTTPMethod: "PUT", + HTTPPath: "/2015-03-31/event-source-mappings/{UUID}", + } + + if input == nil { + input = &UpdateEventSourceMappingInput{} + } + + output := &UpdateEventSourceMappingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateEventSourceMappingRequest{Request: req, Input: input, Copy: c.UpdateEventSourceMappingRequest} +} + +const opUpdateFunctionCode = "UpdateFunctionCode" + +// UpdateFunctionCodeRequest is a API request type for the UpdateFunctionCode API operation. +type UpdateFunctionCodeRequest struct { + *aws.Request + Input *UpdateFunctionCodeInput + Copy func(*UpdateFunctionCodeInput) UpdateFunctionCodeRequest +} + +// Send marshals and sends the UpdateFunctionCode API request. +func (r UpdateFunctionCodeRequest) Send() (*UpdateFunctionConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateFunctionConfigurationOutput), nil +} + +// UpdateFunctionCodeRequest returns a request value for making API operation for +// AWS Lambda. +// +// Updates the code for the specified Lambda function. This operation must only +// be used on an existing Lambda function and cannot be used to update the function +// configuration. +// +// If you are using the versioning feature, note this API will always update +// the $LATEST version of your Lambda function. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:UpdateFunctionCode action. +// +// // Example sending a request using the UpdateFunctionCodeRequest method. +// req := client.UpdateFunctionCodeRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCode +func (c *Lambda) UpdateFunctionCodeRequest(input *UpdateFunctionCodeInput) UpdateFunctionCodeRequest { + op := &aws.Operation{ + Name: opUpdateFunctionCode, + HTTPMethod: "PUT", + HTTPPath: "/2015-03-31/functions/{FunctionName}/code", + } + + if input == nil { + input = &UpdateFunctionCodeInput{} + } + + output := &UpdateFunctionConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateFunctionCodeRequest{Request: req, Input: input, Copy: c.UpdateFunctionCodeRequest} +} + +const opUpdateFunctionConfiguration = "UpdateFunctionConfiguration" + +// UpdateFunctionConfigurationRequest is a API request type for the UpdateFunctionConfiguration API operation. +type UpdateFunctionConfigurationRequest struct { + *aws.Request + Input *UpdateFunctionConfigurationInput + Copy func(*UpdateFunctionConfigurationInput) UpdateFunctionConfigurationRequest +} + +// Send marshals and sends the UpdateFunctionConfiguration API request. +func (r UpdateFunctionConfigurationRequest) Send() (*UpdateFunctionConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UpdateFunctionConfigurationOutput), nil +} + +// UpdateFunctionConfigurationRequest returns a request value for making API operation for +// AWS Lambda. +// +// Updates the configuration parameters for the specified Lambda function by +// using the values provided in the request. You provide only the parameters +// you want to change. This operation must only be used on an existing Lambda +// function and cannot be used to update the function's code. +// +// If you are using the versioning feature, note this API will always update +// the $LATEST version of your Lambda function. For information about the versioning +// feature, see AWS Lambda Function Versioning and Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html). +// +// This operation requires permission for the lambda:UpdateFunctionConfiguration +// action. +// +// // Example sending a request using the UpdateFunctionConfigurationRequest method. +// req := client.UpdateFunctionConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionConfiguration +func (c *Lambda) UpdateFunctionConfigurationRequest(input *UpdateFunctionConfigurationInput) UpdateFunctionConfigurationRequest { + op := &aws.Operation{ + Name: opUpdateFunctionConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/2015-03-31/functions/{FunctionName}/configuration", + } + + if input == nil { + input = &UpdateFunctionConfigurationInput{} + } + + output := &UpdateFunctionConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UpdateFunctionConfigurationRequest{Request: req, Input: input, Copy: c.UpdateFunctionConfigurationRequest} +} + +// Provides limits of code size and concurrency associated with the current +// account and region. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AccountLimit +type AccountLimit struct { + _ struct{} `type:"structure"` + + // Size, in bytes, of code/dependencies that you can zip into a deployment package + // (uncompressed zip/jar size) for uploading. The default limit is 250 MB. + CodeSizeUnzipped *int64 `type:"long"` + + // Size, in bytes, of a single zipped code/dependencies package you can upload + // for your Lambda function(.zip/.jar file). Try using Amazon S3 for uploading + // larger files. Default limit is 50 MB. + CodeSizeZipped *int64 `type:"long"` + + // Number of simultaneous executions of your function per region. For more information + // or to request a limit increase for concurrent executions, see Lambda Function + // Concurrent Executions (http://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html). + // The default limit is 1000. + ConcurrentExecutions *int64 `type:"integer"` + + // Maximum size, in bytes, of a code package you can upload per region. The + // default size is 75 GB. + TotalCodeSize *int64 `type:"long"` + + // The number of concurrent executions available to functions that do not have + // concurrency limits set. For more information, see concurrent-executions. + UnreservedConcurrentExecutions *int64 `type:"integer"` +} + +// String returns the string representation +func (s AccountLimit) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccountLimit) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AccountLimit) MarshalFields(e protocol.FieldEncoder) error { + if s.CodeSizeUnzipped != nil { + v := *s.CodeSizeUnzipped + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CodeSizeUnzipped", protocol.Int64Value(v), metadata) + } + if s.CodeSizeZipped != nil { + v := *s.CodeSizeZipped + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CodeSizeZipped", protocol.Int64Value(v), metadata) + } + if s.ConcurrentExecutions != nil { + v := *s.ConcurrentExecutions + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ConcurrentExecutions", protocol.Int64Value(v), metadata) + } + if s.TotalCodeSize != nil { + v := *s.TotalCodeSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "TotalCodeSize", protocol.Int64Value(v), metadata) + } + if s.UnreservedConcurrentExecutions != nil { + v := *s.UnreservedConcurrentExecutions + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UnreservedConcurrentExecutions", protocol.Int64Value(v), metadata) + } + return nil +} + +// Provides code size usage and function count associated with the current account +// and region. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AccountUsage +type AccountUsage struct { + _ struct{} `type:"structure"` + + // The number of your account's existing functions per region. + FunctionCount *int64 `type:"long"` + + // Total size, in bytes, of the account's deployment packages per region. + TotalCodeSize *int64 `type:"long"` +} + +// String returns the string representation +func (s AccountUsage) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccountUsage) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AccountUsage) MarshalFields(e protocol.FieldEncoder) error { + if s.FunctionCount != nil { + v := *s.FunctionCount + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionCount", protocol.Int64Value(v), metadata) + } + if s.TotalCodeSize != nil { + v := *s.TotalCodeSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "TotalCodeSize", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermissionRequest +type AddPermissionInput struct { + _ struct{} `type:"structure"` + + // The AWS Lambda action you want to allow in this statement. Each Lambda action + // is a string starting with lambda: followed by the API name . For example, + // lambda:CreateFunction. You can use wildcard (lambda:*) to grant permission + // for all AWS Lambda actions. + // + // Action is a required field + Action *string `type:"string" required:"true"` + + // A unique token that must be supplied by the principal invoking the function. + // This is currently only used for Alexa Smart Home functions. + EventSourceToken *string `type:"string"` + + // Name of the Lambda function whose resource policy you are updating by adding + // a new permission. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // The principal who is getting this permission. It can be Amazon S3 service + // Principal (s3.amazonaws.com) if you want Amazon S3 to invoke the function, + // an AWS account ID if you are granting cross-account permission, or any valid + // AWS service principal such as sns.amazonaws.com. For example, you might want + // to allow a custom application in another AWS account to push events to AWS + // Lambda by invoking your function. + // + // Principal is a required field + Principal *string `type:"string" required:"true"` + + // You can use this optional query parameter to describe a qualified ARN using + // a function version or an alias name. The permission will then apply to the + // specific qualified ARN. For example, if you specify function version 2 as + // the qualifier, then permission applies only when request is made using qualified + // function ARN: + // + // arn:aws:lambda:aws-region:acct-id:function:function-name:2 + // + // If you specify an alias name, for example PROD, then the permission is valid + // only for requests made using the alias ARN: + // + // arn:aws:lambda:aws-region:acct-id:function:function-name:PROD + // + // If the qualifier is not specified, the permission is valid only when requests + // is made using unqualified function ARN. + // + // arn:aws:lambda:aws-region:acct-id:function:function-name + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `type:"string"` + + // This parameter is used for S3 and SES. The AWS account ID (without a hyphen) + // of the source owner. For example, if the SourceArn identifies a bucket, then + // this is the bucket owner's account ID. You can use this additional condition + // to ensure the bucket you specify is owned by a specific account (it is possible + // the bucket owner deleted the bucket and some other AWS account created the + // bucket). You can also use this condition to specify all sources (that is, + // you don't specify the SourceArn) owned by a specific account. + SourceAccount *string `type:"string"` + + // This is optional; however, when granting permission to invoke your function, + // you should specify this field with the Amazon Resource Name (ARN) as its + // value. This ensures that only events generated from the specified source + // can invoke the function. + // + // If you add a permission without providing the source ARN, any AWS account + // that creates a mapping to your function ARN can send events to invoke your + // Lambda function. + SourceArn *string `type:"string"` + + // A unique statement identifier. + // + // StatementId is a required field + StatementId *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s AddPermissionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AddPermissionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AddPermissionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AddPermissionInput"} + + if s.Action == nil { + invalidParams.Add(aws.NewErrParamRequired("Action")) + } + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.Principal == nil { + invalidParams.Add(aws.NewErrParamRequired("Principal")) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if s.StatementId == nil { + invalidParams.Add(aws.NewErrParamRequired("StatementId")) + } + if s.StatementId != nil && len(*s.StatementId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StatementId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AddPermissionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Action != nil { + v := *s.Action + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Action", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.EventSourceToken != nil { + v := *s.EventSourceToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EventSourceToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Principal != nil { + v := *s.Principal + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Principal", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.SourceAccount != nil { + v := *s.SourceAccount + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "SourceAccount", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.SourceArn != nil { + v := *s.SourceArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "SourceArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.StatementId != nil { + v := *s.StatementId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StatementId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AddPermissionResponse +type AddPermissionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The permission statement you specified in the request. The response returns + // the same as a string using a backslash ("\") as an escape character in the + // JSON. + Statement *string `type:"string"` +} + +// String returns the string representation +func (s AddPermissionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AddPermissionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AddPermissionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AddPermissionOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Statement != nil { + v := *s.Statement + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Statement", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// The parent object that implements what percentage of traffic will invoke +// each function version. For more information, see lambda-traffic-shifting-using-aliases. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/AliasRoutingConfiguration +type AliasRoutingConfiguration struct { + _ struct{} `type:"structure"` + + // Set this value to dictate what percentage of traffic will invoke the updated + // function version. If set to an empty string, 100 percent of traffic will + // invoke function-version. For more information, see lambda-traffic-shifting-using-aliases. + AdditionalVersionWeights map[string]float64 `type:"map"` +} + +// String returns the string representation +func (s AliasRoutingConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AliasRoutingConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AliasRoutingConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.AdditionalVersionWeights) > 0 { + v := s.AdditionalVersionWeights + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "AdditionalVersionWeights", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.Float64Value(v1)) + } + ms0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateAliasRequest +type CreateAliasInput struct { + _ struct{} `type:"structure"` + + // Description of the alias. + Description *string `type:"string"` + + // Name of the Lambda function for which you want to create an alias. Note that + // the length constraint applies only to the ARN. If you specify only the function + // name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Lambda function version for which you are creating the alias. + // + // FunctionVersion is a required field + FunctionVersion *string `min:"1" type:"string" required:"true"` + + // Name for the alias you are creating. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // Specifies an additional version your alias can point to, allowing you to + // dictate what percentage of traffic will invoke each version. For more information, + // see lambda-traffic-shifting-using-aliases. + RoutingConfig *AliasRoutingConfiguration `type:"structure"` +} + +// String returns the string representation +func (s CreateAliasInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateAliasInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateAliasInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateAliasInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.FunctionVersion == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionVersion")) + } + if s.FunctionVersion != nil && len(*s.FunctionVersion) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionVersion", 1)) + } + + if s.Name == nil { + invalidParams.Add(aws.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateAliasInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionVersion != nil { + v := *s.FunctionVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RoutingConfig != nil { + v := s.RoutingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "RoutingConfig", v, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateEventSourceMappingRequest +type CreateEventSourceMappingInput struct { + _ struct{} `type:"structure"` + + // The largest number of records that AWS Lambda will retrieve from your event + // source at the time of invoking your function. Your function receives an event + // with all the retrieved records. The default for Amazon Kinesis and Amazon + // DynamoDB is 100 records. For SQS, the default is 1. + BatchSize *int64 `min:"1" type:"integer"` + + // Indicates whether AWS Lambda should begin polling the event source. By default, + // Enabled is true. + Enabled *bool `type:"boolean"` + + // The Amazon Resource Name (ARN) of the event source. Any record added to this + // source could cause AWS Lambda to invoke your Lambda function, it depends + // on the BatchSize. AWS Lambda POSTs the event's records to your Lambda function + // as JSON. + // + // EventSourceArn is a required field + EventSourceArn *string `type:"string" required:"true"` + + // The Lambda function to invoke when AWS Lambda detects an event on the stream. + // + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). For + // more information about versioning, see AWS Lambda Function Versioning and + // Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html) + // + // AWS Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). + // + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `min:"1" type:"string" required:"true"` + + // The position in the DynamoDB or Kinesis stream where AWS Lambda should start + // reading. For more information, see GetShardIterator (http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType) + // in the Amazon Kinesis API Reference Guide or GetShardIterator (http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_GetShardIterator.html) + // in the Amazon DynamoDB API Reference Guide. The AT_TIMESTAMP value is supported + // only for Kinesis streams (http://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-streams.html). + StartingPosition EventSourcePosition `type:"string" enum:"true"` + + // The timestamp of the data record from which to start reading. Used with shard + // iterator type (http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType) + // AT_TIMESTAMP. If a record with this exact timestamp does not exist, the iterator + // returned is for the next (later) record. If the timestamp is older than the + // current trim horizon, the iterator returned is for the oldest untrimmed data + // record (TRIM_HORIZON). Valid only for Kinesis streams (http://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-streams.html). + StartingPositionTimestamp *time.Time `type:"timestamp" timestampFormat:"unix"` +} + +// String returns the string representation +func (s CreateEventSourceMappingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateEventSourceMappingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateEventSourceMappingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateEventSourceMappingInput"} + if s.BatchSize != nil && *s.BatchSize < 1 { + invalidParams.Add(aws.NewErrParamMinValue("BatchSize", 1)) + } + + if s.EventSourceArn == nil { + invalidParams.Add(aws.NewErrParamRequired("EventSourceArn")) + } + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateEventSourceMappingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.BatchSize != nil { + v := *s.BatchSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "BatchSize", protocol.Int64Value(v), metadata) + } + if s.Enabled != nil { + v := *s.Enabled + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Enabled", protocol.BoolValue(v), metadata) + } + if s.EventSourceArn != nil { + v := *s.EventSourceArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EventSourceArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.StartingPosition) > 0 { + v := s.StartingPosition + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StartingPosition", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if s.StartingPositionTimestamp != nil { + v := *s.StartingPositionTimestamp + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StartingPositionTimestamp", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/CreateFunctionRequest +type CreateFunctionInput struct { + _ struct{} `type:"structure"` + + // The code for the Lambda function. + // + // Code is a required field + Code *FunctionCode `type:"structure" required:"true"` + + // The parent object that contains the target ARN (Amazon Resource Name) of + // an Amazon SQS queue or Amazon SNS topic. For more information, see dlq. + DeadLetterConfig *DeadLetterConfig `type:"structure"` + + // A short, user-defined function description. Lambda does not use this value. + // Assign a meaningful description as you see fit. + Description *string `type:"string"` + + // The parent object that contains your environment's configuration settings. + Environment *Environment `type:"structure"` + + // The name you want to assign to the function you are uploading. The function + // names appear in the console and are returned in the ListFunctions API. Function + // names are used to specify functions to other AWS Lambda API operations, such + // as Invoke. Note that the length constraint applies only to the ARN. If you + // specify only the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `min:"1" type:"string" required:"true"` + + // The function within your code that Lambda calls to begin execution. For Node.js, + // it is the module-name.export value in your function. For Java, it can be + // package.class-name::handler or package.class-name. For more information, + // see Lambda Function Handler (Java) (http://docs.aws.amazon.com/lambda/latest/dg/java-programming-model-handler-types.html). + // + // Handler is a required field + Handler *string `type:"string" required:"true"` + + // The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's + // environment variables. If not provided, AWS Lambda will use a default service + // key. + KMSKeyArn *string `type:"string"` + + // The amount of memory, in MB, your Lambda function is given. Lambda uses this + // memory size to infer the amount of CPU and memory allocated to your function. + // Your function use-case determines your CPU and memory requirements. For example, + // a database operation might need less memory compared to an image processing + // function. The default value is 128 MB. The value must be a multiple of 64 + // MB. + MemorySize *int64 `min:"128" type:"integer"` + + // This boolean parameter can be used to request AWS Lambda to create the Lambda + // function and publish a version as an atomic operation. + Publish *bool `type:"boolean"` + + // The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it + // executes your function to access any other Amazon Web Services (AWS) resources. + // For more information, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html). + // + // Role is a required field + Role *string `type:"string" required:"true"` + + // The runtime environment for the Lambda function you are uploading. + // + // To use the Python runtime v3.6, set the value to "python3.6". To use the + // Python runtime v2.7, set the value to "python2.7". To use the Node.js runtime + // v6.10, set the value to "nodejs6.10". To use the Node.js runtime v4.3, set + // the value to "nodejs4.3". To use the .NET Core runtime v1.0, set the value + // to "dotnetcore1.0". To use the .NET Core runtime v2.0, set the value to "dotnetcore2.0". + // + // Node v0.10.42 is currently marked as deprecated. You must migrate existing + // functions to the newer Node.js runtime versions available on AWS Lambda (nodejs4.3 + // or nodejs6.10) as soon as possible. Failure to do so will result in an invalid + // parameter error being returned. Note that you will have to follow this procedure + // for each region that contains functions written in the Node v0.10.42 runtime. + // + // Runtime is a required field + Runtime Runtime `type:"string" required:"true" enum:"true"` + + // The list of tags (key-value pairs) assigned to the new function. For more + // information, see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + Tags map[string]string `type:"map"` + + // The function execution time at which Lambda should terminate the function. + // Because the execution time has cost implications, we recommend you set this + // value based on your expected execution time. The default is 3 seconds. + Timeout *int64 `min:"1" type:"integer"` + + // The parent object that contains your function's tracing settings. + TracingConfig *TracingConfig `type:"structure"` + + // If your Lambda function accesses resources in a VPC, you provide this parameter + // identifying the list of security group IDs and subnet IDs. These must belong + // to the same VPC. You must provide at least one security group and one subnet + // ID. + VpcConfig *VpcConfig `type:"structure"` +} + +// String returns the string representation +func (s CreateFunctionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateFunctionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateFunctionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateFunctionInput"} + + if s.Code == nil { + invalidParams.Add(aws.NewErrParamRequired("Code")) + } + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.Handler == nil { + invalidParams.Add(aws.NewErrParamRequired("Handler")) + } + if s.MemorySize != nil && *s.MemorySize < 128 { + invalidParams.Add(aws.NewErrParamMinValue("MemorySize", 128)) + } + + if s.Role == nil { + invalidParams.Add(aws.NewErrParamRequired("Role")) + } + if len(s.Runtime) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Runtime")) + } + if s.Timeout != nil && *s.Timeout < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Timeout", 1)) + } + if s.Code != nil { + if err := s.Code.Validate(); err != nil { + invalidParams.AddNested("Code", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateFunctionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Code != nil { + v := s.Code + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Code", v, metadata) + } + if s.DeadLetterConfig != nil { + v := s.DeadLetterConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "DeadLetterConfig", v, metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Environment != nil { + v := s.Environment + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Environment", v, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Handler != nil { + v := *s.Handler + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Handler", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.KMSKeyArn != nil { + v := *s.KMSKeyArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSKeyArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MemorySize != nil { + v := *s.MemorySize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MemorySize", protocol.Int64Value(v), metadata) + } + if s.Publish != nil { + v := *s.Publish + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Publish", protocol.BoolValue(v), metadata) + } + if s.Role != nil { + v := *s.Role + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Role", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.Runtime) > 0 { + v := s.Runtime + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Runtime", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Tags", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + if s.Timeout != nil { + v := *s.Timeout + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Timeout", protocol.Int64Value(v), metadata) + } + if s.TracingConfig != nil { + v := s.TracingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "TracingConfig", v, metadata) + } + if s.VpcConfig != nil { + v := s.VpcConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "VpcConfig", v, metadata) + } + return nil +} + +// The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic +// you specify as your Dead Letter Queue (DLQ). For more information, see dlq. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeadLetterConfig +type DeadLetterConfig struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic + // you specify as your Dead Letter Queue (DLQ). dlq. For more information, see + // dlq. + TargetArn *string `type:"string"` +} + +// String returns the string representation +func (s DeadLetterConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeadLetterConfig) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeadLetterConfig) MarshalFields(e protocol.FieldEncoder) error { + if s.TargetArn != nil { + v := *s.TargetArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "TargetArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAliasRequest +type DeleteAliasInput struct { + _ struct{} `type:"structure"` + + // The Lambda function name for which the alias is created. Deleting an alias + // does not delete the function version to which it is pointing. Note that the + // length constraint applies only to the ARN. If you specify only the function + // name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Name of the alias to delete. + // + // Name is a required field + Name *string `location:"uri" locationName:"Name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteAliasInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAliasInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteAliasInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteAliasInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.Name == nil { + invalidParams.Add(aws.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteAliasInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteAliasOutput +type DeleteAliasOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteAliasOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteAliasOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteAliasOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteAliasOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteEventSourceMappingRequest +type DeleteEventSourceMappingInput struct { + _ struct{} `type:"structure"` + + // The event source mapping ID. + // + // UUID is a required field + UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteEventSourceMappingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteEventSourceMappingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteEventSourceMappingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteEventSourceMappingInput"} + + if s.UUID == nil { + invalidParams.Add(aws.NewErrParamRequired("UUID")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteEventSourceMappingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.UUID != nil { + v := *s.UUID + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "UUID", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrencyRequest +type DeleteFunctionConcurrencyInput struct { + _ struct{} `type:"structure"` + + // The name of the function you are removing concurrent execution limits from. + // For more information, see concurrent-executions. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteFunctionConcurrencyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteFunctionConcurrencyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteFunctionConcurrencyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteFunctionConcurrencyInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteFunctionConcurrencyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionConcurrencyOutput +type DeleteFunctionConcurrencyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteFunctionConcurrencyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteFunctionConcurrencyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteFunctionConcurrencyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteFunctionConcurrencyOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionRequest +type DeleteFunctionInput struct { + _ struct{} `type:"structure"` + + // The Lambda function to delete. + // + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Using this optional parameter you can specify a function version (but not + // the $LATEST version) to direct AWS Lambda to delete a specific function version. + // If the function version has one or more aliases pointing to it, you will + // get an error because you cannot have aliases pointing to it. You can delete + // any function version but not the $LATEST, that is, you cannot specify $LATEST + // as the value of this parameter. The $LATEST version can be deleted only when + // you want to delete all the function versions and aliases. + // + // You can only specify a function version, not an alias name, using this parameter. + // You cannot delete a function version using its alias. + // + // If you don't specify this parameter, AWS Lambda will delete the function, + // including all of its versions and aliases. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` +} + +// String returns the string representation +func (s DeleteFunctionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteFunctionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteFunctionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteFunctionInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteFunctionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/DeleteFunctionOutput +type DeleteFunctionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteFunctionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteFunctionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteFunctionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteFunctionOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// The parent object that contains your environment's configuration settings. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Environment +type Environment struct { + _ struct{} `type:"structure"` + + // The key-value pairs that represent your environment's configuration settings. + Variables map[string]string `type:"map"` +} + +// String returns the string representation +func (s Environment) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Environment) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Environment) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Variables) > 0 { + v := s.Variables + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Variables", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + return nil +} + +// The parent object that contains error information associated with your configuration +// settings. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/EnvironmentError +type EnvironmentError struct { + _ struct{} `type:"structure"` + + // The error code returned by the environment error object. + ErrorCode *string `type:"string"` + + // The message returned by the environment error object. + Message *string `type:"string"` +} + +// String returns the string representation +func (s EnvironmentError) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentError) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s EnvironmentError) MarshalFields(e protocol.FieldEncoder) error { + if s.ErrorCode != nil { + v := *s.ErrorCode + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ErrorCode", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Message != nil { + v := *s.Message + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Message", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// The parent object returned that contains your environment's configuration +// settings or any error information associated with your configuration settings. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/EnvironmentResponse +type EnvironmentResponse struct { + _ struct{} `type:"structure"` + + // The parent object that contains error information associated with your configuration + // settings. + Error *EnvironmentError `type:"structure"` + + // The key-value pairs returned that represent your environment's configuration + // settings or error information. + Variables map[string]string `type:"map"` +} + +// String returns the string representation +func (s EnvironmentResponse) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EnvironmentResponse) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s EnvironmentResponse) MarshalFields(e protocol.FieldEncoder) error { + if s.Error != nil { + v := s.Error + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Error", v, metadata) + } + if len(s.Variables) > 0 { + v := s.Variables + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Variables", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + return nil +} + +// The code for the Lambda function. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/FunctionCode +type FunctionCode struct { + _ struct{} `type:"structure"` + + // Amazon S3 bucket name where the .zip file containing your deployment package + // is stored. This bucket must reside in the same AWS region where you are creating + // the Lambda function. + S3Bucket *string `min:"3" type:"string"` + + // The Amazon S3 object (the deployment package) key name you want to upload. + S3Key *string `min:"1" type:"string"` + + // The Amazon S3 object (the deployment package) version you want to upload. + S3ObjectVersion *string `min:"1" type:"string"` + + // The contents of your zip file containing your deployment package. If you + // are using the web API directly, the contents of the zip file must be base64-encoded. + // If you are using the AWS SDKs or the AWS CLI, the SDKs or CLI will do the + // encoding for you. For more information about creating a .zip file, see Execution + // Permissions (http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role.html) + // in the AWS Lambda Developer Guide. + // + // ZipFile is automatically base64 encoded/decoded by the SDK. + ZipFile []byte `type:"blob"` +} + +// String returns the string representation +func (s FunctionCode) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FunctionCode) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *FunctionCode) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "FunctionCode"} + if s.S3Bucket != nil && len(*s.S3Bucket) < 3 { + invalidParams.Add(aws.NewErrParamMinLen("S3Bucket", 3)) + } + if s.S3Key != nil && len(*s.S3Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("S3Key", 1)) + } + if s.S3ObjectVersion != nil && len(*s.S3ObjectVersion) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("S3ObjectVersion", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s FunctionCode) MarshalFields(e protocol.FieldEncoder) error { + if s.S3Bucket != nil { + v := *s.S3Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3Bucket", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.S3Key != nil { + v := *s.S3Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3Key", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.S3ObjectVersion != nil { + v := *s.S3ObjectVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3ObjectVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.ZipFile != nil { + v := s.ZipFile + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ZipFile", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata) + } + return nil +} + +// The object for the Lambda function location. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/FunctionCodeLocation +type FunctionCodeLocation struct { + _ struct{} `type:"structure"` + + // The presigned URL you can use to download the function's .zip file that you + // previously uploaded. The URL is valid for up to 10 minutes. + Location *string `type:"string"` + + // The repository from which you can download the function. + RepositoryType *string `type:"string"` +} + +// String returns the string representation +func (s FunctionCodeLocation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FunctionCodeLocation) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s FunctionCodeLocation) MarshalFields(e protocol.FieldEncoder) error { + if s.Location != nil { + v := *s.Location + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Location", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RepositoryType != nil { + v := *s.RepositoryType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RepositoryType", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettingsRequest +type GetAccountSettingsInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s GetAccountSettingsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAccountSettingsInput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetAccountSettingsInput) MarshalFields(e protocol.FieldEncoder) error { + + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAccountSettingsResponse +type GetAccountSettingsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Provides limits of code size and concurrency associated with the current + // account and region. + AccountLimit *AccountLimit `type:"structure"` + + // Provides code size usage and function count associated with the current account + // and region. + AccountUsage *AccountUsage `type:"structure"` +} + +// String returns the string representation +func (s GetAccountSettingsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAccountSettingsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetAccountSettingsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetAccountSettingsOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.AccountLimit != nil { + v := s.AccountLimit + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "AccountLimit", v, metadata) + } + if s.AccountUsage != nil { + v := s.AccountUsage + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "AccountUsage", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAliasRequest +type GetAliasInput struct { + _ struct{} `type:"structure"` + + // Function name for which the alias is created. An alias is a subresource that + // exists only in the context of an existing Lambda function so you must specify + // the function name. Note that the length constraint applies only to the ARN. + // If you specify only the function name, it is limited to 64 characters in + // length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Name of the alias for which you want to retrieve information. + // + // Name is a required field + Name *string `location:"uri" locationName:"Name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetAliasInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAliasInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetAliasInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetAliasInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.Name == nil { + invalidParams.Add(aws.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetAliasInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMappingRequest +type GetEventSourceMappingInput struct { + _ struct{} `type:"structure"` + + // The AWS Lambda assigned ID of the event source mapping. + // + // UUID is a required field + UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetEventSourceMappingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetEventSourceMappingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetEventSourceMappingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetEventSourceMappingInput"} + + if s.UUID == nil { + invalidParams.Add(aws.NewErrParamRequired("UUID")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetEventSourceMappingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.UUID != nil { + v := *s.UUID + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "UUID", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionConfigurationRequest +type GetFunctionConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the Lambda function for which you want to retrieve the configuration + // information. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Using this optional parameter you can specify a function version or an alias + // name. If you specify function version, the API uses qualified function ARN + // and returns information about the specific function version. If you specify + // an alias name, the API uses the alias ARN and returns information about the + // function version to which the alias points. + // + // If you don't specify this parameter, the API uses unqualified function ARN, + // and returns information about the $LATEST function version. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` +} + +// String returns the string representation +func (s GetFunctionConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetFunctionConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetFunctionConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetFunctionConfigurationInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetFunctionConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionRequest +type GetFunctionInput struct { + _ struct{} `type:"structure"` + + // The Lambda function name. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Use this optional parameter to specify a function version or an alias name. + // If you specify function version, the API uses qualified function ARN for + // the request and returns information about the specific Lambda function version. + // If you specify an alias name, the API uses the alias ARN and returns information + // about the function version to which the alias points. If you don't provide + // this parameter, the API uses unqualified function ARN and returns information + // about the $LATEST version of the Lambda function. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` +} + +// String returns the string representation +func (s GetFunctionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetFunctionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetFunctionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetFunctionInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetFunctionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// This response contains the object for the Lambda function location (see FunctionCodeLocation. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetFunctionResponse +type GetFunctionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The object for the Lambda function location. + Code *FunctionCodeLocation `type:"structure"` + + // The concurrent execution limit set for this function. For more information, + // see concurrent-executions. + Concurrency *PutFunctionConcurrencyOutput `type:"structure"` + + // A complex type that describes function metadata. + Configuration *UpdateFunctionConfigurationOutput `type:"structure"` + + // Returns the list of tags associated with the function. For more information, + // see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + Tags map[string]string `type:"map"` +} + +// String returns the string representation +func (s GetFunctionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetFunctionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetFunctionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetFunctionOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Code != nil { + v := s.Code + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Code", v, metadata) + } + if s.Concurrency != nil { + v := s.Concurrency + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Concurrency", v, metadata) + } + if s.Configuration != nil { + v := s.Configuration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Configuration", v, metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Tags", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicyRequest +type GetPolicyInput struct { + _ struct{} `type:"structure"` + + // Function name whose resource policy you want to retrieve. + // + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // You can specify this optional query parameter to specify a function version + // or an alias name in which case this API will return all permissions associated + // with the specific qualified ARN. If you don't provide this parameter, the + // API will return permissions that apply to the unqualified function ARN. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` +} + +// String returns the string representation +func (s GetPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetPolicyInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetPolicyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetPolicyResponse +type GetPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The resource policy associated with the specified function. The response + // returns the same as a string using a backslash ("\") as an escape character + // in the JSON. + Policy *string `type:"string"` + + // Represents the latest updated revision of the function or alias. + RevisionId *string `type:"string"` +} + +// String returns the string representation +func (s GetPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetPolicyOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Policy != nil { + v := *s.Policy + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Policy", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsyncRequest +type InvokeAsyncInput struct { + _ struct{} `deprecated:"true" type:"structure" payload:"InvokeArgs"` + + // The Lambda function name. Note that the length constraint applies only to + // the ARN. If you specify only the function name, it is limited to 64 characters + // in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // JSON that you want to provide to your Lambda function as input. + // + // InvokeArgs is a required field + InvokeArgs io.ReadSeeker `type:"blob" required:"true"` +} + +// String returns the string representation +func (s InvokeAsyncInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InvokeAsyncInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InvokeAsyncInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InvokeAsyncInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.InvokeArgs == nil { + invalidParams.Add(aws.NewErrParamRequired("InvokeArgs")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InvokeAsyncInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.InvokeArgs != nil { + v := s.InvokeArgs + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "InvokeArgs", protocol.ReadSeekerStream{V: v}, metadata) + } + return nil +} + +// Upon success, it returns empty response. Otherwise, throws an exception. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvokeAsyncResponse +type InvokeAsyncOutput struct { + _ struct{} `deprecated:"true" type:"structure"` + + responseMetadata aws.Response + + // It will be 202 upon success. + Status *int64 `location:"statusCode" type:"integer"` +} + +// String returns the string representation +func (s InvokeAsyncOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InvokeAsyncOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s InvokeAsyncOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InvokeAsyncOutput) MarshalFields(e protocol.FieldEncoder) error { + // ignoring invalid encode state, StatusCode. Status + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvocationRequest +type InvokeInput struct { + _ struct{} `type:"structure" payload:"Payload"` + + // Using the ClientContext you can pass client-specific information to the Lambda + // function you are invoking. You can then process the client information in + // your Lambda function as you choose through the context variable. For an example + // of a ClientContext JSON, see PutEvents (http://docs.aws.amazon.com/mobileanalytics/latest/ug/PutEvents.html) + // in the Amazon Mobile Analytics API Reference and User Guide. + // + // The ClientContext JSON must be base64-encoded and has a maximum size of 3583 + // bytes. + ClientContext *string `location:"header" locationName:"X-Amz-Client-Context" type:"string"` + + // The Lambda function name. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // By default, the Invoke API assumes RequestResponse invocation type. You can + // optionally request asynchronous execution by specifying Event as the InvocationType. + // You can also use this parameter to request AWS Lambda to not execute the + // function but do some verification, such as if the caller is authorized to + // invoke the function and if the inputs are valid. You request this by specifying + // DryRun as the InvocationType. This is useful in a cross-account scenario + // when you want to verify access to a function without running it. + InvocationType InvocationType `location:"header" locationName:"X-Amz-Invocation-Type" type:"string" enum:"true"` + + // You can set this optional parameter to Tail in the request only if you specify + // the InvocationType parameter with value RequestResponse. In this case, AWS + // Lambda returns the base64-encoded last 4 KB of log data produced by your + // Lambda function in the x-amz-log-result header. + LogType LogType `location:"header" locationName:"X-Amz-Log-Type" type:"string" enum:"true"` + + // JSON that you want to provide to your Lambda function as input. + Payload []byte `type:"blob"` + + // You can use this optional parameter to specify a Lambda function version + // or alias name. If you specify a function version, the API uses the qualified + // function ARN to invoke a specific Lambda function. If you specify an alias + // name, the API uses the alias ARN to invoke the Lambda function version to + // which the alias points. + // + // If you don't provide this parameter, then the API uses unqualified function + // ARN which results in invocation of the $LATEST version. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` +} + +// String returns the string representation +func (s InvokeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InvokeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InvokeInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InvokeInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InvokeInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.ClientContext != nil { + v := *s.ClientContext + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Client-Context", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.InvocationType) > 0 { + v := s.InvocationType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Invocation-Type", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if len(s.LogType) > 0 { + v := s.LogType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Log-Type", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Payload != nil { + v := s.Payload + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Payload", protocol.BytesStream(v), metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Upon success, returns an empty response. Otherwise, throws an exception. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/InvocationResponse +type InvokeOutput struct { + _ struct{} `type:"structure" payload:"Payload"` + + responseMetadata aws.Response + + // The function version that has been executed. This value is returned only + // if the invocation type is RequestResponse. For more information, see lambda-traffic-shifting-using-aliases. + ExecutedVersion *string `location:"header" locationName:"X-Amz-Executed-Version" min:"1" type:"string"` + + // Indicates whether an error occurred while executing the Lambda function. + // If an error occurred this field will have one of two values; Handled or Unhandled. + // Handled errors are errors that are reported by the function while the Unhandled + // errors are those detected and reported by AWS Lambda. Unhandled errors include + // out of memory errors and function timeouts. For information about how to + // report an Handled error, see Programming Model (http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html). + FunctionError *string `location:"header" locationName:"X-Amz-Function-Error" type:"string"` + + // It is the base64-encoded logs for the Lambda function invocation. This is + // present only if the invocation type is RequestResponse and the logs were + // requested. + LogResult *string `location:"header" locationName:"X-Amz-Log-Result" type:"string"` + + // It is the JSON representation of the object returned by the Lambda function. + // This is present only if the invocation type is RequestResponse. + // + // In the event of a function error this field contains a message describing + // the error. For the Handled errors the Lambda function will report this message. + // For Unhandled errors AWS Lambda reports the message. + Payload []byte `type:"blob"` + + // The HTTP status code will be in the 200 range for successful request. For + // the RequestResponse invocation type this status code will be 200. For the + // Event invocation type this status code will be 202. For the DryRun invocation + // type the status code will be 204. + StatusCode *int64 `location:"statusCode" type:"integer"` +} + +// String returns the string representation +func (s InvokeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InvokeOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s InvokeOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InvokeOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ExecutedVersion != nil { + v := *s.ExecutedVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Executed-Version", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionError != nil { + v := *s.FunctionError + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Function-Error", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.LogResult != nil { + v := *s.LogResult + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "X-Amz-Log-Result", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Payload != nil { + v := s.Payload + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Payload", protocol.BytesStream(v), metadata) + } + // ignoring invalid encode state, StatusCode. StatusCode + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliasesRequest +type ListAliasesInput struct { + _ struct{} `type:"structure"` + + // Lambda function name for which the alias is created. Note that the length + // constraint applies only to the ARN. If you specify only the function name, + // it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // If you specify this optional parameter, the API returns only the aliases + // that are pointing to the specific Lambda function version, otherwise the + // API returns all of the aliases created for the Lambda function. + FunctionVersion *string `location:"querystring" locationName:"FunctionVersion" min:"1" type:"string"` + + // Optional string. An opaque pagination token returned from a previous ListAliases + // operation. If present, indicates where to continue the listing. + Marker *string `location:"querystring" locationName:"Marker" type:"string"` + + // Optional integer. Specifies the maximum number of aliases to return in response. + // This parameter value must be greater than 0. + MaxItems *int64 `location:"querystring" locationName:"MaxItems" min:"1" type:"integer"` +} + +// String returns the string representation +func (s ListAliasesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListAliasesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListAliasesInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListAliasesInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.FunctionVersion != nil && len(*s.FunctionVersion) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionVersion", 1)) + } + if s.MaxItems != nil && *s.MaxItems < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxItems", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListAliasesInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionVersion != nil { + v := *s.FunctionVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "FunctionVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Marker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MaxItems != nil { + v := *s.MaxItems + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "MaxItems", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListAliasesResponse +type ListAliasesOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of aliases. + Aliases []UpdateAliasOutput `type:"list"` + + // A string, present if there are more aliases. + NextMarker *string `type:"string"` +} + +// String returns the string representation +func (s ListAliasesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListAliasesOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListAliasesOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListAliasesOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Aliases) > 0 { + v := s.Aliases + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "Aliases", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.NextMarker != nil { + v := *s.NextMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextMarker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappingsRequest +type ListEventSourceMappingsInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the Amazon Kinesis or DynamoDB stream, + // or an SQS queue. (This parameter is optional.) + EventSourceArn *string `location:"querystring" locationName:"EventSourceArn" type:"string"` + + // The name of the Lambda function. + // + // You can specify the function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). AWS + // Lambda also allows you to specify only the function name with the account + // ID qualifier (for example, account-id:Thumbnail). Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 characters in length. + FunctionName *string `location:"querystring" locationName:"FunctionName" min:"1" type:"string"` + + // Optional string. An opaque pagination token returned from a previous ListEventSourceMappings + // operation. If present, specifies to continue the list from where the returning + // call left off. + Marker *string `location:"querystring" locationName:"Marker" type:"string"` + + // Optional integer. Specifies the maximum number of event sources to return + // in response. This value must be greater than 0. + MaxItems *int64 `location:"querystring" locationName:"MaxItems" min:"1" type:"integer"` +} + +// String returns the string representation +func (s ListEventSourceMappingsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListEventSourceMappingsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListEventSourceMappingsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListEventSourceMappingsInput"} + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.MaxItems != nil && *s.MaxItems < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxItems", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListEventSourceMappingsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.EventSourceArn != nil { + v := *s.EventSourceArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "EventSourceArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Marker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MaxItems != nil { + v := *s.MaxItems + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "MaxItems", protocol.Int64Value(v), metadata) + } + return nil +} + +// Contains a list of event sources (see EventSourceMappingConfiguration) +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListEventSourceMappingsResponse +type ListEventSourceMappingsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // An array of EventSourceMappingConfiguration objects. + EventSourceMappings []UpdateEventSourceMappingOutput `type:"list"` + + // A string, present if there are more event source mappings. + NextMarker *string `type:"string"` +} + +// String returns the string representation +func (s ListEventSourceMappingsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListEventSourceMappingsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListEventSourceMappingsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListEventSourceMappingsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.EventSourceMappings) > 0 { + v := s.EventSourceMappings + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "EventSourceMappings", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.NextMarker != nil { + v := *s.NextMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextMarker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctionsRequest +type ListFunctionsInput struct { + _ struct{} `type:"structure"` + + // Optional string. If not specified, only the unqualified functions ARNs (Amazon + // Resource Names) will be returned. + // + // Valid value: + // + // ALL: Will return all versions, including $LATEST which will have fully qualified + // ARNs (Amazon Resource Names). + FunctionVersion FunctionVersion `location:"querystring" locationName:"FunctionVersion" type:"string" enum:"true"` + + // Optional string. An opaque pagination token returned from a previous ListFunctions + // operation. If present, indicates where to continue the listing. + Marker *string `location:"querystring" locationName:"Marker" type:"string"` + + // Optional string. If not specified, will return only regular function versions + // (i.e., non-replicated versions). + // + // Valid values are: + // + // The region from which the functions are replicated. For example, if you specify + // us-east-1, only functions replicated from that region will be returned. + // + // ALL: Will return all functions from any region. If specified, you also must + // specify a valid FunctionVersion parameter. + MasterRegion *string `location:"querystring" locationName:"MasterRegion" type:"string"` + + // Optional integer. Specifies the maximum number of AWS Lambda functions to + // return in response. This parameter value must be greater than 0. + MaxItems *int64 `location:"querystring" locationName:"MaxItems" min:"1" type:"integer"` +} + +// String returns the string representation +func (s ListFunctionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListFunctionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListFunctionsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListFunctionsInput"} + if s.MaxItems != nil && *s.MaxItems < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxItems", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListFunctionsInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.FunctionVersion) > 0 { + v := s.FunctionVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "FunctionVersion", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Marker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MasterRegion != nil { + v := *s.MasterRegion + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "MasterRegion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MaxItems != nil { + v := *s.MaxItems + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "MaxItems", protocol.Int64Value(v), metadata) + } + return nil +} + +// Contains a list of AWS Lambda function configurations (see FunctionConfiguration. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListFunctionsResponse +type ListFunctionsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of Lambda functions. + Functions []UpdateFunctionConfigurationOutput `type:"list"` + + // A string, present if there are more functions. + NextMarker *string `type:"string"` +} + +// String returns the string representation +func (s ListFunctionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListFunctionsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListFunctionsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListFunctionsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Functions) > 0 { + v := s.Functions + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "Functions", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.NextMarker != nil { + v := *s.NextMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextMarker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTagsRequest +type ListTagsInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the function. For more information, see + // Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListTagsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListTagsInput"} + + if s.Resource == nil { + invalidParams.Add(aws.NewErrParamRequired("Resource")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListTagsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Resource != nil { + v := *s.Resource + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "ARN", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListTagsResponse +type ListTagsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The list of tags assigned to the function. For more information, see Tagging + // Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + Tags map[string]string `type:"map"` +} + +// String returns the string representation +func (s ListTagsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListTagsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListTagsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Tags", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunctionRequest +type ListVersionsByFunctionInput struct { + _ struct{} `type:"structure"` + + // Function name whose versions to list. You can specify a function name (for + // example, Thumbnail) or you can specify Amazon Resource Name (ARN) of the + // function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Optional string. An opaque pagination token returned from a previous ListVersionsByFunction + // operation. If present, indicates where to continue the listing. + Marker *string `location:"querystring" locationName:"Marker" type:"string"` + + // Optional integer. Specifies the maximum number of AWS Lambda function versions + // to return in response. This parameter value must be greater than 0. + MaxItems *int64 `location:"querystring" locationName:"MaxItems" min:"1" type:"integer"` +} + +// String returns the string representation +func (s ListVersionsByFunctionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVersionsByFunctionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListVersionsByFunctionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListVersionsByFunctionInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.MaxItems != nil && *s.MaxItems < 1 { + invalidParams.Add(aws.NewErrParamMinValue("MaxItems", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListVersionsByFunctionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Marker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MaxItems != nil { + v := *s.MaxItems + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "MaxItems", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/ListVersionsByFunctionResponse +type ListVersionsByFunctionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A string, present if there are more function versions. + NextMarker *string `type:"string"` + + // A list of Lambda function versions. + Versions []UpdateFunctionConfigurationOutput `type:"list"` +} + +// String returns the string representation +func (s ListVersionsByFunctionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVersionsByFunctionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListVersionsByFunctionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListVersionsByFunctionOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.NextMarker != nil { + v := *s.NextMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextMarker", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.Versions) > 0 { + v := s.Versions + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "Versions", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PublishVersionRequest +type PublishVersionInput struct { + _ struct{} `type:"structure"` + + // The SHA256 hash of the deployment package you want to publish. This provides + // validation on the code you are publishing. If you provide this parameter, + // the value must match the SHA256 of the $LATEST version for the publication + // to succeed. You can use the DryRun parameter of UpdateFunctionCode to verify + // the hash value that will be returned before publishing your new version. + CodeSha256 *string `type:"string"` + + // The description for the version you are publishing. If not provided, AWS + // Lambda copies the description from the $LATEST version. + Description *string `type:"string"` + + // The Lambda function name. You can specify a function name (for example, Thumbnail) + // or you can specify Amazon Resource Name (ARN) of the function (for example, + // arn:aws:lambda:us-west-2:account-id:function:ThumbNail). AWS Lambda also + // allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `type:"string"` +} + +// String returns the string representation +func (s PublishVersionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PublishVersionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PublishVersionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PublishVersionInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PublishVersionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.CodeSha256 != nil { + v := *s.CodeSha256 + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CodeSha256", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/PutFunctionConcurrencyRequest +type PutFunctionConcurrencyInput struct { + _ struct{} `type:"structure"` + + // The name of the function you are setting concurrent execution limits on. + // For more information, see concurrent-executions. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // The concurrent execution limit reserved for this function. For more information, + // see concurrent-executions. + // + // ReservedConcurrentExecutions is a required field + ReservedConcurrentExecutions *int64 `type:"integer" required:"true"` +} + +// String returns the string representation +func (s PutFunctionConcurrencyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutFunctionConcurrencyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutFunctionConcurrencyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutFunctionConcurrencyInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.ReservedConcurrentExecutions == nil { + invalidParams.Add(aws.NewErrParamRequired("ReservedConcurrentExecutions")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutFunctionConcurrencyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.ReservedConcurrentExecutions != nil { + v := *s.ReservedConcurrentExecutions + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ReservedConcurrentExecutions", protocol.Int64Value(v), metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/Concurrency +type PutFunctionConcurrencyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The number of concurrent executions reserved for this function. For more + // information, see concurrent-executions. + ReservedConcurrentExecutions *int64 `type:"integer"` +} + +// String returns the string representation +func (s PutFunctionConcurrencyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutFunctionConcurrencyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutFunctionConcurrencyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutFunctionConcurrencyOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ReservedConcurrentExecutions != nil { + v := *s.ReservedConcurrentExecutions + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ReservedConcurrentExecutions", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermissionRequest +type RemovePermissionInput struct { + _ struct{} `type:"structure"` + + // Lambda function whose resource policy you want to remove a permission from. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // You can specify this optional parameter to remove permission associated with + // a specific function version or function alias. If you don't specify this + // parameter, the API removes permission associated with the unqualified function + // ARN. + Qualifier *string `location:"querystring" locationName:"Qualifier" min:"1" type:"string"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `location:"querystring" locationName:"RevisionId" type:"string"` + + // Statement ID of the permission to remove. + // + // StatementId is a required field + StatementId *string `location:"uri" locationName:"StatementId" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s RemovePermissionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RemovePermissionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RemovePermissionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RemovePermissionInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.Qualifier != nil && len(*s.Qualifier) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Qualifier", 1)) + } + + if s.StatementId == nil { + invalidParams.Add(aws.NewErrParamRequired("StatementId")) + } + if s.StatementId != nil && len(*s.StatementId) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("StatementId", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RemovePermissionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.StatementId != nil { + v := *s.StatementId + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "StatementId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Qualifier != nil { + v := *s.Qualifier + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "Qualifier", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/RemovePermissionOutput +type RemovePermissionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s RemovePermissionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RemovePermissionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s RemovePermissionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RemovePermissionOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResourceRequest +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the Lambda function. For more information, + // see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` + + // The list of tags (key-value pairs) you are assigning to the Lambda function. + // For more information, see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + // + // Tags is a required field + Tags map[string]string `type:"map" required:"true"` +} + +// String returns the string representation +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "TagResourceInput"} + + if s.Resource == nil { + invalidParams.Add(aws.NewErrParamRequired("Resource")) + } + + if s.Tags == nil { + invalidParams.Add(aws.NewErrParamRequired("Tags")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TagResourceInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.BodyTarget, "Tags", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ms0.End() + + } + if s.Resource != nil { + v := *s.Resource + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "ARN", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TagResourceOutput +type TagResourceOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s TagResourceOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TagResourceOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// The parent object that contains your function's tracing settings. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TracingConfig +type TracingConfig struct { + _ struct{} `type:"structure"` + + // Can be either PassThrough or Active. If PassThrough, Lambda will only trace + // the request from an upstream service if it contains a tracing header with + // "sampled=1". If Active, Lambda will respect any tracing header it receives + // from an upstream service. If no tracing header is received, Lambda will call + // X-Ray for a tracing decision. + Mode TracingMode `type:"string" enum:"true"` +} + +// String returns the string representation +func (s TracingConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TracingConfig) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TracingConfig) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Mode) > 0 { + v := s.Mode + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Mode", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + return nil +} + +// Parent object of the tracing information associated with your Lambda function. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/TracingConfigResponse +type TracingConfigResponse struct { + _ struct{} `type:"structure"` + + // The tracing mode associated with your Lambda function. + Mode TracingMode `type:"string" enum:"true"` +} + +// String returns the string representation +func (s TracingConfigResponse) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TracingConfigResponse) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TracingConfigResponse) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Mode) > 0 { + v := s.Mode + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Mode", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResourceRequest +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The ARN (Amazon Resource Name) of the function. For more information, see + // Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + // + // Resource is a required field + Resource *string `location:"uri" locationName:"ARN" type:"string" required:"true"` + + // The list of tag keys to be deleted from the function. For more information, + // see Tagging Lambda Functions (http://docs.aws.amazon.com/lambda/latest/dg/tagging.html) + // in the AWS Lambda Developer Guide. + // + // TagKeys is a required field + TagKeys []string `location:"querystring" locationName:"tagKeys" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UntagResourceInput"} + + if s.Resource == nil { + invalidParams.Add(aws.NewErrParamRequired("Resource")) + } + + if s.TagKeys == nil { + invalidParams.Add(aws.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UntagResourceInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Resource != nil { + v := *s.Resource + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "ARN", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.TagKeys) > 0 { + v := s.TagKeys + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.QueryTarget, "tagKeys", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UntagResourceOutput +type UntagResourceOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UntagResourceOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UntagResourceOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateAliasRequest +type UpdateAliasInput struct { + _ struct{} `type:"structure"` + + // You can change the description of the alias using this parameter. + Description *string `type:"string"` + + // The function name for which the alias is created. Note that the length constraint + // applies only to the ARN. If you specify only the function name, it is limited + // to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // Using this parameter you can change the Lambda function version to which + // the alias points. + FunctionVersion *string `min:"1" type:"string"` + + // The alias name. + // + // Name is a required field + Name *string `location:"uri" locationName:"Name" min:"1" type:"string" required:"true"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `type:"string"` + + // Specifies an additional version your alias can point to, allowing you to + // dictate what percentage of traffic will invoke each version. For more information, + // see lambda-traffic-shifting-using-aliases. + RoutingConfig *AliasRoutingConfiguration `type:"structure"` +} + +// String returns the string representation +func (s UpdateAliasInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateAliasInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateAliasInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateAliasInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.FunctionVersion != nil && len(*s.FunctionVersion) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionVersion", 1)) + } + + if s.Name == nil { + invalidParams.Add(aws.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Name", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateAliasInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionVersion != nil { + v := *s.FunctionVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RoutingConfig != nil { + v := s.RoutingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "RoutingConfig", v, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Provides configuration information about a Lambda function version alias. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetAliasOutput +type UpdateAliasOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Lambda function ARN that is qualified using the alias name as the suffix. + // For example, if you create an alias called BETA that points to a helloworld + // function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA. + AliasArn *string `type:"string"` + + // Alias description. + Description *string `type:"string"` + + // Function version to which the alias points. + FunctionVersion *string `min:"1" type:"string"` + + // Alias name. + Name *string `min:"1" type:"string"` + + // Represents the latest updated revision of the function or alias. + RevisionId *string `type:"string"` + + // Specifies an additional function versions the alias points to, allowing you + // to dictate what percentage of traffic will invoke each version. For more + // information, see lambda-traffic-shifting-using-aliases. + RoutingConfig *AliasRoutingConfiguration `type:"structure"` +} + +// String returns the string representation +func (s UpdateAliasOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateAliasOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateAliasOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateAliasOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.AliasArn != nil { + v := *s.AliasArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "AliasArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionVersion != nil { + v := *s.FunctionVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.RoutingConfig != nil { + v := s.RoutingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "RoutingConfig", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateEventSourceMappingRequest +type UpdateEventSourceMappingInput struct { + _ struct{} `type:"structure"` + + // The maximum number of stream records that can be sent to your Lambda function + // for a single invocation. + BatchSize *int64 `min:"1" type:"integer"` + + // Specifies whether AWS Lambda should actively poll the stream or not. If disabled, + // AWS Lambda will not poll the stream. + Enabled *bool `type:"boolean"` + + // The Lambda function to which you want the stream records sent. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // If you are using versioning, you can also provide a qualified function ARN + // (ARN that is qualified with function version or alias name as suffix). For + // more information about versioning, see AWS Lambda Function Versioning and + // Aliases (http://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html) + // + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 character in length. + FunctionName *string `min:"1" type:"string"` + + // The event source mapping identifier. + // + // UUID is a required field + UUID *string `location:"uri" locationName:"UUID" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateEventSourceMappingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateEventSourceMappingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateEventSourceMappingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateEventSourceMappingInput"} + if s.BatchSize != nil && *s.BatchSize < 1 { + invalidParams.Add(aws.NewErrParamMinValue("BatchSize", 1)) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + + if s.UUID == nil { + invalidParams.Add(aws.NewErrParamRequired("UUID")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateEventSourceMappingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.BatchSize != nil { + v := *s.BatchSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "BatchSize", protocol.Int64Value(v), metadata) + } + if s.Enabled != nil { + v := *s.Enabled + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Enabled", protocol.BoolValue(v), metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.UUID != nil { + v := *s.UUID + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "UUID", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Describes mapping between an Amazon Kinesis or DynamoDB stream or an Amazon +// SQS queue and a Lambda function. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/GetEventSourceMappingOutput +type UpdateEventSourceMappingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The largest number of records that AWS Lambda will retrieve from your event + // source at the time of invoking your function. Your function receives an event + // with all the retrieved records. + BatchSize *int64 `min:"1" type:"integer"` + + // The Amazon Resource Name (ARN) of the Amazon Kinesis or DynamoDB stream or + // the SQS queue that is the source of events. + EventSourceArn *string `type:"string"` + + // The Lambda function to invoke when AWS Lambda detects an event on the poll-based + // source. + FunctionArn *string `type:"string"` + + // The UTC time string indicating the last time the event mapping was updated. + LastModified *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The result of the last AWS Lambda invocation of your Lambda function. + LastProcessingResult *string `type:"string"` + + // The state of the event source mapping. It can be Creating, Enabled, Disabled, + // Enabling, Disabling, Updating, or Deleting. + State *string `type:"string"` + + // The reason the event source mapping is in its current state. It is either + // user-requested or an AWS Lambda-initiated state transition. + StateTransitionReason *string `type:"string"` + + // The AWS Lambda assigned opaque identifier for the mapping. + UUID *string `type:"string"` +} + +// String returns the string representation +func (s UpdateEventSourceMappingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateEventSourceMappingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateEventSourceMappingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateEventSourceMappingOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.BatchSize != nil { + v := *s.BatchSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "BatchSize", protocol.Int64Value(v), metadata) + } + if s.EventSourceArn != nil { + v := *s.EventSourceArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EventSourceArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionArn != nil { + v := *s.FunctionArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.UnixTimeFormat}, metadata) + } + if s.LastProcessingResult != nil { + v := *s.LastProcessingResult + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastProcessingResult", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.State != nil { + v := *s.State + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "State", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.StateTransitionReason != nil { + v := *s.StateTransitionReason + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StateTransitionReason", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.UUID != nil { + v := *s.UUID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UUID", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCodeRequest +type UpdateFunctionCodeInput struct { + _ struct{} `type:"structure"` + + // This boolean parameter can be used to test your request to AWS Lambda to + // update the Lambda function and publish a version as an atomic operation. + // It will do all necessary computation and validation of your code but will + // not upload it or a publish a version. Each time this operation is invoked, + // the CodeSha256 hash value of the provided code will also be computed and + // returned in the response. + DryRun *bool `type:"boolean"` + + // The existing Lambda function name whose code you want to replace. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 characters in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // This boolean parameter can be used to request AWS Lambda to update the Lambda + // function and publish a version as an atomic operation. + Publish *bool `type:"boolean"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `type:"string"` + + // Amazon S3 bucket name where the .zip file containing your deployment package + // is stored. This bucket must reside in the same AWS Region where you are creating + // the Lambda function. + S3Bucket *string `min:"3" type:"string"` + + // The Amazon S3 object (the deployment package) key name you want to upload. + S3Key *string `min:"1" type:"string"` + + // The Amazon S3 object (the deployment package) version you want to upload. + S3ObjectVersion *string `min:"1" type:"string"` + + // The contents of your zip file containing your deployment package. If you + // are using the web API directly, the contents of the zip file must be base64-encoded. + // If you are using the AWS SDKs or the AWS CLI, the SDKs or CLI will do the + // encoding for you. For more information about creating a .zip file, see Execution + // Permissions (http://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role.html). + // + // ZipFile is automatically base64 encoded/decoded by the SDK. + ZipFile []byte `type:"blob"` +} + +// String returns the string representation +func (s UpdateFunctionCodeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateFunctionCodeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateFunctionCodeInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateFunctionCodeInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.S3Bucket != nil && len(*s.S3Bucket) < 3 { + invalidParams.Add(aws.NewErrParamMinLen("S3Bucket", 3)) + } + if s.S3Key != nil && len(*s.S3Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("S3Key", 1)) + } + if s.S3ObjectVersion != nil && len(*s.S3ObjectVersion) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("S3ObjectVersion", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateFunctionCodeInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.DryRun != nil { + v := *s.DryRun + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DryRun", protocol.BoolValue(v), metadata) + } + if s.Publish != nil { + v := *s.Publish + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Publish", protocol.BoolValue(v), metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.S3Bucket != nil { + v := *s.S3Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3Bucket", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.S3Key != nil { + v := *s.S3Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3Key", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.S3ObjectVersion != nil { + v := *s.S3ObjectVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "S3ObjectVersion", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.ZipFile != nil { + v := s.ZipFile + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ZipFile", protocol.QuotedValue{ValueMarshaler: protocol.BytesValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionConfigurationRequest +type UpdateFunctionConfigurationInput struct { + _ struct{} `type:"structure"` + + // The parent object that contains the target ARN (Amazon Resource Name) of + // an Amazon SQS queue or Amazon SNS topic. For more information, see dlq. + DeadLetterConfig *DeadLetterConfig `type:"structure"` + + // A short user-defined function description. AWS Lambda does not use this value. + // Assign a meaningful description as you see fit. + Description *string `type:"string"` + + // The parent object that contains your environment's configuration settings. + Environment *Environment `type:"structure"` + + // The name of the Lambda function. + // + // You can specify a function name (for example, Thumbnail) or you can specify + // Amazon Resource Name (ARN) of the function (for example, arn:aws:lambda:us-west-2:account-id:function:ThumbNail). + // AWS Lambda also allows you to specify a partial ARN (for example, account-id:Thumbnail). + // Note that the length constraint applies only to the ARN. If you specify only + // the function name, it is limited to 64 character in length. + // + // FunctionName is a required field + FunctionName *string `location:"uri" locationName:"FunctionName" min:"1" type:"string" required:"true"` + + // The function that Lambda calls to begin executing your function. For Node.js, + // it is the module-name.export value in your function. + Handler *string `type:"string"` + + // The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's + // environment variables. If you elect to use the AWS Lambda default service + // key, pass in an empty string ("") for this parameter. + KMSKeyArn *string `type:"string"` + + // The amount of memory, in MB, your Lambda function is given. AWS Lambda uses + // this memory size to infer the amount of CPU allocated to your function. Your + // function use-case determines your CPU and memory requirements. For example, + // a database operation might need less memory compared to an image processing + // function. The default value is 128 MB. The value must be a multiple of 64 + // MB. + MemorySize *int64 `min:"128" type:"integer"` + + // An optional value you can use to ensure you are updating the latest update + // of the function version or alias. If the RevisionID you pass doesn't match + // the latest RevisionId of the function or alias, it will fail with an error + // message, advising you to retrieve the latest function version or alias RevisionID + // using either or . + RevisionId *string `type:"string"` + + // The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when + // it executes your function. + Role *string `type:"string"` + + // The runtime environment for the Lambda function. + // + // To use the Python runtime v3.6, set the value to "python3.6". To use the + // Python runtime v2.7, set the value to "python2.7". To use the Node.js runtime + // v6.10, set the value to "nodejs6.10". To use the Node.js runtime v4.3, set + // the value to "nodejs4.3". To use the .NET Core runtime v1.0, set the value + // to "dotnetcore1.0". To use the .NET Core runtime v2.0, set the value to "dotnetcore2.0". + // + // Node v0.10.42 is currently marked as deprecated. You must migrate existing + // functions to the newer Node.js runtime versions available on AWS Lambda (nodejs4.3 + // or nodejs6.10) as soon as possible. Failure to do so will result in an invalid + // parameter error being returned. Note that you will have to follow this procedure + // for each region that contains functions written in the Node v0.10.42 runtime. + Runtime Runtime `type:"string" enum:"true"` + + // The function execution time at which AWS Lambda should terminate the function. + // Because the execution time has cost implications, we recommend you set this + // value based on your expected execution time. The default is 3 seconds. + Timeout *int64 `min:"1" type:"integer"` + + // The parent object that contains your function's tracing settings. + TracingConfig *TracingConfig `type:"structure"` + + // If your Lambda function accesses resources in a VPC, you provide this parameter + // identifying the list of security group IDs and subnet IDs. These must belong + // to the same VPC. You must provide at least one security group and one subnet + // ID. + VpcConfig *VpcConfig `type:"structure"` +} + +// String returns the string representation +func (s UpdateFunctionConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateFunctionConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateFunctionConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UpdateFunctionConfigurationInput"} + + if s.FunctionName == nil { + invalidParams.Add(aws.NewErrParamRequired("FunctionName")) + } + if s.FunctionName != nil && len(*s.FunctionName) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("FunctionName", 1)) + } + if s.MemorySize != nil && *s.MemorySize < 128 { + invalidParams.Add(aws.NewErrParamMinValue("MemorySize", 128)) + } + if s.Timeout != nil && *s.Timeout < 1 { + invalidParams.Add(aws.NewErrParamMinValue("Timeout", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateFunctionConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.DeadLetterConfig != nil { + v := s.DeadLetterConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "DeadLetterConfig", v, metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Environment != nil { + v := s.Environment + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Environment", v, metadata) + } + if s.Handler != nil { + v := *s.Handler + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Handler", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.KMSKeyArn != nil { + v := *s.KMSKeyArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSKeyArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MemorySize != nil { + v := *s.MemorySize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MemorySize", protocol.Int64Value(v), metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Role != nil { + v := *s.Role + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Role", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.Runtime) > 0 { + v := s.Runtime + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Runtime", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if s.Timeout != nil { + v := *s.Timeout + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Timeout", protocol.Int64Value(v), metadata) + } + if s.TracingConfig != nil { + v := s.TracingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "TracingConfig", v, metadata) + } + if s.VpcConfig != nil { + v := s.VpcConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "VpcConfig", v, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +// A complex type that describes function metadata. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/UpdateFunctionCodeOutput +type UpdateFunctionConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // It is the SHA256 hash of your function deployment package. + CodeSha256 *string `type:"string"` + + // The size, in bytes, of the function .zip file you uploaded. + CodeSize *int64 `type:"long"` + + // The parent object that contains the target ARN (Amazon Resource Name) of + // an Amazon SQS queue or Amazon SNS topic. For more information, see dlq. + DeadLetterConfig *DeadLetterConfig `type:"structure"` + + // The user-provided description. + Description *string `type:"string"` + + // The parent object that contains your environment's configuration settings. + Environment *EnvironmentResponse `type:"structure"` + + // The Amazon Resource Name (ARN) assigned to the function. + FunctionArn *string `type:"string"` + + // The name of the function. Note that the length constraint applies only to + // the ARN. If you specify only the function name, it is limited to 64 characters + // in length. + FunctionName *string `min:"1" type:"string"` + + // The function Lambda calls to begin executing your function. + Handler *string `type:"string"` + + // The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's + // environment variables. If empty, it means you are using the AWS Lambda default + // service key. + KMSKeyArn *string `type:"string"` + + // The time stamp of the last time you updated the function. The time stamp + // is conveyed as a string complying with ISO-8601 in this way YYYY-MM-DDThh:mm:ssTZD + // (e.g., 1997-07-16T19:20:30+01:00). For more information, see Date and Time + // Formats (https://www.w3.org/TR/NOTE-datetime). + LastModified *string `type:"string"` + + // Returns the ARN (Amazon Resource Name) of the master function. + MasterArn *string `type:"string"` + + // The memory size, in MB, you configured for the function. Must be a multiple + // of 64 MB. + MemorySize *int64 `min:"128" type:"integer"` + + // Represents the latest updated revision of the function or alias. + RevisionId *string `type:"string"` + + // The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it + // executes your function to access any other Amazon Web Services (AWS) resources. + Role *string `type:"string"` + + // The runtime environment for the Lambda function. + Runtime Runtime `type:"string" enum:"true"` + + // The function execution time at which Lambda should terminate the function. + // Because the execution time has cost implications, we recommend you set this + // value based on your expected execution time. The default is 3 seconds. + Timeout *int64 `min:"1" type:"integer"` + + // The parent object that contains your function's tracing settings. + TracingConfig *TracingConfigResponse `type:"structure"` + + // The version of the Lambda function. + Version *string `min:"1" type:"string"` + + // VPC configuration associated with your Lambda function. + VpcConfig *VpcConfigResponse `type:"structure"` +} + +// String returns the string representation +func (s UpdateFunctionConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateFunctionConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UpdateFunctionConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UpdateFunctionConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.CodeSha256 != nil { + v := *s.CodeSha256 + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CodeSha256", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.CodeSize != nil { + v := *s.CodeSize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CodeSize", protocol.Int64Value(v), metadata) + } + if s.DeadLetterConfig != nil { + v := s.DeadLetterConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "DeadLetterConfig", v, metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Environment != nil { + v := s.Environment + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Environment", v, metadata) + } + if s.FunctionArn != nil { + v := *s.FunctionArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.FunctionName != nil { + v := *s.FunctionName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FunctionName", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Handler != nil { + v := *s.Handler + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Handler", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.KMSKeyArn != nil { + v := *s.KMSKeyArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSKeyArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MasterArn != nil { + v := *s.MasterArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MasterArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.MemorySize != nil { + v := *s.MemorySize + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MemorySize", protocol.Int64Value(v), metadata) + } + if s.RevisionId != nil { + v := *s.RevisionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RevisionId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.Role != nil { + v := *s.Role + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Role", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if len(s.Runtime) > 0 { + v := s.Runtime + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Runtime", protocol.QuotedValue{ValueMarshaler: v}, metadata) + } + if s.Timeout != nil { + v := *s.Timeout + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Timeout", protocol.Int64Value(v), metadata) + } + if s.TracingConfig != nil { + v := s.TracingConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "TracingConfig", v, metadata) + } + if s.Version != nil { + v := *s.Version + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Version", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + if s.VpcConfig != nil { + v := s.VpcConfig + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "VpcConfig", v, metadata) + } + return nil +} + +// If your Lambda function accesses resources in a VPC, you provide this parameter +// identifying the list of security group IDs and subnet IDs. These must belong +// to the same VPC. You must provide at least one security group and one subnet +// ID. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/VpcConfig +type VpcConfig struct { + _ struct{} `type:"structure"` + + // A list of one or more security groups IDs in your VPC. + SecurityGroupIds []string `type:"list"` + + // A list of one or more subnet IDs in your VPC. + SubnetIds []string `type:"list"` +} + +// String returns the string representation +func (s VpcConfig) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcConfig) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s VpcConfig) MarshalFields(e protocol.FieldEncoder) error { + if len(s.SecurityGroupIds) > 0 { + v := s.SecurityGroupIds + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "SecurityGroupIds", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ls0.End() + + } + if len(s.SubnetIds) > 0 { + v := s.SubnetIds + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "SubnetIds", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ls0.End() + + } + return nil +} + +// VPC configuration associated with your Lambda function. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31/VpcConfigResponse +type VpcConfigResponse struct { + _ struct{} `type:"structure"` + + // A list of security group IDs associated with the Lambda function. + SecurityGroupIds []string `type:"list"` + + // A list of subnet IDs associated with the Lambda function. + SubnetIds []string `type:"list"` + + // The VPC ID associated with you Lambda function. + VpcId *string `type:"string"` +} + +// String returns the string representation +func (s VpcConfigResponse) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VpcConfigResponse) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s VpcConfigResponse) MarshalFields(e protocol.FieldEncoder) error { + if len(s.SecurityGroupIds) > 0 { + v := s.SecurityGroupIds + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "SecurityGroupIds", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ls0.End() + + } + if len(s.SubnetIds) > 0 { + v := s.SubnetIds + + metadata := protocol.Metadata{} + ls0 := e.List(protocol.BodyTarget, "SubnetIds", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)}) + } + ls0.End() + + } + if s.VpcId != nil { + v := *s.VpcId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VpcId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata) + } + return nil +} + +type EventSourcePosition string + +// Enum values for EventSourcePosition +const ( + EventSourcePositionTrimHorizon EventSourcePosition = "TRIM_HORIZON" + EventSourcePositionLatest EventSourcePosition = "LATEST" + EventSourcePositionAtTimestamp EventSourcePosition = "AT_TIMESTAMP" +) + +func (enum EventSourcePosition) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum EventSourcePosition) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type FunctionVersion string + +// Enum values for FunctionVersion +const ( + FunctionVersionAll FunctionVersion = "ALL" +) + +func (enum FunctionVersion) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum FunctionVersion) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type InvocationType string + +// Enum values for InvocationType +const ( + InvocationTypeEvent InvocationType = "Event" + InvocationTypeRequestResponse InvocationType = "RequestResponse" + InvocationTypeDryRun InvocationType = "DryRun" +) + +func (enum InvocationType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum InvocationType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type LogType string + +// Enum values for LogType +const ( + LogTypeNone LogType = "None" + LogTypeTail LogType = "Tail" +) + +func (enum LogType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum LogType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Runtime string + +// Enum values for Runtime +const ( + RuntimeNodejs Runtime = "nodejs" + RuntimeNodejs43 Runtime = "nodejs4.3" + RuntimeNodejs610 Runtime = "nodejs6.10" + RuntimeNodejs810 Runtime = "nodejs8.10" + RuntimeJava8 Runtime = "java8" + RuntimePython27 Runtime = "python2.7" + RuntimePython36 Runtime = "python3.6" + RuntimeDotnetcore10 Runtime = "dotnetcore1.0" + RuntimeDotnetcore20 Runtime = "dotnetcore2.0" + RuntimeDotnetcore21 Runtime = "dotnetcore2.1" + RuntimeNodejs43Edge Runtime = "nodejs4.3-edge" + RuntimeGo1X Runtime = "go1.x" +) + +func (enum Runtime) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Runtime) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ThrottleReason string + +// Enum values for ThrottleReason +const ( + ThrottleReasonConcurrentInvocationLimitExceeded ThrottleReason = "ConcurrentInvocationLimitExceeded" + ThrottleReasonFunctionInvocationRateLimitExceeded ThrottleReason = "FunctionInvocationRateLimitExceeded" + ThrottleReasonReservedFunctionConcurrentInvocationLimitExceeded ThrottleReason = "ReservedFunctionConcurrentInvocationLimitExceeded" + ThrottleReasonReservedFunctionInvocationRateLimitExceeded ThrottleReason = "ReservedFunctionInvocationRateLimitExceeded" + ThrottleReasonCallerRateLimitExceeded ThrottleReason = "CallerRateLimitExceeded" +) + +func (enum ThrottleReason) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ThrottleReason) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type TracingMode string + +// Enum values for TracingMode +const ( + TracingModeActive TracingMode = "Active" + TracingModePassThrough TracingMode = "PassThrough" +) + +func (enum TracingMode) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum TracingMode) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/doc.go new file mode 100644 index 000000000000..5da2c8099e80 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/doc.go @@ -0,0 +1,34 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package lambda provides the client and types for making API +// requests to AWS Lambda. +// +// Overview +// +// This is the AWS Lambda API Reference. The AWS Lambda Developer Guide provides +// additional information. For the service overview, see What is AWS Lambda +// (http://docs.aws.amazon.com/lambda/latest/dg/welcome.html), and for information +// about how the service works, see AWS Lambda: How it Works (http://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html) +// in the AWS Lambda Developer Guide. +// +// See https://docs.aws.amazon.com/goto/WebAPI/lambda-2015-03-31 for more information on this service. +// +// See lambda package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/lambda/ +// +// Using the Client +// +// To AWS Lambda with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the AWS Lambda client Lambda for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/lambda/#New +package lambda diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/errors.go new file mode 100644 index 000000000000..447b49ed1a97 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/errors.go @@ -0,0 +1,170 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package lambda + +const ( + + // ErrCodeCodeStorageExceededException for service response error code + // "CodeStorageExceededException". + // + // You have exceeded your maximum total code size per account. Limits (http://docs.aws.amazon.com/lambda/latest/dg/limits.html) + ErrCodeCodeStorageExceededException = "CodeStorageExceededException" + + // ErrCodeEC2AccessDeniedException for service response error code + // "EC2AccessDeniedException". + ErrCodeEC2AccessDeniedException = "EC2AccessDeniedException" + + // ErrCodeEC2ThrottledException for service response error code + // "EC2ThrottledException". + // + // AWS Lambda was throttled by Amazon EC2 during Lambda function initialization + // using the execution role provided for the Lambda function. + ErrCodeEC2ThrottledException = "EC2ThrottledException" + + // ErrCodeEC2UnexpectedException for service response error code + // "EC2UnexpectedException". + // + // AWS Lambda received an unexpected EC2 client exception while setting up for + // the Lambda function. + ErrCodeEC2UnexpectedException = "EC2UnexpectedException" + + // ErrCodeENILimitReachedException for service response error code + // "ENILimitReachedException". + // + // AWS Lambda was not able to create an Elastic Network Interface (ENI) in the + // VPC, specified as part of Lambda function configuration, because the limit + // for network interfaces has been reached. + ErrCodeENILimitReachedException = "ENILimitReachedException" + + // ErrCodeInvalidParameterValueException for service response error code + // "InvalidParameterValueException". + // + // One of the parameters in the request is invalid. For example, if you provided + // an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration + // API, that AWS Lambda is unable to assume you will get this exception. + ErrCodeInvalidParameterValueException = "InvalidParameterValueException" + + // ErrCodeInvalidRequestContentException for service response error code + // "InvalidRequestContentException". + // + // The request body could not be parsed as JSON. + ErrCodeInvalidRequestContentException = "InvalidRequestContentException" + + // ErrCodeInvalidRuntimeException for service response error code + // "InvalidRuntimeException". + // + // The runtime or runtime version specified is not supported. + ErrCodeInvalidRuntimeException = "InvalidRuntimeException" + + // ErrCodeInvalidSecurityGroupIDException for service response error code + // "InvalidSecurityGroupIDException". + // + // The Security Group ID provided in the Lambda function VPC configuration is + // invalid. + ErrCodeInvalidSecurityGroupIDException = "InvalidSecurityGroupIDException" + + // ErrCodeInvalidSubnetIDException for service response error code + // "InvalidSubnetIDException". + // + // The Subnet ID provided in the Lambda function VPC configuration is invalid. + ErrCodeInvalidSubnetIDException = "InvalidSubnetIDException" + + // ErrCodeInvalidZipFileException for service response error code + // "InvalidZipFileException". + // + // AWS Lambda could not unzip the function zip file. + ErrCodeInvalidZipFileException = "InvalidZipFileException" + + // ErrCodeKMSAccessDeniedException for service response error code + // "KMSAccessDeniedException". + // + // Lambda was unable to decrypt the environment variables because KMS access + // was denied. Check the Lambda function's KMS permissions. + ErrCodeKMSAccessDeniedException = "KMSAccessDeniedException" + + // ErrCodeKMSDisabledException for service response error code + // "KMSDisabledException". + // + // Lambda was unable to decrypt the environment variables because the KMS key + // used is disabled. Check the Lambda function's KMS key settings. + ErrCodeKMSDisabledException = "KMSDisabledException" + + // ErrCodeKMSInvalidStateException for service response error code + // "KMSInvalidStateException". + // + // Lambda was unable to decrypt the environment variables because the KMS key + // used is in an invalid state for Decrypt. Check the function's KMS key settings. + ErrCodeKMSInvalidStateException = "KMSInvalidStateException" + + // ErrCodeKMSNotFoundException for service response error code + // "KMSNotFoundException". + // + // Lambda was unable to decrypt the environment variables because the KMS key + // was not found. Check the function's KMS key settings. + ErrCodeKMSNotFoundException = "KMSNotFoundException" + + // ErrCodePolicyLengthExceededException for service response error code + // "PolicyLengthExceededException". + // + // Lambda function access policy is limited to 20 KB. + ErrCodePolicyLengthExceededException = "PolicyLengthExceededException" + + // ErrCodePreconditionFailedException for service response error code + // "PreconditionFailedException". + // + // The RevisionId provided does not match the latest RevisionId for the Lambda + // function or alias. Call the GetFunction or the GetAlias API to retrieve the + // latest RevisionId for your resource. + ErrCodePreconditionFailedException = "PreconditionFailedException" + + // ErrCodeRequestTooLargeException for service response error code + // "RequestTooLargeException". + // + // The request payload exceeded the Invoke request body JSON input limit. For + // more information, see Limits (http://docs.aws.amazon.com/lambda/latest/dg/limits.html). + ErrCodeRequestTooLargeException = "RequestTooLargeException" + + // ErrCodeResourceConflictException for service response error code + // "ResourceConflictException". + // + // The resource already exists. + ErrCodeResourceConflictException = "ResourceConflictException" + + // ErrCodeResourceInUseException for service response error code + // "ResourceInUseException". + // + // The operation conflicts with the resource's availability. For example, you + // attempted to update an EventSoure Mapping in CREATING, or tried to delete + // a EventSoure mapping currently in the UPDATING state. + ErrCodeResourceInUseException = "ResourceInUseException" + + // ErrCodeResourceNotFoundException for service response error code + // "ResourceNotFoundException". + // + // The resource (for example, a Lambda function or access policy statement) + // specified in the request does not exist. + ErrCodeResourceNotFoundException = "ResourceNotFoundException" + + // ErrCodeServiceException for service response error code + // "ServiceException". + // + // The AWS Lambda service encountered an internal error. + ErrCodeServiceException = "ServiceException" + + // ErrCodeSubnetIPAddressLimitReachedException for service response error code + // "SubnetIPAddressLimitReachedException". + // + // AWS Lambda was not able to set up VPC access for the Lambda function because + // one or more configured subnets has no available IP addresses. + ErrCodeSubnetIPAddressLimitReachedException = "SubnetIPAddressLimitReachedException" + + // ErrCodeTooManyRequestsException for service response error code + // "TooManyRequestsException". + ErrCodeTooManyRequestsException = "TooManyRequestsException" + + // ErrCodeUnsupportedMediaTypeException for service response error code + // "UnsupportedMediaTypeException". + // + // The content type of the Invoke request body is not JSON. + ErrCodeUnsupportedMediaTypeException = "UnsupportedMediaTypeException" +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/service.go b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/service.go new file mode 100644 index 000000000000..6c9a88659299 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/lambda/service.go @@ -0,0 +1,80 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package lambda + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/private/protocol/restjson" +) + +// Lambda provides the API operation methods for making requests to +// AWS Lambda. See this package's package overview docs +// for details on the service. +// +// Lambda methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type Lambda struct { + *aws.Client +} + +// Used for custom client initialization logic +var initClient func(*Lambda) + +// Used for custom request initialization logic +var initRequest func(*Lambda, *aws.Request) + +// Service information constants +const ( + ServiceName = "lambda" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the Lambda client with a config. +// +// Example: +// // Create a Lambda client from just a config. +// svc := lambda.New(myConfig) +func New(config aws.Config) *Lambda { + var signingName string + signingRegion := config.Region + + svc := &Lambda{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + APIVersion: "2015-03-31", + }, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc) + } + + return svc +} + +// newRequest creates a new request for a Lambda operation and runs any +// custom request initialization. +func (c *Lambda) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(c, req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/api.go new file mode 100644 index 000000000000..49c6495781ce --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/api.go @@ -0,0 +1,22564 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package s3 + +import ( + "fmt" + "io" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" + "github.com/aws/aws-sdk-go-v2/private/protocol" + "github.com/aws/aws-sdk-go-v2/private/protocol/restxml" +) + +const opAbortMultipartUpload = "AbortMultipartUpload" + +// AbortMultipartUploadRequest is a API request type for the AbortMultipartUpload API operation. +type AbortMultipartUploadRequest struct { + *aws.Request + Input *AbortMultipartUploadInput + Copy func(*AbortMultipartUploadInput) AbortMultipartUploadRequest +} + +// Send marshals and sends the AbortMultipartUpload API request. +func (r AbortMultipartUploadRequest) Send() (*AbortMultipartUploadOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AbortMultipartUploadOutput), nil +} + +// AbortMultipartUploadRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Aborts a multipart upload. +// +// To verify that all parts have been removed, so you don't get charged for +// the part storage, you should call the List Parts operation and ensure the +// parts list is empty. +// +// // Example sending a request using the AbortMultipartUploadRequest method. +// req := client.AbortMultipartUploadRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload +func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) AbortMultipartUploadRequest { + op := &aws.Operation{ + Name: opAbortMultipartUpload, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &AbortMultipartUploadInput{} + } + + output := &AbortMultipartUploadOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return AbortMultipartUploadRequest{Request: req, Input: input, Copy: c.AbortMultipartUploadRequest} +} + +const opCompleteMultipartUpload = "CompleteMultipartUpload" + +// CompleteMultipartUploadRequest is a API request type for the CompleteMultipartUpload API operation. +type CompleteMultipartUploadRequest struct { + *aws.Request + Input *CompleteMultipartUploadInput + Copy func(*CompleteMultipartUploadInput) CompleteMultipartUploadRequest +} + +// Send marshals and sends the CompleteMultipartUpload API request. +func (r CompleteMultipartUploadRequest) Send() (*CompleteMultipartUploadOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CompleteMultipartUploadOutput), nil +} + +// CompleteMultipartUploadRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Completes a multipart upload by assembling previously uploaded parts. +// +// // Example sending a request using the CompleteMultipartUploadRequest method. +// req := client.CompleteMultipartUploadRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload +func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) CompleteMultipartUploadRequest { + op := &aws.Operation{ + Name: opCompleteMultipartUpload, + HTTPMethod: "POST", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &CompleteMultipartUploadInput{} + } + + output := &CompleteMultipartUploadOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CompleteMultipartUploadRequest{Request: req, Input: input, Copy: c.CompleteMultipartUploadRequest} +} + +const opCopyObject = "CopyObject" + +// CopyObjectRequest is a API request type for the CopyObject API operation. +type CopyObjectRequest struct { + *aws.Request + Input *CopyObjectInput + Copy func(*CopyObjectInput) CopyObjectRequest +} + +// Send marshals and sends the CopyObject API request. +func (r CopyObjectRequest) Send() (*CopyObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CopyObjectOutput), nil +} + +// CopyObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Creates a copy of an object that is already stored in Amazon S3. +// +// // Example sending a request using the CopyObjectRequest method. +// req := client.CopyObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject +func (c *S3) CopyObjectRequest(input *CopyObjectInput) CopyObjectRequest { + op := &aws.Operation{ + Name: opCopyObject, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &CopyObjectInput{} + } + + output := &CopyObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CopyObjectRequest{Request: req, Input: input, Copy: c.CopyObjectRequest} +} + +const opCreateBucket = "CreateBucket" + +// CreateBucketRequest is a API request type for the CreateBucket API operation. +type CreateBucketRequest struct { + *aws.Request + Input *CreateBucketInput + Copy func(*CreateBucketInput) CreateBucketRequest +} + +// Send marshals and sends the CreateBucket API request. +func (r CreateBucketRequest) Send() (*CreateBucketOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateBucketOutput), nil +} + +// CreateBucketRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Creates a new bucket. +// +// // Example sending a request using the CreateBucketRequest method. +// req := client.CreateBucketRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket +func (c *S3) CreateBucketRequest(input *CreateBucketInput) CreateBucketRequest { + op := &aws.Operation{ + Name: opCreateBucket, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}", + } + + if input == nil { + input = &CreateBucketInput{} + } + + output := &CreateBucketOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateBucketRequest{Request: req, Input: input, Copy: c.CreateBucketRequest} +} + +const opCreateMultipartUpload = "CreateMultipartUpload" + +// CreateMultipartUploadRequest is a API request type for the CreateMultipartUpload API operation. +type CreateMultipartUploadRequest struct { + *aws.Request + Input *CreateMultipartUploadInput + Copy func(*CreateMultipartUploadInput) CreateMultipartUploadRequest +} + +// Send marshals and sends the CreateMultipartUpload API request. +func (r CreateMultipartUploadRequest) Send() (*CreateMultipartUploadOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*CreateMultipartUploadOutput), nil +} + +// CreateMultipartUploadRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Initiates a multipart upload and returns an upload ID. +// +// Note: After you initiate multipart upload and upload one or more parts, you +// must either complete or abort multipart upload in order to stop getting charged +// for storage of the uploaded parts. Only after you either complete or abort +// multipart upload, Amazon S3 frees up the parts storage and stops charging +// you for the parts storage. +// +// // Example sending a request using the CreateMultipartUploadRequest method. +// req := client.CreateMultipartUploadRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload +func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) CreateMultipartUploadRequest { + op := &aws.Operation{ + Name: opCreateMultipartUpload, + HTTPMethod: "POST", + HTTPPath: "/{Bucket}/{Key+}?uploads", + } + + if input == nil { + input = &CreateMultipartUploadInput{} + } + + output := &CreateMultipartUploadOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return CreateMultipartUploadRequest{Request: req, Input: input, Copy: c.CreateMultipartUploadRequest} +} + +const opDeleteBucket = "DeleteBucket" + +// DeleteBucketRequest is a API request type for the DeleteBucket API operation. +type DeleteBucketRequest struct { + *aws.Request + Input *DeleteBucketInput + Copy func(*DeleteBucketInput) DeleteBucketRequest +} + +// Send marshals and sends the DeleteBucket API request. +func (r DeleteBucketRequest) Send() (*DeleteBucketOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketOutput), nil +} + +// DeleteBucketRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the bucket. All objects (including all object versions and Delete +// Markers) in the bucket must be deleted before the bucket itself can be deleted. +// +// // Example sending a request using the DeleteBucketRequest method. +// req := client.DeleteBucketRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket +func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) DeleteBucketRequest { + op := &aws.Operation{ + Name: opDeleteBucket, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}", + } + + if input == nil { + input = &DeleteBucketInput{} + } + + output := &DeleteBucketOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketRequest{Request: req, Input: input, Copy: c.DeleteBucketRequest} +} + +const opDeleteBucketAnalyticsConfiguration = "DeleteBucketAnalyticsConfiguration" + +// DeleteBucketAnalyticsConfigurationRequest is a API request type for the DeleteBucketAnalyticsConfiguration API operation. +type DeleteBucketAnalyticsConfigurationRequest struct { + *aws.Request + Input *DeleteBucketAnalyticsConfigurationInput + Copy func(*DeleteBucketAnalyticsConfigurationInput) DeleteBucketAnalyticsConfigurationRequest +} + +// Send marshals and sends the DeleteBucketAnalyticsConfiguration API request. +func (r DeleteBucketAnalyticsConfigurationRequest) Send() (*DeleteBucketAnalyticsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketAnalyticsConfigurationOutput), nil +} + +// DeleteBucketAnalyticsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes an analytics configuration for the bucket (specified by the analytics +// configuration ID). +// +// // Example sending a request using the DeleteBucketAnalyticsConfigurationRequest method. +// req := client.DeleteBucketAnalyticsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration +func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyticsConfigurationInput) DeleteBucketAnalyticsConfigurationRequest { + op := &aws.Operation{ + Name: opDeleteBucketAnalyticsConfiguration, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?analytics", + } + + if input == nil { + input = &DeleteBucketAnalyticsConfigurationInput{} + } + + output := &DeleteBucketAnalyticsConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketAnalyticsConfigurationRequest{Request: req, Input: input, Copy: c.DeleteBucketAnalyticsConfigurationRequest} +} + +const opDeleteBucketCors = "DeleteBucketCors" + +// DeleteBucketCorsRequest is a API request type for the DeleteBucketCors API operation. +type DeleteBucketCorsRequest struct { + *aws.Request + Input *DeleteBucketCorsInput + Copy func(*DeleteBucketCorsInput) DeleteBucketCorsRequest +} + +// Send marshals and sends the DeleteBucketCors API request. +func (r DeleteBucketCorsRequest) Send() (*DeleteBucketCorsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketCorsOutput), nil +} + +// DeleteBucketCorsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the cors configuration information set for the bucket. +// +// // Example sending a request using the DeleteBucketCorsRequest method. +// req := client.DeleteBucketCorsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors +func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) DeleteBucketCorsRequest { + op := &aws.Operation{ + Name: opDeleteBucketCors, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?cors", + } + + if input == nil { + input = &DeleteBucketCorsInput{} + } + + output := &DeleteBucketCorsOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketCorsRequest{Request: req, Input: input, Copy: c.DeleteBucketCorsRequest} +} + +const opDeleteBucketEncryption = "DeleteBucketEncryption" + +// DeleteBucketEncryptionRequest is a API request type for the DeleteBucketEncryption API operation. +type DeleteBucketEncryptionRequest struct { + *aws.Request + Input *DeleteBucketEncryptionInput + Copy func(*DeleteBucketEncryptionInput) DeleteBucketEncryptionRequest +} + +// Send marshals and sends the DeleteBucketEncryption API request. +func (r DeleteBucketEncryptionRequest) Send() (*DeleteBucketEncryptionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketEncryptionOutput), nil +} + +// DeleteBucketEncryptionRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the server-side encryption configuration from the bucket. +// +// // Example sending a request using the DeleteBucketEncryptionRequest method. +// req := client.DeleteBucketEncryptionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryption +func (c *S3) DeleteBucketEncryptionRequest(input *DeleteBucketEncryptionInput) DeleteBucketEncryptionRequest { + op := &aws.Operation{ + Name: opDeleteBucketEncryption, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?encryption", + } + + if input == nil { + input = &DeleteBucketEncryptionInput{} + } + + output := &DeleteBucketEncryptionOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketEncryptionRequest{Request: req, Input: input, Copy: c.DeleteBucketEncryptionRequest} +} + +const opDeleteBucketInventoryConfiguration = "DeleteBucketInventoryConfiguration" + +// DeleteBucketInventoryConfigurationRequest is a API request type for the DeleteBucketInventoryConfiguration API operation. +type DeleteBucketInventoryConfigurationRequest struct { + *aws.Request + Input *DeleteBucketInventoryConfigurationInput + Copy func(*DeleteBucketInventoryConfigurationInput) DeleteBucketInventoryConfigurationRequest +} + +// Send marshals and sends the DeleteBucketInventoryConfiguration API request. +func (r DeleteBucketInventoryConfigurationRequest) Send() (*DeleteBucketInventoryConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketInventoryConfigurationOutput), nil +} + +// DeleteBucketInventoryConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes an inventory configuration (identified by the inventory ID) from +// the bucket. +// +// // Example sending a request using the DeleteBucketInventoryConfigurationRequest method. +// req := client.DeleteBucketInventoryConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration +func (c *S3) DeleteBucketInventoryConfigurationRequest(input *DeleteBucketInventoryConfigurationInput) DeleteBucketInventoryConfigurationRequest { + op := &aws.Operation{ + Name: opDeleteBucketInventoryConfiguration, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?inventory", + } + + if input == nil { + input = &DeleteBucketInventoryConfigurationInput{} + } + + output := &DeleteBucketInventoryConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketInventoryConfigurationRequest{Request: req, Input: input, Copy: c.DeleteBucketInventoryConfigurationRequest} +} + +const opDeleteBucketLifecycle = "DeleteBucketLifecycle" + +// DeleteBucketLifecycleRequest is a API request type for the DeleteBucketLifecycle API operation. +type DeleteBucketLifecycleRequest struct { + *aws.Request + Input *DeleteBucketLifecycleInput + Copy func(*DeleteBucketLifecycleInput) DeleteBucketLifecycleRequest +} + +// Send marshals and sends the DeleteBucketLifecycle API request. +func (r DeleteBucketLifecycleRequest) Send() (*DeleteBucketLifecycleOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketLifecycleOutput), nil +} + +// DeleteBucketLifecycleRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the lifecycle configuration from the bucket. +// +// // Example sending a request using the DeleteBucketLifecycleRequest method. +// req := client.DeleteBucketLifecycleRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle +func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) DeleteBucketLifecycleRequest { + op := &aws.Operation{ + Name: opDeleteBucketLifecycle, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?lifecycle", + } + + if input == nil { + input = &DeleteBucketLifecycleInput{} + } + + output := &DeleteBucketLifecycleOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketLifecycleRequest{Request: req, Input: input, Copy: c.DeleteBucketLifecycleRequest} +} + +const opDeleteBucketMetricsConfiguration = "DeleteBucketMetricsConfiguration" + +// DeleteBucketMetricsConfigurationRequest is a API request type for the DeleteBucketMetricsConfiguration API operation. +type DeleteBucketMetricsConfigurationRequest struct { + *aws.Request + Input *DeleteBucketMetricsConfigurationInput + Copy func(*DeleteBucketMetricsConfigurationInput) DeleteBucketMetricsConfigurationRequest +} + +// Send marshals and sends the DeleteBucketMetricsConfiguration API request. +func (r DeleteBucketMetricsConfigurationRequest) Send() (*DeleteBucketMetricsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketMetricsConfigurationOutput), nil +} + +// DeleteBucketMetricsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes a metrics configuration (specified by the metrics configuration ID) +// from the bucket. +// +// // Example sending a request using the DeleteBucketMetricsConfigurationRequest method. +// req := client.DeleteBucketMetricsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration +func (c *S3) DeleteBucketMetricsConfigurationRequest(input *DeleteBucketMetricsConfigurationInput) DeleteBucketMetricsConfigurationRequest { + op := &aws.Operation{ + Name: opDeleteBucketMetricsConfiguration, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?metrics", + } + + if input == nil { + input = &DeleteBucketMetricsConfigurationInput{} + } + + output := &DeleteBucketMetricsConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketMetricsConfigurationRequest{Request: req, Input: input, Copy: c.DeleteBucketMetricsConfigurationRequest} +} + +const opDeleteBucketPolicy = "DeleteBucketPolicy" + +// DeleteBucketPolicyRequest is a API request type for the DeleteBucketPolicy API operation. +type DeleteBucketPolicyRequest struct { + *aws.Request + Input *DeleteBucketPolicyInput + Copy func(*DeleteBucketPolicyInput) DeleteBucketPolicyRequest +} + +// Send marshals and sends the DeleteBucketPolicy API request. +func (r DeleteBucketPolicyRequest) Send() (*DeleteBucketPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketPolicyOutput), nil +} + +// DeleteBucketPolicyRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the policy from the bucket. +// +// // Example sending a request using the DeleteBucketPolicyRequest method. +// req := client.DeleteBucketPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy +func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) DeleteBucketPolicyRequest { + op := &aws.Operation{ + Name: opDeleteBucketPolicy, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?policy", + } + + if input == nil { + input = &DeleteBucketPolicyInput{} + } + + output := &DeleteBucketPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketPolicyRequest{Request: req, Input: input, Copy: c.DeleteBucketPolicyRequest} +} + +const opDeleteBucketReplication = "DeleteBucketReplication" + +// DeleteBucketReplicationRequest is a API request type for the DeleteBucketReplication API operation. +type DeleteBucketReplicationRequest struct { + *aws.Request + Input *DeleteBucketReplicationInput + Copy func(*DeleteBucketReplicationInput) DeleteBucketReplicationRequest +} + +// Send marshals and sends the DeleteBucketReplication API request. +func (r DeleteBucketReplicationRequest) Send() (*DeleteBucketReplicationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketReplicationOutput), nil +} + +// DeleteBucketReplicationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the replication configuration from the bucket. +// +// // Example sending a request using the DeleteBucketReplicationRequest method. +// req := client.DeleteBucketReplicationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication +func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) DeleteBucketReplicationRequest { + op := &aws.Operation{ + Name: opDeleteBucketReplication, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?replication", + } + + if input == nil { + input = &DeleteBucketReplicationInput{} + } + + output := &DeleteBucketReplicationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketReplicationRequest{Request: req, Input: input, Copy: c.DeleteBucketReplicationRequest} +} + +const opDeleteBucketTagging = "DeleteBucketTagging" + +// DeleteBucketTaggingRequest is a API request type for the DeleteBucketTagging API operation. +type DeleteBucketTaggingRequest struct { + *aws.Request + Input *DeleteBucketTaggingInput + Copy func(*DeleteBucketTaggingInput) DeleteBucketTaggingRequest +} + +// Send marshals and sends the DeleteBucketTagging API request. +func (r DeleteBucketTaggingRequest) Send() (*DeleteBucketTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketTaggingOutput), nil +} + +// DeleteBucketTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deletes the tags from the bucket. +// +// // Example sending a request using the DeleteBucketTaggingRequest method. +// req := client.DeleteBucketTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging +func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) DeleteBucketTaggingRequest { + op := &aws.Operation{ + Name: opDeleteBucketTagging, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?tagging", + } + + if input == nil { + input = &DeleteBucketTaggingInput{} + } + + output := &DeleteBucketTaggingOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketTaggingRequest{Request: req, Input: input, Copy: c.DeleteBucketTaggingRequest} +} + +const opDeleteBucketWebsite = "DeleteBucketWebsite" + +// DeleteBucketWebsiteRequest is a API request type for the DeleteBucketWebsite API operation. +type DeleteBucketWebsiteRequest struct { + *aws.Request + Input *DeleteBucketWebsiteInput + Copy func(*DeleteBucketWebsiteInput) DeleteBucketWebsiteRequest +} + +// Send marshals and sends the DeleteBucketWebsite API request. +func (r DeleteBucketWebsiteRequest) Send() (*DeleteBucketWebsiteOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteBucketWebsiteOutput), nil +} + +// DeleteBucketWebsiteRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// This operation removes the website configuration from the bucket. +// +// // Example sending a request using the DeleteBucketWebsiteRequest method. +// req := client.DeleteBucketWebsiteRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite +func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) DeleteBucketWebsiteRequest { + op := &aws.Operation{ + Name: opDeleteBucketWebsite, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}?website", + } + + if input == nil { + input = &DeleteBucketWebsiteInput{} + } + + output := &DeleteBucketWebsiteOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return DeleteBucketWebsiteRequest{Request: req, Input: input, Copy: c.DeleteBucketWebsiteRequest} +} + +const opDeleteObject = "DeleteObject" + +// DeleteObjectRequest is a API request type for the DeleteObject API operation. +type DeleteObjectRequest struct { + *aws.Request + Input *DeleteObjectInput + Copy func(*DeleteObjectInput) DeleteObjectRequest +} + +// Send marshals and sends the DeleteObject API request. +func (r DeleteObjectRequest) Send() (*DeleteObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteObjectOutput), nil +} + +// DeleteObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Removes the null version (if there is one) of an object and inserts a delete +// marker, which becomes the latest version of the object. If there isn't a +// null version, Amazon S3 does not remove any objects. +// +// // Example sending a request using the DeleteObjectRequest method. +// req := client.DeleteObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject +func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) DeleteObjectRequest { + op := &aws.Operation{ + Name: opDeleteObject, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &DeleteObjectInput{} + } + + output := &DeleteObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteObjectRequest{Request: req, Input: input, Copy: c.DeleteObjectRequest} +} + +const opDeleteObjectTagging = "DeleteObjectTagging" + +// DeleteObjectTaggingRequest is a API request type for the DeleteObjectTagging API operation. +type DeleteObjectTaggingRequest struct { + *aws.Request + Input *DeleteObjectTaggingInput + Copy func(*DeleteObjectTaggingInput) DeleteObjectTaggingRequest +} + +// Send marshals and sends the DeleteObjectTagging API request. +func (r DeleteObjectTaggingRequest) Send() (*DeleteObjectTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteObjectTaggingOutput), nil +} + +// DeleteObjectTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Removes the tag-set from an existing object. +// +// // Example sending a request using the DeleteObjectTaggingRequest method. +// req := client.DeleteObjectTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging +func (c *S3) DeleteObjectTaggingRequest(input *DeleteObjectTaggingInput) DeleteObjectTaggingRequest { + op := &aws.Operation{ + Name: opDeleteObjectTagging, + HTTPMethod: "DELETE", + HTTPPath: "/{Bucket}/{Key+}?tagging", + } + + if input == nil { + input = &DeleteObjectTaggingInput{} + } + + output := &DeleteObjectTaggingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteObjectTaggingRequest{Request: req, Input: input, Copy: c.DeleteObjectTaggingRequest} +} + +const opDeleteObjects = "DeleteObjects" + +// DeleteObjectsRequest is a API request type for the DeleteObjects API operation. +type DeleteObjectsRequest struct { + *aws.Request + Input *DeleteObjectsInput + Copy func(*DeleteObjectsInput) DeleteObjectsRequest +} + +// Send marshals and sends the DeleteObjects API request. +func (r DeleteObjectsRequest) Send() (*DeleteObjectsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DeleteObjectsOutput), nil +} + +// DeleteObjectsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// This operation enables you to delete multiple objects from a bucket using +// a single HTTP request. You may specify up to 1000 keys. +// +// // Example sending a request using the DeleteObjectsRequest method. +// req := client.DeleteObjectsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects +func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) DeleteObjectsRequest { + op := &aws.Operation{ + Name: opDeleteObjects, + HTTPMethod: "POST", + HTTPPath: "/{Bucket}?delete", + } + + if input == nil { + input = &DeleteObjectsInput{} + } + + output := &DeleteObjectsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DeleteObjectsRequest{Request: req, Input: input, Copy: c.DeleteObjectsRequest} +} + +const opGetBucketAccelerateConfiguration = "GetBucketAccelerateConfiguration" + +// GetBucketAccelerateConfigurationRequest is a API request type for the GetBucketAccelerateConfiguration API operation. +type GetBucketAccelerateConfigurationRequest struct { + *aws.Request + Input *GetBucketAccelerateConfigurationInput + Copy func(*GetBucketAccelerateConfigurationInput) GetBucketAccelerateConfigurationRequest +} + +// Send marshals and sends the GetBucketAccelerateConfiguration API request. +func (r GetBucketAccelerateConfigurationRequest) Send() (*GetBucketAccelerateConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketAccelerateConfigurationOutput), nil +} + +// GetBucketAccelerateConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the accelerate configuration of a bucket. +// +// // Example sending a request using the GetBucketAccelerateConfigurationRequest method. +// req := client.GetBucketAccelerateConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration +func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateConfigurationInput) GetBucketAccelerateConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketAccelerateConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?accelerate", + } + + if input == nil { + input = &GetBucketAccelerateConfigurationInput{} + } + + output := &GetBucketAccelerateConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketAccelerateConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketAccelerateConfigurationRequest} +} + +const opGetBucketAcl = "GetBucketAcl" + +// GetBucketAclRequest is a API request type for the GetBucketAcl API operation. +type GetBucketAclRequest struct { + *aws.Request + Input *GetBucketAclInput + Copy func(*GetBucketAclInput) GetBucketAclRequest +} + +// Send marshals and sends the GetBucketAcl API request. +func (r GetBucketAclRequest) Send() (*GetBucketAclOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketAclOutput), nil +} + +// GetBucketAclRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Gets the access control policy for the bucket. +// +// // Example sending a request using the GetBucketAclRequest method. +// req := client.GetBucketAclRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl +func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) GetBucketAclRequest { + op := &aws.Operation{ + Name: opGetBucketAcl, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?acl", + } + + if input == nil { + input = &GetBucketAclInput{} + } + + output := &GetBucketAclOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketAclRequest{Request: req, Input: input, Copy: c.GetBucketAclRequest} +} + +const opGetBucketAnalyticsConfiguration = "GetBucketAnalyticsConfiguration" + +// GetBucketAnalyticsConfigurationRequest is a API request type for the GetBucketAnalyticsConfiguration API operation. +type GetBucketAnalyticsConfigurationRequest struct { + *aws.Request + Input *GetBucketAnalyticsConfigurationInput + Copy func(*GetBucketAnalyticsConfigurationInput) GetBucketAnalyticsConfigurationRequest +} + +// Send marshals and sends the GetBucketAnalyticsConfiguration API request. +func (r GetBucketAnalyticsConfigurationRequest) Send() (*GetBucketAnalyticsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketAnalyticsConfigurationOutput), nil +} + +// GetBucketAnalyticsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Gets an analytics configuration for the bucket (specified by the analytics +// configuration ID). +// +// // Example sending a request using the GetBucketAnalyticsConfigurationRequest method. +// req := client.GetBucketAnalyticsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration +func (c *S3) GetBucketAnalyticsConfigurationRequest(input *GetBucketAnalyticsConfigurationInput) GetBucketAnalyticsConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketAnalyticsConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?analytics", + } + + if input == nil { + input = &GetBucketAnalyticsConfigurationInput{} + } + + output := &GetBucketAnalyticsConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketAnalyticsConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketAnalyticsConfigurationRequest} +} + +const opGetBucketCors = "GetBucketCors" + +// GetBucketCorsRequest is a API request type for the GetBucketCors API operation. +type GetBucketCorsRequest struct { + *aws.Request + Input *GetBucketCorsInput + Copy func(*GetBucketCorsInput) GetBucketCorsRequest +} + +// Send marshals and sends the GetBucketCors API request. +func (r GetBucketCorsRequest) Send() (*GetBucketCorsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketCorsOutput), nil +} + +// GetBucketCorsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the cors configuration for the bucket. +// +// // Example sending a request using the GetBucketCorsRequest method. +// req := client.GetBucketCorsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors +func (c *S3) GetBucketCorsRequest(input *GetBucketCorsInput) GetBucketCorsRequest { + op := &aws.Operation{ + Name: opGetBucketCors, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?cors", + } + + if input == nil { + input = &GetBucketCorsInput{} + } + + output := &GetBucketCorsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketCorsRequest{Request: req, Input: input, Copy: c.GetBucketCorsRequest} +} + +const opGetBucketEncryption = "GetBucketEncryption" + +// GetBucketEncryptionRequest is a API request type for the GetBucketEncryption API operation. +type GetBucketEncryptionRequest struct { + *aws.Request + Input *GetBucketEncryptionInput + Copy func(*GetBucketEncryptionInput) GetBucketEncryptionRequest +} + +// Send marshals and sends the GetBucketEncryption API request. +func (r GetBucketEncryptionRequest) Send() (*GetBucketEncryptionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketEncryptionOutput), nil +} + +// GetBucketEncryptionRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the server-side encryption configuration of a bucket. +// +// // Example sending a request using the GetBucketEncryptionRequest method. +// req := client.GetBucketEncryptionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryption +func (c *S3) GetBucketEncryptionRequest(input *GetBucketEncryptionInput) GetBucketEncryptionRequest { + op := &aws.Operation{ + Name: opGetBucketEncryption, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?encryption", + } + + if input == nil { + input = &GetBucketEncryptionInput{} + } + + output := &GetBucketEncryptionOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketEncryptionRequest{Request: req, Input: input, Copy: c.GetBucketEncryptionRequest} +} + +const opGetBucketInventoryConfiguration = "GetBucketInventoryConfiguration" + +// GetBucketInventoryConfigurationRequest is a API request type for the GetBucketInventoryConfiguration API operation. +type GetBucketInventoryConfigurationRequest struct { + *aws.Request + Input *GetBucketInventoryConfigurationInput + Copy func(*GetBucketInventoryConfigurationInput) GetBucketInventoryConfigurationRequest +} + +// Send marshals and sends the GetBucketInventoryConfiguration API request. +func (r GetBucketInventoryConfigurationRequest) Send() (*GetBucketInventoryConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketInventoryConfigurationOutput), nil +} + +// GetBucketInventoryConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns an inventory configuration (identified by the inventory ID) from +// the bucket. +// +// // Example sending a request using the GetBucketInventoryConfigurationRequest method. +// req := client.GetBucketInventoryConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration +func (c *S3) GetBucketInventoryConfigurationRequest(input *GetBucketInventoryConfigurationInput) GetBucketInventoryConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketInventoryConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?inventory", + } + + if input == nil { + input = &GetBucketInventoryConfigurationInput{} + } + + output := &GetBucketInventoryConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketInventoryConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketInventoryConfigurationRequest} +} + +const opGetBucketLifecycle = "GetBucketLifecycle" + +// GetBucketLifecycleRequest is a API request type for the GetBucketLifecycle API operation. +type GetBucketLifecycleRequest struct { + *aws.Request + Input *GetBucketLifecycleInput + Copy func(*GetBucketLifecycleInput) GetBucketLifecycleRequest +} + +// Send marshals and sends the GetBucketLifecycle API request. +func (r GetBucketLifecycleRequest) Send() (*GetBucketLifecycleOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketLifecycleOutput), nil +} + +// GetBucketLifecycleRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deprecated, see the GetBucketLifecycleConfiguration operation. +// +// // Example sending a request using the GetBucketLifecycleRequest method. +// req := client.GetBucketLifecycleRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle +func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) GetBucketLifecycleRequest { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, GetBucketLifecycle, has been deprecated") + } + op := &aws.Operation{ + Name: opGetBucketLifecycle, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?lifecycle", + } + + if input == nil { + input = &GetBucketLifecycleInput{} + } + + output := &GetBucketLifecycleOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketLifecycleRequest{Request: req, Input: input, Copy: c.GetBucketLifecycleRequest} +} + +const opGetBucketLifecycleConfiguration = "GetBucketLifecycleConfiguration" + +// GetBucketLifecycleConfigurationRequest is a API request type for the GetBucketLifecycleConfiguration API operation. +type GetBucketLifecycleConfigurationRequest struct { + *aws.Request + Input *GetBucketLifecycleConfigurationInput + Copy func(*GetBucketLifecycleConfigurationInput) GetBucketLifecycleConfigurationRequest +} + +// Send marshals and sends the GetBucketLifecycleConfiguration API request. +func (r GetBucketLifecycleConfigurationRequest) Send() (*GetBucketLifecycleConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketLifecycleConfigurationOutput), nil +} + +// GetBucketLifecycleConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the lifecycle configuration information set on the bucket. +// +// // Example sending a request using the GetBucketLifecycleConfigurationRequest method. +// req := client.GetBucketLifecycleConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration +func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleConfigurationInput) GetBucketLifecycleConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketLifecycleConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?lifecycle", + } + + if input == nil { + input = &GetBucketLifecycleConfigurationInput{} + } + + output := &GetBucketLifecycleConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketLifecycleConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketLifecycleConfigurationRequest} +} + +const opGetBucketLocation = "GetBucketLocation" + +// GetBucketLocationRequest is a API request type for the GetBucketLocation API operation. +type GetBucketLocationRequest struct { + *aws.Request + Input *GetBucketLocationInput + Copy func(*GetBucketLocationInput) GetBucketLocationRequest +} + +// Send marshals and sends the GetBucketLocation API request. +func (r GetBucketLocationRequest) Send() (*GetBucketLocationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketLocationOutput), nil +} + +// GetBucketLocationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the region the bucket resides in. +// +// // Example sending a request using the GetBucketLocationRequest method. +// req := client.GetBucketLocationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation +func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) GetBucketLocationRequest { + op := &aws.Operation{ + Name: opGetBucketLocation, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?location", + } + + if input == nil { + input = &GetBucketLocationInput{} + } + + output := &GetBucketLocationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketLocationRequest{Request: req, Input: input, Copy: c.GetBucketLocationRequest} +} + +const opGetBucketLogging = "GetBucketLogging" + +// GetBucketLoggingRequest is a API request type for the GetBucketLogging API operation. +type GetBucketLoggingRequest struct { + *aws.Request + Input *GetBucketLoggingInput + Copy func(*GetBucketLoggingInput) GetBucketLoggingRequest +} + +// Send marshals and sends the GetBucketLogging API request. +func (r GetBucketLoggingRequest) Send() (*GetBucketLoggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketLoggingOutput), nil +} + +// GetBucketLoggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the logging status of a bucket and the permissions users have to +// view and modify that status. To use GET, you must be the bucket owner. +// +// // Example sending a request using the GetBucketLoggingRequest method. +// req := client.GetBucketLoggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging +func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) GetBucketLoggingRequest { + op := &aws.Operation{ + Name: opGetBucketLogging, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?logging", + } + + if input == nil { + input = &GetBucketLoggingInput{} + } + + output := &GetBucketLoggingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketLoggingRequest{Request: req, Input: input, Copy: c.GetBucketLoggingRequest} +} + +const opGetBucketMetricsConfiguration = "GetBucketMetricsConfiguration" + +// GetBucketMetricsConfigurationRequest is a API request type for the GetBucketMetricsConfiguration API operation. +type GetBucketMetricsConfigurationRequest struct { + *aws.Request + Input *GetBucketMetricsConfigurationInput + Copy func(*GetBucketMetricsConfigurationInput) GetBucketMetricsConfigurationRequest +} + +// Send marshals and sends the GetBucketMetricsConfiguration API request. +func (r GetBucketMetricsConfigurationRequest) Send() (*GetBucketMetricsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketMetricsConfigurationOutput), nil +} + +// GetBucketMetricsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Gets a metrics configuration (specified by the metrics configuration ID) +// from the bucket. +// +// // Example sending a request using the GetBucketMetricsConfigurationRequest method. +// req := client.GetBucketMetricsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration +func (c *S3) GetBucketMetricsConfigurationRequest(input *GetBucketMetricsConfigurationInput) GetBucketMetricsConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketMetricsConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?metrics", + } + + if input == nil { + input = &GetBucketMetricsConfigurationInput{} + } + + output := &GetBucketMetricsConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketMetricsConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketMetricsConfigurationRequest} +} + +const opGetBucketNotification = "GetBucketNotification" + +// GetBucketNotificationRequest is a API request type for the GetBucketNotification API operation. +type GetBucketNotificationRequest struct { + *aws.Request + Input *GetBucketNotificationConfigurationInput + Copy func(*GetBucketNotificationConfigurationInput) GetBucketNotificationRequest +} + +// Send marshals and sends the GetBucketNotification API request. +func (r GetBucketNotificationRequest) Send() (*GetBucketNotificationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketNotificationOutput), nil +} + +// GetBucketNotificationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deprecated, see the GetBucketNotificationConfiguration operation. +// +// // Example sending a request using the GetBucketNotificationRequest method. +// req := client.GetBucketNotificationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification +func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurationInput) GetBucketNotificationRequest { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, GetBucketNotification, has been deprecated") + } + op := &aws.Operation{ + Name: opGetBucketNotification, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?notification", + } + + if input == nil { + input = &GetBucketNotificationConfigurationInput{} + } + + output := &GetBucketNotificationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketNotificationRequest{Request: req, Input: input, Copy: c.GetBucketNotificationRequest} +} + +const opGetBucketNotificationConfiguration = "GetBucketNotificationConfiguration" + +// GetBucketNotificationConfigurationRequest is a API request type for the GetBucketNotificationConfiguration API operation. +type GetBucketNotificationConfigurationRequest struct { + *aws.Request + Input *GetBucketNotificationConfigurationInput + Copy func(*GetBucketNotificationConfigurationInput) GetBucketNotificationConfigurationRequest +} + +// Send marshals and sends the GetBucketNotificationConfiguration API request. +func (r GetBucketNotificationConfigurationRequest) Send() (*GetBucketNotificationConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketNotificationConfigurationOutput), nil +} + +// GetBucketNotificationConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the notification configuration of a bucket. +// +// // Example sending a request using the GetBucketNotificationConfigurationRequest method. +// req := client.GetBucketNotificationConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration +func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificationConfigurationInput) GetBucketNotificationConfigurationRequest { + op := &aws.Operation{ + Name: opGetBucketNotificationConfiguration, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?notification", + } + + if input == nil { + input = &GetBucketNotificationConfigurationInput{} + } + + output := &GetBucketNotificationConfigurationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketNotificationConfigurationRequest{Request: req, Input: input, Copy: c.GetBucketNotificationConfigurationRequest} +} + +const opGetBucketPolicy = "GetBucketPolicy" + +// GetBucketPolicyRequest is a API request type for the GetBucketPolicy API operation. +type GetBucketPolicyRequest struct { + *aws.Request + Input *GetBucketPolicyInput + Copy func(*GetBucketPolicyInput) GetBucketPolicyRequest +} + +// Send marshals and sends the GetBucketPolicy API request. +func (r GetBucketPolicyRequest) Send() (*GetBucketPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketPolicyOutput), nil +} + +// GetBucketPolicyRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the policy of a specified bucket. +// +// // Example sending a request using the GetBucketPolicyRequest method. +// req := client.GetBucketPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy +func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) GetBucketPolicyRequest { + op := &aws.Operation{ + Name: opGetBucketPolicy, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?policy", + } + + if input == nil { + input = &GetBucketPolicyInput{} + } + + output := &GetBucketPolicyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketPolicyRequest{Request: req, Input: input, Copy: c.GetBucketPolicyRequest} +} + +const opGetBucketReplication = "GetBucketReplication" + +// GetBucketReplicationRequest is a API request type for the GetBucketReplication API operation. +type GetBucketReplicationRequest struct { + *aws.Request + Input *GetBucketReplicationInput + Copy func(*GetBucketReplicationInput) GetBucketReplicationRequest +} + +// Send marshals and sends the GetBucketReplication API request. +func (r GetBucketReplicationRequest) Send() (*GetBucketReplicationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketReplicationOutput), nil +} + +// GetBucketReplicationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the replication configuration of a bucket. +// +// // Example sending a request using the GetBucketReplicationRequest method. +// req := client.GetBucketReplicationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication +func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) GetBucketReplicationRequest { + op := &aws.Operation{ + Name: opGetBucketReplication, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?replication", + } + + if input == nil { + input = &GetBucketReplicationInput{} + } + + output := &GetBucketReplicationOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketReplicationRequest{Request: req, Input: input, Copy: c.GetBucketReplicationRequest} +} + +const opGetBucketRequestPayment = "GetBucketRequestPayment" + +// GetBucketRequestPaymentRequest is a API request type for the GetBucketRequestPayment API operation. +type GetBucketRequestPaymentRequest struct { + *aws.Request + Input *GetBucketRequestPaymentInput + Copy func(*GetBucketRequestPaymentInput) GetBucketRequestPaymentRequest +} + +// Send marshals and sends the GetBucketRequestPayment API request. +func (r GetBucketRequestPaymentRequest) Send() (*GetBucketRequestPaymentOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketRequestPaymentOutput), nil +} + +// GetBucketRequestPaymentRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the request payment configuration of a bucket. +// +// // Example sending a request using the GetBucketRequestPaymentRequest method. +// req := client.GetBucketRequestPaymentRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment +func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) GetBucketRequestPaymentRequest { + op := &aws.Operation{ + Name: opGetBucketRequestPayment, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?requestPayment", + } + + if input == nil { + input = &GetBucketRequestPaymentInput{} + } + + output := &GetBucketRequestPaymentOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketRequestPaymentRequest{Request: req, Input: input, Copy: c.GetBucketRequestPaymentRequest} +} + +const opGetBucketTagging = "GetBucketTagging" + +// GetBucketTaggingRequest is a API request type for the GetBucketTagging API operation. +type GetBucketTaggingRequest struct { + *aws.Request + Input *GetBucketTaggingInput + Copy func(*GetBucketTaggingInput) GetBucketTaggingRequest +} + +// Send marshals and sends the GetBucketTagging API request. +func (r GetBucketTaggingRequest) Send() (*GetBucketTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketTaggingOutput), nil +} + +// GetBucketTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the tag set associated with the bucket. +// +// // Example sending a request using the GetBucketTaggingRequest method. +// req := client.GetBucketTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging +func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) GetBucketTaggingRequest { + op := &aws.Operation{ + Name: opGetBucketTagging, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?tagging", + } + + if input == nil { + input = &GetBucketTaggingInput{} + } + + output := &GetBucketTaggingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketTaggingRequest{Request: req, Input: input, Copy: c.GetBucketTaggingRequest} +} + +const opGetBucketVersioning = "GetBucketVersioning" + +// GetBucketVersioningRequest is a API request type for the GetBucketVersioning API operation. +type GetBucketVersioningRequest struct { + *aws.Request + Input *GetBucketVersioningInput + Copy func(*GetBucketVersioningInput) GetBucketVersioningRequest +} + +// Send marshals and sends the GetBucketVersioning API request. +func (r GetBucketVersioningRequest) Send() (*GetBucketVersioningOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketVersioningOutput), nil +} + +// GetBucketVersioningRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the versioning state of a bucket. +// +// // Example sending a request using the GetBucketVersioningRequest method. +// req := client.GetBucketVersioningRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning +func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) GetBucketVersioningRequest { + op := &aws.Operation{ + Name: opGetBucketVersioning, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?versioning", + } + + if input == nil { + input = &GetBucketVersioningInput{} + } + + output := &GetBucketVersioningOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketVersioningRequest{Request: req, Input: input, Copy: c.GetBucketVersioningRequest} +} + +const opGetBucketWebsite = "GetBucketWebsite" + +// GetBucketWebsiteRequest is a API request type for the GetBucketWebsite API operation. +type GetBucketWebsiteRequest struct { + *aws.Request + Input *GetBucketWebsiteInput + Copy func(*GetBucketWebsiteInput) GetBucketWebsiteRequest +} + +// Send marshals and sends the GetBucketWebsite API request. +func (r GetBucketWebsiteRequest) Send() (*GetBucketWebsiteOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetBucketWebsiteOutput), nil +} + +// GetBucketWebsiteRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the website configuration for a bucket. +// +// // Example sending a request using the GetBucketWebsiteRequest method. +// req := client.GetBucketWebsiteRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite +func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) GetBucketWebsiteRequest { + op := &aws.Operation{ + Name: opGetBucketWebsite, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?website", + } + + if input == nil { + input = &GetBucketWebsiteInput{} + } + + output := &GetBucketWebsiteOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetBucketWebsiteRequest{Request: req, Input: input, Copy: c.GetBucketWebsiteRequest} +} + +const opGetObject = "GetObject" + +// GetObjectRequest is a API request type for the GetObject API operation. +type GetObjectRequest struct { + *aws.Request + Input *GetObjectInput + Copy func(*GetObjectInput) GetObjectRequest +} + +// Send marshals and sends the GetObject API request. +func (r GetObjectRequest) Send() (*GetObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetObjectOutput), nil +} + +// GetObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Retrieves objects from Amazon S3. +// +// // Example sending a request using the GetObjectRequest method. +// req := client.GetObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject +func (c *S3) GetObjectRequest(input *GetObjectInput) GetObjectRequest { + op := &aws.Operation{ + Name: opGetObject, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &GetObjectInput{} + } + + output := &GetObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetObjectRequest{Request: req, Input: input, Copy: c.GetObjectRequest} +} + +const opGetObjectAcl = "GetObjectAcl" + +// GetObjectAclRequest is a API request type for the GetObjectAcl API operation. +type GetObjectAclRequest struct { + *aws.Request + Input *GetObjectAclInput + Copy func(*GetObjectAclInput) GetObjectAclRequest +} + +// Send marshals and sends the GetObjectAcl API request. +func (r GetObjectAclRequest) Send() (*GetObjectAclOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetObjectAclOutput), nil +} + +// GetObjectAclRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the access control list (ACL) of an object. +// +// // Example sending a request using the GetObjectAclRequest method. +// req := client.GetObjectAclRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl +func (c *S3) GetObjectAclRequest(input *GetObjectAclInput) GetObjectAclRequest { + op := &aws.Operation{ + Name: opGetObjectAcl, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}/{Key+}?acl", + } + + if input == nil { + input = &GetObjectAclInput{} + } + + output := &GetObjectAclOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetObjectAclRequest{Request: req, Input: input, Copy: c.GetObjectAclRequest} +} + +const opGetObjectTagging = "GetObjectTagging" + +// GetObjectTaggingRequest is a API request type for the GetObjectTagging API operation. +type GetObjectTaggingRequest struct { + *aws.Request + Input *GetObjectTaggingInput + Copy func(*GetObjectTaggingInput) GetObjectTaggingRequest +} + +// Send marshals and sends the GetObjectTagging API request. +func (r GetObjectTaggingRequest) Send() (*GetObjectTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetObjectTaggingOutput), nil +} + +// GetObjectTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns the tag-set of an object. +// +// // Example sending a request using the GetObjectTaggingRequest method. +// req := client.GetObjectTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging +func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) GetObjectTaggingRequest { + op := &aws.Operation{ + Name: opGetObjectTagging, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}/{Key+}?tagging", + } + + if input == nil { + input = &GetObjectTaggingInput{} + } + + output := &GetObjectTaggingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetObjectTaggingRequest{Request: req, Input: input, Copy: c.GetObjectTaggingRequest} +} + +const opGetObjectTorrent = "GetObjectTorrent" + +// GetObjectTorrentRequest is a API request type for the GetObjectTorrent API operation. +type GetObjectTorrentRequest struct { + *aws.Request + Input *GetObjectTorrentInput + Copy func(*GetObjectTorrentInput) GetObjectTorrentRequest +} + +// Send marshals and sends the GetObjectTorrent API request. +func (r GetObjectTorrentRequest) Send() (*GetObjectTorrentOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetObjectTorrentOutput), nil +} + +// GetObjectTorrentRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Return torrent files from a bucket. +// +// // Example sending a request using the GetObjectTorrentRequest method. +// req := client.GetObjectTorrentRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent +func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) GetObjectTorrentRequest { + op := &aws.Operation{ + Name: opGetObjectTorrent, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}/{Key+}?torrent", + } + + if input == nil { + input = &GetObjectTorrentInput{} + } + + output := &GetObjectTorrentOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetObjectTorrentRequest{Request: req, Input: input, Copy: c.GetObjectTorrentRequest} +} + +const opHeadBucket = "HeadBucket" + +// HeadBucketRequest is a API request type for the HeadBucket API operation. +type HeadBucketRequest struct { + *aws.Request + Input *HeadBucketInput + Copy func(*HeadBucketInput) HeadBucketRequest +} + +// Send marshals and sends the HeadBucket API request. +func (r HeadBucketRequest) Send() (*HeadBucketOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*HeadBucketOutput), nil +} + +// HeadBucketRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// This operation is useful to determine if a bucket exists and you have permission +// to access it. +// +// // Example sending a request using the HeadBucketRequest method. +// req := client.HeadBucketRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket +func (c *S3) HeadBucketRequest(input *HeadBucketInput) HeadBucketRequest { + op := &aws.Operation{ + Name: opHeadBucket, + HTTPMethod: "HEAD", + HTTPPath: "/{Bucket}", + } + + if input == nil { + input = &HeadBucketInput{} + } + + output := &HeadBucketOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return HeadBucketRequest{Request: req, Input: input, Copy: c.HeadBucketRequest} +} + +const opHeadObject = "HeadObject" + +// HeadObjectRequest is a API request type for the HeadObject API operation. +type HeadObjectRequest struct { + *aws.Request + Input *HeadObjectInput + Copy func(*HeadObjectInput) HeadObjectRequest +} + +// Send marshals and sends the HeadObject API request. +func (r HeadObjectRequest) Send() (*HeadObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*HeadObjectOutput), nil +} + +// HeadObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// The HEAD operation retrieves metadata from an object without returning the +// object itself. This operation is useful if you're only interested in an object's +// metadata. To use HEAD, you must have READ access to the object. +// +// See http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses +// for more information on returned errors. +// +// // Example sending a request using the HeadObjectRequest method. +// req := client.HeadObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject +func (c *S3) HeadObjectRequest(input *HeadObjectInput) HeadObjectRequest { + op := &aws.Operation{ + Name: opHeadObject, + HTTPMethod: "HEAD", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &HeadObjectInput{} + } + + output := &HeadObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return HeadObjectRequest{Request: req, Input: input, Copy: c.HeadObjectRequest} +} + +const opListBucketAnalyticsConfigurations = "ListBucketAnalyticsConfigurations" + +// ListBucketAnalyticsConfigurationsRequest is a API request type for the ListBucketAnalyticsConfigurations API operation. +type ListBucketAnalyticsConfigurationsRequest struct { + *aws.Request + Input *ListBucketAnalyticsConfigurationsInput + Copy func(*ListBucketAnalyticsConfigurationsInput) ListBucketAnalyticsConfigurationsRequest +} + +// Send marshals and sends the ListBucketAnalyticsConfigurations API request. +func (r ListBucketAnalyticsConfigurationsRequest) Send() (*ListBucketAnalyticsConfigurationsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListBucketAnalyticsConfigurationsOutput), nil +} + +// ListBucketAnalyticsConfigurationsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Lists the analytics configurations for the bucket. +// +// // Example sending a request using the ListBucketAnalyticsConfigurationsRequest method. +// req := client.ListBucketAnalyticsConfigurationsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations +func (c *S3) ListBucketAnalyticsConfigurationsRequest(input *ListBucketAnalyticsConfigurationsInput) ListBucketAnalyticsConfigurationsRequest { + op := &aws.Operation{ + Name: opListBucketAnalyticsConfigurations, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?analytics", + } + + if input == nil { + input = &ListBucketAnalyticsConfigurationsInput{} + } + + output := &ListBucketAnalyticsConfigurationsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListBucketAnalyticsConfigurationsRequest{Request: req, Input: input, Copy: c.ListBucketAnalyticsConfigurationsRequest} +} + +const opListBucketInventoryConfigurations = "ListBucketInventoryConfigurations" + +// ListBucketInventoryConfigurationsRequest is a API request type for the ListBucketInventoryConfigurations API operation. +type ListBucketInventoryConfigurationsRequest struct { + *aws.Request + Input *ListBucketInventoryConfigurationsInput + Copy func(*ListBucketInventoryConfigurationsInput) ListBucketInventoryConfigurationsRequest +} + +// Send marshals and sends the ListBucketInventoryConfigurations API request. +func (r ListBucketInventoryConfigurationsRequest) Send() (*ListBucketInventoryConfigurationsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListBucketInventoryConfigurationsOutput), nil +} + +// ListBucketInventoryConfigurationsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns a list of inventory configurations for the bucket. +// +// // Example sending a request using the ListBucketInventoryConfigurationsRequest method. +// req := client.ListBucketInventoryConfigurationsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations +func (c *S3) ListBucketInventoryConfigurationsRequest(input *ListBucketInventoryConfigurationsInput) ListBucketInventoryConfigurationsRequest { + op := &aws.Operation{ + Name: opListBucketInventoryConfigurations, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?inventory", + } + + if input == nil { + input = &ListBucketInventoryConfigurationsInput{} + } + + output := &ListBucketInventoryConfigurationsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListBucketInventoryConfigurationsRequest{Request: req, Input: input, Copy: c.ListBucketInventoryConfigurationsRequest} +} + +const opListBucketMetricsConfigurations = "ListBucketMetricsConfigurations" + +// ListBucketMetricsConfigurationsRequest is a API request type for the ListBucketMetricsConfigurations API operation. +type ListBucketMetricsConfigurationsRequest struct { + *aws.Request + Input *ListBucketMetricsConfigurationsInput + Copy func(*ListBucketMetricsConfigurationsInput) ListBucketMetricsConfigurationsRequest +} + +// Send marshals and sends the ListBucketMetricsConfigurations API request. +func (r ListBucketMetricsConfigurationsRequest) Send() (*ListBucketMetricsConfigurationsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListBucketMetricsConfigurationsOutput), nil +} + +// ListBucketMetricsConfigurationsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Lists the metrics configurations for the bucket. +// +// // Example sending a request using the ListBucketMetricsConfigurationsRequest method. +// req := client.ListBucketMetricsConfigurationsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations +func (c *S3) ListBucketMetricsConfigurationsRequest(input *ListBucketMetricsConfigurationsInput) ListBucketMetricsConfigurationsRequest { + op := &aws.Operation{ + Name: opListBucketMetricsConfigurations, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?metrics", + } + + if input == nil { + input = &ListBucketMetricsConfigurationsInput{} + } + + output := &ListBucketMetricsConfigurationsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListBucketMetricsConfigurationsRequest{Request: req, Input: input, Copy: c.ListBucketMetricsConfigurationsRequest} +} + +const opListBuckets = "ListBuckets" + +// ListBucketsRequest is a API request type for the ListBuckets API operation. +type ListBucketsRequest struct { + *aws.Request + Input *ListBucketsInput + Copy func(*ListBucketsInput) ListBucketsRequest +} + +// Send marshals and sends the ListBuckets API request. +func (r ListBucketsRequest) Send() (*ListBucketsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListBucketsOutput), nil +} + +// ListBucketsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns a list of all buckets owned by the authenticated sender of the request. +// +// // Example sending a request using the ListBucketsRequest method. +// req := client.ListBucketsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets +func (c *S3) ListBucketsRequest(input *ListBucketsInput) ListBucketsRequest { + op := &aws.Operation{ + Name: opListBuckets, + HTTPMethod: "GET", + HTTPPath: "/", + } + + if input == nil { + input = &ListBucketsInput{} + } + + output := &ListBucketsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListBucketsRequest{Request: req, Input: input, Copy: c.ListBucketsRequest} +} + +const opListMultipartUploads = "ListMultipartUploads" + +// ListMultipartUploadsRequest is a API request type for the ListMultipartUploads API operation. +type ListMultipartUploadsRequest struct { + *aws.Request + Input *ListMultipartUploadsInput + Copy func(*ListMultipartUploadsInput) ListMultipartUploadsRequest +} + +// Send marshals and sends the ListMultipartUploads API request. +func (r ListMultipartUploadsRequest) Send() (*ListMultipartUploadsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListMultipartUploadsOutput), nil +} + +// ListMultipartUploadsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// This operation lists in-progress multipart uploads. +// +// // Example sending a request using the ListMultipartUploadsRequest method. +// req := client.ListMultipartUploadsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads +func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) ListMultipartUploadsRequest { + op := &aws.Operation{ + Name: opListMultipartUploads, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?uploads", + Paginator: &aws.Paginator{ + InputTokens: []string{"KeyMarker", "UploadIdMarker"}, + OutputTokens: []string{"NextKeyMarker", "NextUploadIdMarker"}, + LimitToken: "MaxUploads", + TruncationToken: "IsTruncated", + }, + } + + if input == nil { + input = &ListMultipartUploadsInput{} + } + + output := &ListMultipartUploadsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListMultipartUploadsRequest{Request: req, Input: input, Copy: c.ListMultipartUploadsRequest} +} + +// Paginate pages iterates over the pages of a ListMultipartUploadsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListMultipartUploads operation. +// req := client.ListMultipartUploadsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListMultipartUploadsRequest) Paginate(opts ...aws.Option) ListMultipartUploadsPager { + return ListMultipartUploadsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListMultipartUploadsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListMultipartUploadsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListMultipartUploadsPager struct { + aws.Pager +} + +func (p *ListMultipartUploadsPager) CurrentPage() *ListMultipartUploadsOutput { + return p.Pager.CurrentPage().(*ListMultipartUploadsOutput) +} + +const opListObjectVersions = "ListObjectVersions" + +// ListObjectVersionsRequest is a API request type for the ListObjectVersions API operation. +type ListObjectVersionsRequest struct { + *aws.Request + Input *ListObjectVersionsInput + Copy func(*ListObjectVersionsInput) ListObjectVersionsRequest +} + +// Send marshals and sends the ListObjectVersions API request. +func (r ListObjectVersionsRequest) Send() (*ListObjectVersionsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListObjectVersionsOutput), nil +} + +// ListObjectVersionsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns metadata about all of the versions of objects in a bucket. +// +// // Example sending a request using the ListObjectVersionsRequest method. +// req := client.ListObjectVersionsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions +func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) ListObjectVersionsRequest { + op := &aws.Operation{ + Name: opListObjectVersions, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?versions", + Paginator: &aws.Paginator{ + InputTokens: []string{"KeyMarker", "VersionIdMarker"}, + OutputTokens: []string{"NextKeyMarker", "NextVersionIdMarker"}, + LimitToken: "MaxKeys", + TruncationToken: "IsTruncated", + }, + } + + if input == nil { + input = &ListObjectVersionsInput{} + } + + output := &ListObjectVersionsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListObjectVersionsRequest{Request: req, Input: input, Copy: c.ListObjectVersionsRequest} +} + +// Paginate pages iterates over the pages of a ListObjectVersionsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjectVersions operation. +// req := client.ListObjectVersionsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListObjectVersionsRequest) Paginate(opts ...aws.Option) ListObjectVersionsPager { + return ListObjectVersionsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListObjectVersionsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListObjectVersionsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListObjectVersionsPager struct { + aws.Pager +} + +func (p *ListObjectVersionsPager) CurrentPage() *ListObjectVersionsOutput { + return p.Pager.CurrentPage().(*ListObjectVersionsOutput) +} + +const opListObjects = "ListObjects" + +// ListObjectsRequest is a API request type for the ListObjects API operation. +type ListObjectsRequest struct { + *aws.Request + Input *ListObjectsInput + Copy func(*ListObjectsInput) ListObjectsRequest +} + +// Send marshals and sends the ListObjects API request. +func (r ListObjectsRequest) Send() (*ListObjectsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListObjectsOutput), nil +} + +// ListObjectsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns some or all (up to 1000) of the objects in a bucket. You can use +// the request parameters as selection criteria to return a subset of the objects +// in a bucket. +// +// // Example sending a request using the ListObjectsRequest method. +// req := client.ListObjectsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects +func (c *S3) ListObjectsRequest(input *ListObjectsInput) ListObjectsRequest { + op := &aws.Operation{ + Name: opListObjects, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}", + Paginator: &aws.Paginator{ + InputTokens: []string{"Marker"}, + OutputTokens: []string{"NextMarker || Contents[-1].Key"}, + LimitToken: "MaxKeys", + TruncationToken: "IsTruncated", + }, + } + + if input == nil { + input = &ListObjectsInput{} + } + + output := &ListObjectsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListObjectsRequest{Request: req, Input: input, Copy: c.ListObjectsRequest} +} + +// Paginate pages iterates over the pages of a ListObjectsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjects operation. +// req := client.ListObjectsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListObjectsRequest) Paginate(opts ...aws.Option) ListObjectsPager { + return ListObjectsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListObjectsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListObjectsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListObjectsPager struct { + aws.Pager +} + +func (p *ListObjectsPager) CurrentPage() *ListObjectsOutput { + return p.Pager.CurrentPage().(*ListObjectsOutput) +} + +const opListObjectsV2 = "ListObjectsV2" + +// ListObjectsV2Request is a API request type for the ListObjectsV2 API operation. +type ListObjectsV2Request struct { + *aws.Request + Input *ListObjectsV2Input + Copy func(*ListObjectsV2Input) ListObjectsV2Request +} + +// Send marshals and sends the ListObjectsV2 API request. +func (r ListObjectsV2Request) Send() (*ListObjectsV2Output, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListObjectsV2Output), nil +} + +// ListObjectsV2Request returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Returns some or all (up to 1000) of the objects in a bucket. You can use +// the request parameters as selection criteria to return a subset of the objects +// in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend +// you use this revised API for new application development. +// +// // Example sending a request using the ListObjectsV2Request method. +// req := client.ListObjectsV2Request(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 +func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) ListObjectsV2Request { + op := &aws.Operation{ + Name: opListObjectsV2, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}?list-type=2", + Paginator: &aws.Paginator{ + InputTokens: []string{"ContinuationToken"}, + OutputTokens: []string{"NextContinuationToken"}, + LimitToken: "MaxKeys", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListObjectsV2Input{} + } + + output := &ListObjectsV2Output{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListObjectsV2Request{Request: req, Input: input, Copy: c.ListObjectsV2Request} +} + +// Paginate pages iterates over the pages of a ListObjectsV2Request operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListObjectsV2 operation. +// req := client.ListObjectsV2Request(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListObjectsV2Request) Paginate(opts ...aws.Option) ListObjectsV2Pager { + return ListObjectsV2Pager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListObjectsV2Input + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListObjectsV2Pager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListObjectsV2Pager struct { + aws.Pager +} + +func (p *ListObjectsV2Pager) CurrentPage() *ListObjectsV2Output { + return p.Pager.CurrentPage().(*ListObjectsV2Output) +} + +const opListParts = "ListParts" + +// ListPartsRequest is a API request type for the ListParts API operation. +type ListPartsRequest struct { + *aws.Request + Input *ListPartsInput + Copy func(*ListPartsInput) ListPartsRequest +} + +// Send marshals and sends the ListParts API request. +func (r ListPartsRequest) Send() (*ListPartsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*ListPartsOutput), nil +} + +// ListPartsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Lists the parts that have been uploaded for a specific multipart upload. +// +// // Example sending a request using the ListPartsRequest method. +// req := client.ListPartsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts +func (c *S3) ListPartsRequest(input *ListPartsInput) ListPartsRequest { + op := &aws.Operation{ + Name: opListParts, + HTTPMethod: "GET", + HTTPPath: "/{Bucket}/{Key+}", + Paginator: &aws.Paginator{ + InputTokens: []string{"PartNumberMarker"}, + OutputTokens: []string{"NextPartNumberMarker"}, + LimitToken: "MaxParts", + TruncationToken: "IsTruncated", + }, + } + + if input == nil { + input = &ListPartsInput{} + } + + output := &ListPartsOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return ListPartsRequest{Request: req, Input: input, Copy: c.ListPartsRequest} +} + +// Paginate pages iterates over the pages of a ListPartsRequest operation, +// calling the Next method for each page. Using the paginators Next +// method will depict whether or not there are more pages. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListParts operation. +// req := client.ListPartsRequest(input) +// p := req.Paginate() +// for p.Next() { +// page := p.CurrentPage() +// } +// +// if err := p.Err(); err != nil { +// return err +// } +// +func (p *ListPartsRequest) Paginate(opts ...aws.Option) ListPartsPager { + return ListPartsPager{ + Pager: aws.Pager{ + NewRequest: func() (*aws.Request, error) { + var inCpy *ListPartsInput + if p.Input != nil { + tmp := *p.Input + inCpy = &tmp + } + + req := p.Copy(inCpy) + req.ApplyOptions(opts...) + + return req.Request, nil + }, + }, + } +} + +// ListPartsPager is used to paginate the request. This can be done by +// calling Next and CurrentPage. +type ListPartsPager struct { + aws.Pager +} + +func (p *ListPartsPager) CurrentPage() *ListPartsOutput { + return p.Pager.CurrentPage().(*ListPartsOutput) +} + +const opPutBucketAccelerateConfiguration = "PutBucketAccelerateConfiguration" + +// PutBucketAccelerateConfigurationRequest is a API request type for the PutBucketAccelerateConfiguration API operation. +type PutBucketAccelerateConfigurationRequest struct { + *aws.Request + Input *PutBucketAccelerateConfigurationInput + Copy func(*PutBucketAccelerateConfigurationInput) PutBucketAccelerateConfigurationRequest +} + +// Send marshals and sends the PutBucketAccelerateConfiguration API request. +func (r PutBucketAccelerateConfigurationRequest) Send() (*PutBucketAccelerateConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketAccelerateConfigurationOutput), nil +} + +// PutBucketAccelerateConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the accelerate configuration of an existing bucket. +// +// // Example sending a request using the PutBucketAccelerateConfigurationRequest method. +// req := client.PutBucketAccelerateConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration +func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateConfigurationInput) PutBucketAccelerateConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketAccelerateConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?accelerate", + } + + if input == nil { + input = &PutBucketAccelerateConfigurationInput{} + } + + output := &PutBucketAccelerateConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketAccelerateConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketAccelerateConfigurationRequest} +} + +const opPutBucketAcl = "PutBucketAcl" + +// PutBucketAclRequest is a API request type for the PutBucketAcl API operation. +type PutBucketAclRequest struct { + *aws.Request + Input *PutBucketAclInput + Copy func(*PutBucketAclInput) PutBucketAclRequest +} + +// Send marshals and sends the PutBucketAcl API request. +func (r PutBucketAclRequest) Send() (*PutBucketAclOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketAclOutput), nil +} + +// PutBucketAclRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the permissions on a bucket using access control lists (ACL). +// +// // Example sending a request using the PutBucketAclRequest method. +// req := client.PutBucketAclRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl +func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) PutBucketAclRequest { + op := &aws.Operation{ + Name: opPutBucketAcl, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?acl", + } + + if input == nil { + input = &PutBucketAclInput{} + } + + output := &PutBucketAclOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketAclRequest{Request: req, Input: input, Copy: c.PutBucketAclRequest} +} + +const opPutBucketAnalyticsConfiguration = "PutBucketAnalyticsConfiguration" + +// PutBucketAnalyticsConfigurationRequest is a API request type for the PutBucketAnalyticsConfiguration API operation. +type PutBucketAnalyticsConfigurationRequest struct { + *aws.Request + Input *PutBucketAnalyticsConfigurationInput + Copy func(*PutBucketAnalyticsConfigurationInput) PutBucketAnalyticsConfigurationRequest +} + +// Send marshals and sends the PutBucketAnalyticsConfiguration API request. +func (r PutBucketAnalyticsConfigurationRequest) Send() (*PutBucketAnalyticsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketAnalyticsConfigurationOutput), nil +} + +// PutBucketAnalyticsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets an analytics configuration for the bucket (specified by the analytics +// configuration ID). +// +// // Example sending a request using the PutBucketAnalyticsConfigurationRequest method. +// req := client.PutBucketAnalyticsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration +func (c *S3) PutBucketAnalyticsConfigurationRequest(input *PutBucketAnalyticsConfigurationInput) PutBucketAnalyticsConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketAnalyticsConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?analytics", + } + + if input == nil { + input = &PutBucketAnalyticsConfigurationInput{} + } + + output := &PutBucketAnalyticsConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketAnalyticsConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketAnalyticsConfigurationRequest} +} + +const opPutBucketCors = "PutBucketCors" + +// PutBucketCorsRequest is a API request type for the PutBucketCors API operation. +type PutBucketCorsRequest struct { + *aws.Request + Input *PutBucketCorsInput + Copy func(*PutBucketCorsInput) PutBucketCorsRequest +} + +// Send marshals and sends the PutBucketCors API request. +func (r PutBucketCorsRequest) Send() (*PutBucketCorsOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketCorsOutput), nil +} + +// PutBucketCorsRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the cors configuration for a bucket. +// +// // Example sending a request using the PutBucketCorsRequest method. +// req := client.PutBucketCorsRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors +func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) PutBucketCorsRequest { + op := &aws.Operation{ + Name: opPutBucketCors, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?cors", + } + + if input == nil { + input = &PutBucketCorsInput{} + } + + output := &PutBucketCorsOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketCorsRequest{Request: req, Input: input, Copy: c.PutBucketCorsRequest} +} + +const opPutBucketEncryption = "PutBucketEncryption" + +// PutBucketEncryptionRequest is a API request type for the PutBucketEncryption API operation. +type PutBucketEncryptionRequest struct { + *aws.Request + Input *PutBucketEncryptionInput + Copy func(*PutBucketEncryptionInput) PutBucketEncryptionRequest +} + +// Send marshals and sends the PutBucketEncryption API request. +func (r PutBucketEncryptionRequest) Send() (*PutBucketEncryptionOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketEncryptionOutput), nil +} + +// PutBucketEncryptionRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Creates a new server-side encryption configuration (or replaces an existing +// one, if present). +// +// // Example sending a request using the PutBucketEncryptionRequest method. +// req := client.PutBucketEncryptionRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryption +func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) PutBucketEncryptionRequest { + op := &aws.Operation{ + Name: opPutBucketEncryption, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?encryption", + } + + if input == nil { + input = &PutBucketEncryptionInput{} + } + + output := &PutBucketEncryptionOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketEncryptionRequest{Request: req, Input: input, Copy: c.PutBucketEncryptionRequest} +} + +const opPutBucketInventoryConfiguration = "PutBucketInventoryConfiguration" + +// PutBucketInventoryConfigurationRequest is a API request type for the PutBucketInventoryConfiguration API operation. +type PutBucketInventoryConfigurationRequest struct { + *aws.Request + Input *PutBucketInventoryConfigurationInput + Copy func(*PutBucketInventoryConfigurationInput) PutBucketInventoryConfigurationRequest +} + +// Send marshals and sends the PutBucketInventoryConfiguration API request. +func (r PutBucketInventoryConfigurationRequest) Send() (*PutBucketInventoryConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketInventoryConfigurationOutput), nil +} + +// PutBucketInventoryConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Adds an inventory configuration (identified by the inventory ID) from the +// bucket. +// +// // Example sending a request using the PutBucketInventoryConfigurationRequest method. +// req := client.PutBucketInventoryConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration +func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryConfigurationInput) PutBucketInventoryConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketInventoryConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?inventory", + } + + if input == nil { + input = &PutBucketInventoryConfigurationInput{} + } + + output := &PutBucketInventoryConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketInventoryConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketInventoryConfigurationRequest} +} + +const opPutBucketLifecycle = "PutBucketLifecycle" + +// PutBucketLifecycleRequest is a API request type for the PutBucketLifecycle API operation. +type PutBucketLifecycleRequest struct { + *aws.Request + Input *PutBucketLifecycleInput + Copy func(*PutBucketLifecycleInput) PutBucketLifecycleRequest +} + +// Send marshals and sends the PutBucketLifecycle API request. +func (r PutBucketLifecycleRequest) Send() (*PutBucketLifecycleOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketLifecycleOutput), nil +} + +// PutBucketLifecycleRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deprecated, see the PutBucketLifecycleConfiguration operation. +// +// // Example sending a request using the PutBucketLifecycleRequest method. +// req := client.PutBucketLifecycleRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle +func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) PutBucketLifecycleRequest { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, PutBucketLifecycle, has been deprecated") + } + op := &aws.Operation{ + Name: opPutBucketLifecycle, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?lifecycle", + } + + if input == nil { + input = &PutBucketLifecycleInput{} + } + + output := &PutBucketLifecycleOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketLifecycleRequest{Request: req, Input: input, Copy: c.PutBucketLifecycleRequest} +} + +const opPutBucketLifecycleConfiguration = "PutBucketLifecycleConfiguration" + +// PutBucketLifecycleConfigurationRequest is a API request type for the PutBucketLifecycleConfiguration API operation. +type PutBucketLifecycleConfigurationRequest struct { + *aws.Request + Input *PutBucketLifecycleConfigurationInput + Copy func(*PutBucketLifecycleConfigurationInput) PutBucketLifecycleConfigurationRequest +} + +// Send marshals and sends the PutBucketLifecycleConfiguration API request. +func (r PutBucketLifecycleConfigurationRequest) Send() (*PutBucketLifecycleConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketLifecycleConfigurationOutput), nil +} + +// PutBucketLifecycleConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets lifecycle configuration for your bucket. If a lifecycle configuration +// exists, it replaces it. +// +// // Example sending a request using the PutBucketLifecycleConfigurationRequest method. +// req := client.PutBucketLifecycleConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration +func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleConfigurationInput) PutBucketLifecycleConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketLifecycleConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?lifecycle", + } + + if input == nil { + input = &PutBucketLifecycleConfigurationInput{} + } + + output := &PutBucketLifecycleConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketLifecycleConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketLifecycleConfigurationRequest} +} + +const opPutBucketLogging = "PutBucketLogging" + +// PutBucketLoggingRequest is a API request type for the PutBucketLogging API operation. +type PutBucketLoggingRequest struct { + *aws.Request + Input *PutBucketLoggingInput + Copy func(*PutBucketLoggingInput) PutBucketLoggingRequest +} + +// Send marshals and sends the PutBucketLogging API request. +func (r PutBucketLoggingRequest) Send() (*PutBucketLoggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketLoggingOutput), nil +} + +// PutBucketLoggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Set the logging parameters for a bucket and to specify permissions for who +// can view and modify the logging parameters. To set the logging status of +// a bucket, you must be the bucket owner. +// +// // Example sending a request using the PutBucketLoggingRequest method. +// req := client.PutBucketLoggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging +func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) PutBucketLoggingRequest { + op := &aws.Operation{ + Name: opPutBucketLogging, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?logging", + } + + if input == nil { + input = &PutBucketLoggingInput{} + } + + output := &PutBucketLoggingOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketLoggingRequest{Request: req, Input: input, Copy: c.PutBucketLoggingRequest} +} + +const opPutBucketMetricsConfiguration = "PutBucketMetricsConfiguration" + +// PutBucketMetricsConfigurationRequest is a API request type for the PutBucketMetricsConfiguration API operation. +type PutBucketMetricsConfigurationRequest struct { + *aws.Request + Input *PutBucketMetricsConfigurationInput + Copy func(*PutBucketMetricsConfigurationInput) PutBucketMetricsConfigurationRequest +} + +// Send marshals and sends the PutBucketMetricsConfiguration API request. +func (r PutBucketMetricsConfigurationRequest) Send() (*PutBucketMetricsConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketMetricsConfigurationOutput), nil +} + +// PutBucketMetricsConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets a metrics configuration (specified by the metrics configuration ID) +// for the bucket. +// +// // Example sending a request using the PutBucketMetricsConfigurationRequest method. +// req := client.PutBucketMetricsConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration +func (c *S3) PutBucketMetricsConfigurationRequest(input *PutBucketMetricsConfigurationInput) PutBucketMetricsConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketMetricsConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?metrics", + } + + if input == nil { + input = &PutBucketMetricsConfigurationInput{} + } + + output := &PutBucketMetricsConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketMetricsConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketMetricsConfigurationRequest} +} + +const opPutBucketNotification = "PutBucketNotification" + +// PutBucketNotificationRequest is a API request type for the PutBucketNotification API operation. +type PutBucketNotificationRequest struct { + *aws.Request + Input *PutBucketNotificationInput + Copy func(*PutBucketNotificationInput) PutBucketNotificationRequest +} + +// Send marshals and sends the PutBucketNotification API request. +func (r PutBucketNotificationRequest) Send() (*PutBucketNotificationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketNotificationOutput), nil +} + +// PutBucketNotificationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Deprecated, see the PutBucketNotificationConfiguraiton operation. +// +// // Example sending a request using the PutBucketNotificationRequest method. +// req := client.PutBucketNotificationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification +func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) PutBucketNotificationRequest { + if c.Client.Config.Logger != nil { + c.Client.Config.Logger.Log("This operation, PutBucketNotification, has been deprecated") + } + op := &aws.Operation{ + Name: opPutBucketNotification, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?notification", + } + + if input == nil { + input = &PutBucketNotificationInput{} + } + + output := &PutBucketNotificationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketNotificationRequest{Request: req, Input: input, Copy: c.PutBucketNotificationRequest} +} + +const opPutBucketNotificationConfiguration = "PutBucketNotificationConfiguration" + +// PutBucketNotificationConfigurationRequest is a API request type for the PutBucketNotificationConfiguration API operation. +type PutBucketNotificationConfigurationRequest struct { + *aws.Request + Input *PutBucketNotificationConfigurationInput + Copy func(*PutBucketNotificationConfigurationInput) PutBucketNotificationConfigurationRequest +} + +// Send marshals and sends the PutBucketNotificationConfiguration API request. +func (r PutBucketNotificationConfigurationRequest) Send() (*PutBucketNotificationConfigurationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketNotificationConfigurationOutput), nil +} + +// PutBucketNotificationConfigurationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Enables notifications of specified events for a bucket. +// +// // Example sending a request using the PutBucketNotificationConfigurationRequest method. +// req := client.PutBucketNotificationConfigurationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration +func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificationConfigurationInput) PutBucketNotificationConfigurationRequest { + op := &aws.Operation{ + Name: opPutBucketNotificationConfiguration, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?notification", + } + + if input == nil { + input = &PutBucketNotificationConfigurationInput{} + } + + output := &PutBucketNotificationConfigurationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketNotificationConfigurationRequest{Request: req, Input: input, Copy: c.PutBucketNotificationConfigurationRequest} +} + +const opPutBucketPolicy = "PutBucketPolicy" + +// PutBucketPolicyRequest is a API request type for the PutBucketPolicy API operation. +type PutBucketPolicyRequest struct { + *aws.Request + Input *PutBucketPolicyInput + Copy func(*PutBucketPolicyInput) PutBucketPolicyRequest +} + +// Send marshals and sends the PutBucketPolicy API request. +func (r PutBucketPolicyRequest) Send() (*PutBucketPolicyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketPolicyOutput), nil +} + +// PutBucketPolicyRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Replaces a policy on a bucket. If the bucket already has a policy, the one +// in this request completely replaces it. +// +// // Example sending a request using the PutBucketPolicyRequest method. +// req := client.PutBucketPolicyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy +func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) PutBucketPolicyRequest { + op := &aws.Operation{ + Name: opPutBucketPolicy, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?policy", + } + + if input == nil { + input = &PutBucketPolicyInput{} + } + + output := &PutBucketPolicyOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketPolicyRequest{Request: req, Input: input, Copy: c.PutBucketPolicyRequest} +} + +const opPutBucketReplication = "PutBucketReplication" + +// PutBucketReplicationRequest is a API request type for the PutBucketReplication API operation. +type PutBucketReplicationRequest struct { + *aws.Request + Input *PutBucketReplicationInput + Copy func(*PutBucketReplicationInput) PutBucketReplicationRequest +} + +// Send marshals and sends the PutBucketReplication API request. +func (r PutBucketReplicationRequest) Send() (*PutBucketReplicationOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketReplicationOutput), nil +} + +// PutBucketReplicationRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Creates a new replication configuration (or replaces an existing one, if +// present). For more information, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) +// in the Amazon S3 Developer Guide. +// +// // Example sending a request using the PutBucketReplicationRequest method. +// req := client.PutBucketReplicationRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication +func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) PutBucketReplicationRequest { + op := &aws.Operation{ + Name: opPutBucketReplication, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?replication", + } + + if input == nil { + input = &PutBucketReplicationInput{} + } + + output := &PutBucketReplicationOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketReplicationRequest{Request: req, Input: input, Copy: c.PutBucketReplicationRequest} +} + +const opPutBucketRequestPayment = "PutBucketRequestPayment" + +// PutBucketRequestPaymentRequest is a API request type for the PutBucketRequestPayment API operation. +type PutBucketRequestPaymentRequest struct { + *aws.Request + Input *PutBucketRequestPaymentInput + Copy func(*PutBucketRequestPaymentInput) PutBucketRequestPaymentRequest +} + +// Send marshals and sends the PutBucketRequestPayment API request. +func (r PutBucketRequestPaymentRequest) Send() (*PutBucketRequestPaymentOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketRequestPaymentOutput), nil +} + +// PutBucketRequestPaymentRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the request payment configuration for a bucket. By default, the bucket +// owner pays for downloads from the bucket. This configuration parameter enables +// the bucket owner (only) to specify that the person requesting the download +// will be charged for the download. Documentation on requester pays buckets +// can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html +// +// // Example sending a request using the PutBucketRequestPaymentRequest method. +// req := client.PutBucketRequestPaymentRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment +func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) PutBucketRequestPaymentRequest { + op := &aws.Operation{ + Name: opPutBucketRequestPayment, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?requestPayment", + } + + if input == nil { + input = &PutBucketRequestPaymentInput{} + } + + output := &PutBucketRequestPaymentOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketRequestPaymentRequest{Request: req, Input: input, Copy: c.PutBucketRequestPaymentRequest} +} + +const opPutBucketTagging = "PutBucketTagging" + +// PutBucketTaggingRequest is a API request type for the PutBucketTagging API operation. +type PutBucketTaggingRequest struct { + *aws.Request + Input *PutBucketTaggingInput + Copy func(*PutBucketTaggingInput) PutBucketTaggingRequest +} + +// Send marshals and sends the PutBucketTagging API request. +func (r PutBucketTaggingRequest) Send() (*PutBucketTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketTaggingOutput), nil +} + +// PutBucketTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the tags for a bucket. +// +// // Example sending a request using the PutBucketTaggingRequest method. +// req := client.PutBucketTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging +func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) PutBucketTaggingRequest { + op := &aws.Operation{ + Name: opPutBucketTagging, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?tagging", + } + + if input == nil { + input = &PutBucketTaggingInput{} + } + + output := &PutBucketTaggingOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketTaggingRequest{Request: req, Input: input, Copy: c.PutBucketTaggingRequest} +} + +const opPutBucketVersioning = "PutBucketVersioning" + +// PutBucketVersioningRequest is a API request type for the PutBucketVersioning API operation. +type PutBucketVersioningRequest struct { + *aws.Request + Input *PutBucketVersioningInput + Copy func(*PutBucketVersioningInput) PutBucketVersioningRequest +} + +// Send marshals and sends the PutBucketVersioning API request. +func (r PutBucketVersioningRequest) Send() (*PutBucketVersioningOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketVersioningOutput), nil +} + +// PutBucketVersioningRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the versioning state of an existing bucket. To set the versioning state, +// you must be the bucket owner. +// +// // Example sending a request using the PutBucketVersioningRequest method. +// req := client.PutBucketVersioningRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning +func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) PutBucketVersioningRequest { + op := &aws.Operation{ + Name: opPutBucketVersioning, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?versioning", + } + + if input == nil { + input = &PutBucketVersioningInput{} + } + + output := &PutBucketVersioningOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketVersioningRequest{Request: req, Input: input, Copy: c.PutBucketVersioningRequest} +} + +const opPutBucketWebsite = "PutBucketWebsite" + +// PutBucketWebsiteRequest is a API request type for the PutBucketWebsite API operation. +type PutBucketWebsiteRequest struct { + *aws.Request + Input *PutBucketWebsiteInput + Copy func(*PutBucketWebsiteInput) PutBucketWebsiteRequest +} + +// Send marshals and sends the PutBucketWebsite API request. +func (r PutBucketWebsiteRequest) Send() (*PutBucketWebsiteOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutBucketWebsiteOutput), nil +} + +// PutBucketWebsiteRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Set the website configuration for a bucket. +// +// // Example sending a request using the PutBucketWebsiteRequest method. +// req := client.PutBucketWebsiteRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite +func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) PutBucketWebsiteRequest { + op := &aws.Operation{ + Name: opPutBucketWebsite, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}?website", + } + + if input == nil { + input = &PutBucketWebsiteInput{} + } + + output := &PutBucketWebsiteOutput{} + req := c.newRequest(op, input, output) + req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) + req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) + output.responseMetadata = aws.Response{Request: req} + + return PutBucketWebsiteRequest{Request: req, Input: input, Copy: c.PutBucketWebsiteRequest} +} + +const opPutObject = "PutObject" + +// PutObjectRequest is a API request type for the PutObject API operation. +type PutObjectRequest struct { + *aws.Request + Input *PutObjectInput + Copy func(*PutObjectInput) PutObjectRequest +} + +// Send marshals and sends the PutObject API request. +func (r PutObjectRequest) Send() (*PutObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutObjectOutput), nil +} + +// PutObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Adds an object to a bucket. +// +// // Example sending a request using the PutObjectRequest method. +// req := client.PutObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject +func (c *S3) PutObjectRequest(input *PutObjectInput) PutObjectRequest { + op := &aws.Operation{ + Name: opPutObject, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &PutObjectInput{} + } + + output := &PutObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutObjectRequest{Request: req, Input: input, Copy: c.PutObjectRequest} +} + +const opPutObjectAcl = "PutObjectAcl" + +// PutObjectAclRequest is a API request type for the PutObjectAcl API operation. +type PutObjectAclRequest struct { + *aws.Request + Input *PutObjectAclInput + Copy func(*PutObjectAclInput) PutObjectAclRequest +} + +// Send marshals and sends the PutObjectAcl API request. +func (r PutObjectAclRequest) Send() (*PutObjectAclOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutObjectAclOutput), nil +} + +// PutObjectAclRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// uses the acl subresource to set the access control list (ACL) permissions +// for an object that already exists in a bucket +// +// // Example sending a request using the PutObjectAclRequest method. +// req := client.PutObjectAclRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl +func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) PutObjectAclRequest { + op := &aws.Operation{ + Name: opPutObjectAcl, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}?acl", + } + + if input == nil { + input = &PutObjectAclInput{} + } + + output := &PutObjectAclOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutObjectAclRequest{Request: req, Input: input, Copy: c.PutObjectAclRequest} +} + +const opPutObjectTagging = "PutObjectTagging" + +// PutObjectTaggingRequest is a API request type for the PutObjectTagging API operation. +type PutObjectTaggingRequest struct { + *aws.Request + Input *PutObjectTaggingInput + Copy func(*PutObjectTaggingInput) PutObjectTaggingRequest +} + +// Send marshals and sends the PutObjectTagging API request. +func (r PutObjectTaggingRequest) Send() (*PutObjectTaggingOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*PutObjectTaggingOutput), nil +} + +// PutObjectTaggingRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Sets the supplied tag-set to an object that already exists in a bucket +// +// // Example sending a request using the PutObjectTaggingRequest method. +// req := client.PutObjectTaggingRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging +func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) PutObjectTaggingRequest { + op := &aws.Operation{ + Name: opPutObjectTagging, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}?tagging", + } + + if input == nil { + input = &PutObjectTaggingInput{} + } + + output := &PutObjectTaggingOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return PutObjectTaggingRequest{Request: req, Input: input, Copy: c.PutObjectTaggingRequest} +} + +const opRestoreObject = "RestoreObject" + +// RestoreObjectRequest is a API request type for the RestoreObject API operation. +type RestoreObjectRequest struct { + *aws.Request + Input *RestoreObjectInput + Copy func(*RestoreObjectInput) RestoreObjectRequest +} + +// Send marshals and sends the RestoreObject API request. +func (r RestoreObjectRequest) Send() (*RestoreObjectOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*RestoreObjectOutput), nil +} + +// RestoreObjectRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Restores an archived copy of an object back into Amazon S3 +// +// // Example sending a request using the RestoreObjectRequest method. +// req := client.RestoreObjectRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject +func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) RestoreObjectRequest { + op := &aws.Operation{ + Name: opRestoreObject, + HTTPMethod: "POST", + HTTPPath: "/{Bucket}/{Key+}?restore", + } + + if input == nil { + input = &RestoreObjectInput{} + } + + output := &RestoreObjectOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return RestoreObjectRequest{Request: req, Input: input, Copy: c.RestoreObjectRequest} +} + +const opUploadPart = "UploadPart" + +// UploadPartRequest is a API request type for the UploadPart API operation. +type UploadPartRequest struct { + *aws.Request + Input *UploadPartInput + Copy func(*UploadPartInput) UploadPartRequest +} + +// Send marshals and sends the UploadPart API request. +func (r UploadPartRequest) Send() (*UploadPartOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UploadPartOutput), nil +} + +// UploadPartRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Uploads a part in a multipart upload. +// +// Note: After you initiate multipart upload and upload one or more parts, you +// must either complete or abort multipart upload in order to stop getting charged +// for storage of the uploaded parts. Only after you either complete or abort +// multipart upload, Amazon S3 frees up the parts storage and stops charging +// you for the parts storage. +// +// // Example sending a request using the UploadPartRequest method. +// req := client.UploadPartRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart +func (c *S3) UploadPartRequest(input *UploadPartInput) UploadPartRequest { + op := &aws.Operation{ + Name: opUploadPart, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &UploadPartInput{} + } + + output := &UploadPartOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UploadPartRequest{Request: req, Input: input, Copy: c.UploadPartRequest} +} + +const opUploadPartCopy = "UploadPartCopy" + +// UploadPartCopyRequest is a API request type for the UploadPartCopy API operation. +type UploadPartCopyRequest struct { + *aws.Request + Input *UploadPartCopyInput + Copy func(*UploadPartCopyInput) UploadPartCopyRequest +} + +// Send marshals and sends the UploadPartCopy API request. +func (r UploadPartCopyRequest) Send() (*UploadPartCopyOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*UploadPartCopyOutput), nil +} + +// UploadPartCopyRequest returns a request value for making API operation for +// Amazon Simple Storage Service. +// +// Uploads a part by copying data from an existing object as data source. +// +// // Example sending a request using the UploadPartCopyRequest method. +// req := client.UploadPartCopyRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy +func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) UploadPartCopyRequest { + op := &aws.Operation{ + Name: opUploadPartCopy, + HTTPMethod: "PUT", + HTTPPath: "/{Bucket}/{Key+}", + } + + if input == nil { + input = &UploadPartCopyInput{} + } + + output := &UploadPartCopyOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return UploadPartCopyRequest{Request: req, Input: input, Copy: c.UploadPartCopyRequest} +} + +// Specifies the days since the initiation of an Incomplete Multipart Upload +// that Lifecycle will wait before permanently removing all parts of the upload. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortIncompleteMultipartUpload +type AbortIncompleteMultipartUpload struct { + _ struct{} `type:"structure"` + + // Indicates the number of days that must pass since initiation for Lifecycle + // to abort an Incomplete Multipart Upload. + DaysAfterInitiation *int64 `type:"integer"` +} + +// String returns the string representation +func (s AbortIncompleteMultipartUpload) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AbortIncompleteMultipartUpload) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AbortIncompleteMultipartUpload) MarshalFields(e protocol.FieldEncoder) error { + if s.DaysAfterInitiation != nil { + v := *s.DaysAfterInitiation + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DaysAfterInitiation", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUploadRequest +type AbortMultipartUploadInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // UploadId is a required field + UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s AbortMultipartUploadInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AbortMultipartUploadInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AbortMultipartUploadInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AbortMultipartUploadInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.UploadId == nil { + invalidParams.Add(aws.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *AbortMultipartUploadInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AbortMultipartUploadInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "uploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUploadOutput +type AbortMultipartUploadOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` +} + +// String returns the string representation +func (s AbortMultipartUploadOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AbortMultipartUploadOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AbortMultipartUploadOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AbortMultipartUploadOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccelerateConfiguration +type AccelerateConfiguration struct { + _ struct{} `type:"structure"` + + // The accelerate configuration of the bucket. + Status BucketAccelerateStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s AccelerateConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccelerateConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AccelerateConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccessControlPolicy +type AccessControlPolicy struct { + _ struct{} `type:"structure"` + + // A list of grants. + Grants []Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` + + Owner *Owner `type:"structure"` +} + +// String returns the string representation +func (s AccessControlPolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccessControlPolicy) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AccessControlPolicy) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AccessControlPolicy"} + if s.Grants != nil { + for i, v := range s.Grants { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Grants", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AccessControlPolicy) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Grants) > 0 { + v := s.Grants + + metadata := protocol.Metadata{ListLocationName: "Grant"} + ls0 := e.List(protocol.BodyTarget, "AccessControlList", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + return nil +} + +// Container for information regarding the access control for replicas. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccessControlTranslation +type AccessControlTranslation struct { + _ struct{} `type:"structure"` + + // The override value for the owner of the replica object. + // + // Owner is a required field + Owner OwnerOverride `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s AccessControlTranslation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccessControlTranslation) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AccessControlTranslation) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AccessControlTranslation"} + if len(s.Owner) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Owner")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AccessControlTranslation) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Owner) > 0 { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Owner", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsAndOperator +type AnalyticsAndOperator struct { + _ struct{} `type:"structure"` + + // The prefix to use when evaluating an AND predicate. + Prefix *string `type:"string"` + + // The list of tags to use when evaluating an AND predicate. + Tags []Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s AnalyticsAndOperator) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnalyticsAndOperator) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnalyticsAndOperator) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AnalyticsAndOperator"} + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AnalyticsAndOperator) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Tag", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsConfiguration +type AnalyticsConfiguration struct { + _ struct{} `type:"structure"` + + // The filter used to describe a set of objects for analyses. A filter must + // have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). + // If no filter is provided, all objects will be considered in any analysis. + Filter *AnalyticsFilter `type:"structure"` + + // The identifier used to represent an analytics configuration. + // + // Id is a required field + Id *string `type:"string" required:"true"` + + // If present, it indicates that data related to access patterns will be collected + // and made available to analyze the tradeoffs between different storage classes. + // + // StorageClassAnalysis is a required field + StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"` +} + +// String returns the string representation +func (s AnalyticsConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnalyticsConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnalyticsConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AnalyticsConfiguration"} + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if s.StorageClassAnalysis == nil { + invalidParams.Add(aws.NewErrParamRequired("StorageClassAnalysis")) + } + if s.Filter != nil { + if err := s.Filter.Validate(); err != nil { + invalidParams.AddNested("Filter", err.(aws.ErrInvalidParams)) + } + } + if s.StorageClassAnalysis != nil { + if err := s.StorageClassAnalysis.Validate(); err != nil { + invalidParams.AddNested("StorageClassAnalysis", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AnalyticsConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.StorageClassAnalysis != nil { + v := s.StorageClassAnalysis + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "StorageClassAnalysis", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsExportDestination +type AnalyticsExportDestination struct { + _ struct{} `type:"structure"` + + // A destination signifying output to an S3 bucket. + // + // S3BucketDestination is a required field + S3BucketDestination *AnalyticsS3BucketDestination `type:"structure" required:"true"` +} + +// String returns the string representation +func (s AnalyticsExportDestination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnalyticsExportDestination) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnalyticsExportDestination) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AnalyticsExportDestination"} + + if s.S3BucketDestination == nil { + invalidParams.Add(aws.NewErrParamRequired("S3BucketDestination")) + } + if s.S3BucketDestination != nil { + if err := s.S3BucketDestination.Validate(); err != nil { + invalidParams.AddNested("S3BucketDestination", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AnalyticsExportDestination) MarshalFields(e protocol.FieldEncoder) error { + if s.S3BucketDestination != nil { + v := s.S3BucketDestination + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "S3BucketDestination", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsFilter +type AnalyticsFilter struct { + _ struct{} `type:"structure"` + + // A conjunction (logical AND) of predicates, which is used in evaluating an + // analytics filter. The operator must have at least two predicates. + And *AnalyticsAndOperator `type:"structure"` + + // The prefix to use when evaluating an analytics filter. + Prefix *string `type:"string"` + + // The tag to use when evaluating an analytics filter. + Tag *Tag `type:"structure"` +} + +// String returns the string representation +func (s AnalyticsFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnalyticsFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnalyticsFilter) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AnalyticsFilter"} + if s.And != nil { + if err := s.And.Validate(); err != nil { + invalidParams.AddNested("And", err.(aws.ErrInvalidParams)) + } + } + if s.Tag != nil { + if err := s.Tag.Validate(); err != nil { + invalidParams.AddNested("Tag", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AnalyticsFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.And != nil { + v := s.And + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "And", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.Tag != nil { + v := s.Tag + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Tag", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsS3BucketDestination +type AnalyticsS3BucketDestination struct { + _ struct{} `type:"structure"` + + // The Amazon resource name (ARN) of the bucket to which data is exported. + // + // Bucket is a required field + Bucket *string `type:"string" required:"true"` + + // The account ID that owns the destination bucket. If no account ID is provided, + // the owner will not be validated prior to exporting data. + BucketAccountId *string `type:"string"` + + // The file format used when exporting data to Amazon S3. + // + // Format is a required field + Format AnalyticsS3ExportFileFormat `type:"string" required:"true" enum:"true"` + + // The prefix to use when exporting data. The exported data begins with this + // prefix. + Prefix *string `type:"string"` +} + +// String returns the string representation +func (s AnalyticsS3BucketDestination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AnalyticsS3BucketDestination) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AnalyticsS3BucketDestination) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AnalyticsS3BucketDestination"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if len(s.Format) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Format")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *AnalyticsS3BucketDestination) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s AnalyticsS3BucketDestination) MarshalFields(e protocol.FieldEncoder) error { + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.BucketAccountId != nil { + v := *s.BucketAccountId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "BucketAccountId", protocol.StringValue(v), metadata) + } + if len(s.Format) > 0 { + v := s.Format + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Format", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Bucket +type Bucket struct { + _ struct{} `type:"structure"` + + // Date the bucket was created. + CreationDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // The name of the bucket. + Name *string `type:"string"` +} + +// String returns the string representation +func (s Bucket) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Bucket) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Bucket) MarshalFields(e protocol.FieldEncoder) error { + if s.CreationDate != nil { + v := *s.CreationDate + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CreationDate", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketLifecycleConfiguration +type BucketLifecycleConfiguration struct { + _ struct{} `type:"structure"` + + // Rules is a required field + Rules []LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` +} + +// String returns the string representation +func (s BucketLifecycleConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BucketLifecycleConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BucketLifecycleConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "BucketLifecycleConfiguration"} + + if s.Rules == nil { + invalidParams.Add(aws.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s BucketLifecycleConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketLoggingStatus +type BucketLoggingStatus struct { + _ struct{} `type:"structure"` + + // Container for logging information. Presence of this element indicates that + // logging is enabled. Parameters TargetBucket and TargetPrefix are required + // in this case. + LoggingEnabled *LoggingEnabled `type:"structure"` +} + +// String returns the string representation +func (s BucketLoggingStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BucketLoggingStatus) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BucketLoggingStatus) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "BucketLoggingStatus"} + if s.LoggingEnabled != nil { + if err := s.LoggingEnabled.Validate(); err != nil { + invalidParams.AddNested("LoggingEnabled", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s BucketLoggingStatus) MarshalFields(e protocol.FieldEncoder) error { + if s.LoggingEnabled != nil { + v := s.LoggingEnabled + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "LoggingEnabled", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CORSConfiguration +type CORSConfiguration struct { + _ struct{} `type:"structure"` + + // CORSRules is a required field + CORSRules []CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"` +} + +// String returns the string representation +func (s CORSConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CORSConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CORSConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CORSConfiguration"} + + if s.CORSRules == nil { + invalidParams.Add(aws.NewErrParamRequired("CORSRules")) + } + if s.CORSRules != nil { + for i, v := range s.CORSRules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CORSRules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CORSConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.CORSRules) > 0 { + v := s.CORSRules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CORSRule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CORSRule +type CORSRule struct { + _ struct{} `type:"structure"` + + // Specifies which headers are allowed in a pre-flight OPTIONS request. + AllowedHeaders []string `locationName:"AllowedHeader" type:"list" flattened:"true"` + + // Identifies HTTP methods that the domain/origin specified in the rule is allowed + // to execute. + // + // AllowedMethods is a required field + AllowedMethods []string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"` + + // One or more origins you want customers to be able to access the bucket from. + // + // AllowedOrigins is a required field + AllowedOrigins []string `locationName:"AllowedOrigin" type:"list" flattened:"true" required:"true"` + + // One or more headers in the response that you want customers to be able to + // access from their applications (for example, from a JavaScript XMLHttpRequest + // object). + ExposeHeaders []string `locationName:"ExposeHeader" type:"list" flattened:"true"` + + // The time in seconds that your browser is to cache the preflight response + // for the specified resource. + MaxAgeSeconds *int64 `type:"integer"` +} + +// String returns the string representation +func (s CORSRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CORSRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CORSRule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CORSRule"} + + if s.AllowedMethods == nil { + invalidParams.Add(aws.NewErrParamRequired("AllowedMethods")) + } + + if s.AllowedOrigins == nil { + invalidParams.Add(aws.NewErrParamRequired("AllowedOrigins")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CORSRule) MarshalFields(e protocol.FieldEncoder) error { + if len(s.AllowedHeaders) > 0 { + v := s.AllowedHeaders + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "AllowedHeader", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if len(s.AllowedMethods) > 0 { + v := s.AllowedMethods + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "AllowedMethod", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if len(s.AllowedOrigins) > 0 { + v := s.AllowedOrigins + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "AllowedOrigin", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if len(s.ExposeHeaders) > 0 { + v := s.ExposeHeaders + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "ExposeHeader", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.MaxAgeSeconds != nil { + v := *s.MaxAgeSeconds + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxAgeSeconds", protocol.Int64Value(v), metadata) + } + return nil +} + +// Describes how a CSV-formatted input object is formatted. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CSVInput +type CSVInput struct { + _ struct{} `type:"structure"` + + // Specifies that CSV field values may contain quoted record delimiters and + // such records should be allowed. Default value is FALSE. Setting this value + // to TRUE may lower performance. + AllowQuotedRecordDelimiter *bool `type:"boolean"` + + // Single character used to indicate a row should be ignored when present at + // the start of a row. + Comments *string `type:"string"` + + // Value used to separate individual fields in a record. + FieldDelimiter *string `type:"string"` + + // Describes the first line of input. Valid values: None, Ignore, Use. + FileHeaderInfo FileHeaderInfo `type:"string" enum:"true"` + + // Value used for escaping where the field delimiter is part of the value. + QuoteCharacter *string `type:"string"` + + // Single character used for escaping the quote character inside an already + // escaped value. + QuoteEscapeCharacter *string `type:"string"` + + // Value used to separate individual records. + RecordDelimiter *string `type:"string"` +} + +// String returns the string representation +func (s CSVInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CSVInput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CSVInput) MarshalFields(e protocol.FieldEncoder) error { + if s.AllowQuotedRecordDelimiter != nil { + v := *s.AllowQuotedRecordDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "AllowQuotedRecordDelimiter", protocol.BoolValue(v), metadata) + } + if s.Comments != nil { + v := *s.Comments + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Comments", protocol.StringValue(v), metadata) + } + if s.FieldDelimiter != nil { + v := *s.FieldDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FieldDelimiter", protocol.StringValue(v), metadata) + } + if len(s.FileHeaderInfo) > 0 { + v := s.FileHeaderInfo + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FileHeaderInfo", v, metadata) + } + if s.QuoteCharacter != nil { + v := *s.QuoteCharacter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "QuoteCharacter", protocol.StringValue(v), metadata) + } + if s.QuoteEscapeCharacter != nil { + v := *s.QuoteEscapeCharacter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "QuoteEscapeCharacter", protocol.StringValue(v), metadata) + } + if s.RecordDelimiter != nil { + v := *s.RecordDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RecordDelimiter", protocol.StringValue(v), metadata) + } + return nil +} + +// Describes how CSV-formatted results are formatted. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CSVOutput +type CSVOutput struct { + _ struct{} `type:"structure"` + + // Value used to separate individual fields in a record. + FieldDelimiter *string `type:"string"` + + // Value used for escaping where the field delimiter is part of the value. + QuoteCharacter *string `type:"string"` + + // Single character used for escaping the quote character inside an already + // escaped value. + QuoteEscapeCharacter *string `type:"string"` + + // Indicates whether or not all output fields should be quoted. + QuoteFields QuoteFields `type:"string" enum:"true"` + + // Value used to separate individual records. + RecordDelimiter *string `type:"string"` +} + +// String returns the string representation +func (s CSVOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CSVOutput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CSVOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.FieldDelimiter != nil { + v := *s.FieldDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "FieldDelimiter", protocol.StringValue(v), metadata) + } + if s.QuoteCharacter != nil { + v := *s.QuoteCharacter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "QuoteCharacter", protocol.StringValue(v), metadata) + } + if s.QuoteEscapeCharacter != nil { + v := *s.QuoteEscapeCharacter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "QuoteEscapeCharacter", protocol.StringValue(v), metadata) + } + if len(s.QuoteFields) > 0 { + v := s.QuoteFields + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "QuoteFields", v, metadata) + } + if s.RecordDelimiter != nil { + v := *s.RecordDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RecordDelimiter", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CloudFunctionConfiguration +type CloudFunctionConfiguration struct { + _ struct{} `type:"structure"` + + CloudFunction *string `type:"string"` + + // Bucket event for which to send notifications. + Event Event `deprecated:"true" type:"string" enum:"true"` + + Events []Event `locationName:"Event" type:"list" flattened:"true"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + InvocationRole *string `type:"string"` +} + +// String returns the string representation +func (s CloudFunctionConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CloudFunctionConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CloudFunctionConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.CloudFunction != nil { + v := *s.CloudFunction + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CloudFunction", protocol.StringValue(v), metadata) + } + if len(s.Event) > 0 { + v := s.Event + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Event", v, metadata) + } + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.InvocationRole != nil { + v := *s.InvocationRole + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "InvocationRole", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CommonPrefix +type CommonPrefix struct { + _ struct{} `type:"structure"` + + Prefix *string `type:"string"` +} + +// String returns the string representation +func (s CommonPrefix) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CommonPrefix) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CommonPrefix) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUploadRequest +type CompleteMultipartUploadInput struct { + _ struct{} `type:"structure" payload:"MultipartUpload"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + MultipartUpload *CompletedMultipartUpload `locationName:"CompleteMultipartUpload" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // UploadId is a required field + UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s CompleteMultipartUploadInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompleteMultipartUploadInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CompleteMultipartUploadInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CompleteMultipartUploadInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.UploadId == nil { + invalidParams.Add(aws.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *CompleteMultipartUploadInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CompleteMultipartUploadInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.MultipartUpload != nil { + v := s.MultipartUpload + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "CompleteMultipartUpload", v, metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "uploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUploadOutput +type CompleteMultipartUploadOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Bucket *string `type:"string"` + + // Entity tag of the object. + ETag *string `type:"string"` + + // If the object expiration is configured, this will contain the expiration + // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. + Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` + + Key *string `min:"1" type:"string"` + + Location *string `type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // Version of the object. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s CompleteMultipartUploadOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompleteMultipartUploadOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CompleteMultipartUploadOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +func (s *CompleteMultipartUploadOutput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CompleteMultipartUploadOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Location != nil { + v := *s.Location + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Location", protocol.StringValue(v), metadata) + } + if s.Expiration != nil { + v := *s.Expiration + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-expiration", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompletedMultipartUpload +type CompletedMultipartUpload struct { + _ struct{} `type:"structure"` + + Parts []CompletedPart `locationName:"Part" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s CompletedMultipartUpload) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompletedMultipartUpload) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CompletedMultipartUpload) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Parts) > 0 { + v := s.Parts + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Part", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompletedPart +type CompletedPart struct { + _ struct{} `type:"structure"` + + // Entity tag returned when the part was uploaded. + ETag *string `type:"string"` + + // Part number that identifies the part. This is a positive integer between + // 1 and 10,000. + PartNumber *int64 `type:"integer"` +} + +// String returns the string representation +func (s CompletedPart) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CompletedPart) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CompletedPart) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "PartNumber", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Condition +type Condition struct { + _ struct{} `type:"structure"` + + // The HTTP error code when the redirect is applied. In the event of an error, + // if the error code equals this value, then the specified redirect is applied. + // Required when parent element Condition is specified and sibling KeyPrefixEquals + // is not specified. If both are specified, then both must be true for the redirect + // to be applied. + HttpErrorCodeReturnedEquals *string `type:"string"` + + // The object key name prefix when the redirect is applied. For example, to + // redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. + // To redirect request for all pages with the prefix docs/, the key prefix will + // be /docs, which identifies all objects in the docs/ folder. Required when + // the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals + // is not specified. If both conditions are specified, both must be true for + // the redirect to be applied. + KeyPrefixEquals *string `type:"string"` +} + +// String returns the string representation +func (s Condition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Condition) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Condition) MarshalFields(e protocol.FieldEncoder) error { + if s.HttpErrorCodeReturnedEquals != nil { + v := *s.HttpErrorCodeReturnedEquals + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "HttpErrorCodeReturnedEquals", protocol.StringValue(v), metadata) + } + if s.KeyPrefixEquals != nil { + v := *s.KeyPrefixEquals + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KeyPrefixEquals", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectRequest +type CopyObjectInput struct { + _ struct{} `type:"structure"` + + // The canned ACL to apply to the object. + ACL ObjectCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"Content-Type" type:"string"` + + // The name of the source bucket and key name of the source object, separated + // by a slash (/). Must be URL-encoded. + // + // CopySource is a required field + CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` + + // Copies the object if its entity tag (ETag) matches the specified tag. + CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` + + // Copies the object if it has been modified since the specified time. + CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` + + // Copies the object if its entity tag (ETag) is different than the specified + // ETag. + CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` + + // Copies the object if it hasn't been modified since the specified time. + CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` + + // Specifies the algorithm to use when decrypting the source object (e.g., AES256). + CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt + // the source object. The encryption key provided in this header must be one + // that was used when the source object was created. + CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` + + // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to read the object data and its metadata. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the object ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to write the ACL for the applicable object. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // A map of metadata to store with the object in S3. + Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // Specifies whether the metadata is copied from the source object or replaced + // with metadata provided in the request. + MetadataDirective MetadataDirective `location:"header" locationName:"x-amz-metadata-directive" type:"string" enum:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT + // requests for an object protected by AWS KMS will fail if not made via SSL + // or using SigV4. Documentation on configuring any of the officially supported + // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // The type of storage to use for the object. Defaults to 'STANDARD'. + StorageClass StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"true"` + + // The tag-set for the object destination object this value must be used in + // conjunction with the TaggingDirective. The tag-set must be encoded as URL + // Query parameters + Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` + + // Specifies whether the object tag-set are copied from the source object or + // replaced with tag-set provided in the request. + TaggingDirective TaggingDirective `location:"header" locationName:"x-amz-tagging-directive" type:"string" enum:"true"` + + // If the bucket is configured as a website, redirects requests for this object + // to another object in the same bucket or to an external URL. Amazon S3 stores + // the value of this header in the object metadata. + WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` +} + +// String returns the string representation +func (s CopyObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopyObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CopyObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CopyObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.CopySource == nil { + invalidParams.Add(aws.NewErrParamRequired("CopySource")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *CopyObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *CopyObjectInput) getCopySourceSSECustomerKey() (v string) { + if s.CopySourceSSECustomerKey == nil { + return v + } + return *s.CopySourceSSECustomerKey +} + +func (s *CopyObjectInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CopyObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.CacheControl != nil { + v := *s.CacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Cache-Control", protocol.StringValue(v), metadata) + } + if s.ContentDisposition != nil { + v := *s.ContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Disposition", protocol.StringValue(v), metadata) + } + if s.ContentEncoding != nil { + v := *s.ContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Encoding", protocol.StringValue(v), metadata) + } + if s.ContentLanguage != nil { + v := *s.ContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Language", protocol.StringValue(v), metadata) + } + if s.ContentType != nil { + v := *s.ContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue(v), metadata) + } + if s.CopySource != nil { + v := *s.CopySource + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source", protocol.StringValue(v), metadata) + } + if s.CopySourceIfMatch != nil { + v := *s.CopySourceIfMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-match", protocol.StringValue(v), metadata) + } + if s.CopySourceIfModifiedSince != nil { + v := *s.CopySourceIfModifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-modified-since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.CopySourceIfNoneMatch != nil { + v := *s.CopySourceIfNoneMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-none-match", protocol.StringValue(v), metadata) + } + if s.CopySourceIfUnmodifiedSince != nil { + v := *s.CopySourceIfUnmodifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-unmodified-since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.CopySourceSSECustomerAlgorithm != nil { + v := *s.CopySourceSSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.CopySourceSSECustomerKey != nil { + v := *s.CopySourceSSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.CopySourceSSECustomerKeyMD5 != nil { + v := *s.CopySourceSSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.Expires != nil { + v := *s.Expires + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Expires", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if len(s.MetadataDirective) > 0 { + v := s.MetadataDirective + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-metadata-directive", v, metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-storage-class", v, metadata) + } + if s.Tagging != nil { + v := *s.Tagging + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-tagging", protocol.StringValue(v), metadata) + } + if len(s.TaggingDirective) > 0 { + v := s.TaggingDirective + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-tagging-directive", v, metadata) + } + if s.WebsiteRedirectLocation != nil { + v := *s.WebsiteRedirectLocation + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-website-redirect-location", protocol.StringValue(v), metadata) + } + if len(s.Metadata) > 0 { + v := s.Metadata + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.HeadersTarget, "x-amz-meta-", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.StringValue(v1)) + } + ms0.End() + + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectOutput +type CopyObjectOutput struct { + _ struct{} `type:"structure" payload:"CopyObjectResult"` + + responseMetadata aws.Response + + CopyObjectResult *CopyObjectResult `type:"structure"` + + CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` + + // If the object expiration is configured, the response includes this header. + Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // Version ID of the newly created copy. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s CopyObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopyObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CopyObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CopyObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.CopySourceVersionId != nil { + v := *s.CopySourceVersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-version-id", protocol.StringValue(v), metadata) + } + if s.Expiration != nil { + v := *s.Expiration + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-expiration", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + if s.CopyObjectResult != nil { + v := s.CopyObjectResult + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "CopyObjectResult", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectResult +type CopyObjectResult struct { + _ struct{} `type:"structure"` + + ETag *string `type:"string"` + + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` +} + +// String returns the string representation +func (s CopyObjectResult) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopyObjectResult) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CopyObjectResult) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyPartResult +type CopyPartResult struct { + _ struct{} `type:"structure"` + + // Entity tag of the object. + ETag *string `type:"string"` + + // Date and time at which the object was uploaded. + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` +} + +// String returns the string representation +func (s CopyPartResult) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopyPartResult) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CopyPartResult) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketConfiguration +type CreateBucketConfiguration struct { + _ struct{} `type:"structure"` + + // Specifies the region where the bucket will be created. If you don't specify + // a region, the bucket will be created in US Standard. + LocationConstraint BucketLocationConstraint `type:"string" enum:"true"` +} + +// String returns the string representation +func (s CreateBucketConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateBucketConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateBucketConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.LocationConstraint) > 0 { + v := s.LocationConstraint + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LocationConstraint", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketRequest +type CreateBucketInput struct { + _ struct{} `type:"structure" payload:"CreateBucketConfiguration"` + + // The canned ACL to apply to the bucket. + ACL BucketCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + CreateBucketConfiguration *CreateBucketConfiguration `locationName:"CreateBucketConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // Allows grantee the read, write, read ACP, and write ACP permissions on the + // bucket. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to list the objects in the bucket. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the bucket ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to create, overwrite, and delete any object in the bucket. + GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` + + // Allows grantee to write the ACL for the applicable bucket. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` +} + +// String returns the string representation +func (s CreateBucketInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateBucketInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateBucketInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateBucketInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *CreateBucketInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateBucketInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWrite != nil { + v := *s.GrantWrite + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.CreateBucketConfiguration != nil { + v := s.CreateBucketConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "CreateBucketConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketOutput +type CreateBucketOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Location *string `location:"header" locationName:"Location" type:"string"` +} + +// String returns the string representation +func (s CreateBucketOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateBucketOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateBucketOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateBucketOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Location != nil { + v := *s.Location + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Location", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUploadRequest +type CreateMultipartUploadInput struct { + _ struct{} `type:"structure"` + + // The canned ACL to apply to the object. + ACL ObjectCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"Content-Type" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` + + // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to read the object data and its metadata. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the object ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to write the ACL for the applicable object. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // A map of metadata to store with the object in S3. + Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT + // requests for an object protected by AWS KMS will fail if not made via SSL + // or using SigV4. Documentation on configuring any of the officially supported + // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // The type of storage to use for the object. Defaults to 'STANDARD'. + StorageClass StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"true"` + + // The tag-set for the object. The tag-set must be encoded as URL Query parameters + Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` + + // If the bucket is configured as a website, redirects requests for this object + // to another object in the same bucket or to an external URL. Amazon S3 stores + // the value of this header in the object metadata. + WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` +} + +// String returns the string representation +func (s CreateMultipartUploadInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateMultipartUploadInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateMultipartUploadInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "CreateMultipartUploadInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *CreateMultipartUploadInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *CreateMultipartUploadInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateMultipartUploadInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.CacheControl != nil { + v := *s.CacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Cache-Control", protocol.StringValue(v), metadata) + } + if s.ContentDisposition != nil { + v := *s.ContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Disposition", protocol.StringValue(v), metadata) + } + if s.ContentEncoding != nil { + v := *s.ContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Encoding", protocol.StringValue(v), metadata) + } + if s.ContentLanguage != nil { + v := *s.ContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Language", protocol.StringValue(v), metadata) + } + if s.ContentType != nil { + v := *s.ContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue(v), metadata) + } + if s.Expires != nil { + v := *s.Expires + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Expires", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-storage-class", v, metadata) + } + if s.Tagging != nil { + v := *s.Tagging + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-tagging", protocol.StringValue(v), metadata) + } + if s.WebsiteRedirectLocation != nil { + v := *s.WebsiteRedirectLocation + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-website-redirect-location", protocol.StringValue(v), metadata) + } + if len(s.Metadata) > 0 { + v := s.Metadata + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.HeadersTarget, "x-amz-meta-", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.StringValue(v1)) + } + ms0.End() + + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUploadOutput +type CreateMultipartUploadOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + + // Name of the bucket to which the multipart upload was initiated. + Bucket *string `locationName:"Bucket" type:"string"` + + // Object key for which the multipart upload was initiated. + Key *string `min:"1" type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // ID for the initiated multipart upload. + UploadId *string `type:"string"` +} + +// String returns the string representation +func (s CreateMultipartUploadOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateMultipartUploadOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s CreateMultipartUploadOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +func (s *CreateMultipartUploadOutput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s CreateMultipartUploadOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UploadId", protocol.StringValue(v), metadata) + } + if s.AbortDate != nil { + v := *s.AbortDate + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-abort-date", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.AbortRuleId != nil { + v := *s.AbortRuleId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-abort-rule-id", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Delete +type Delete struct { + _ struct{} `type:"structure"` + + // Objects is a required field + Objects []ObjectIdentifier `locationName:"Object" type:"list" flattened:"true" required:"true"` + + // Element to enable quiet mode for the request. When you add this element, + // you must set its value to true. + Quiet *bool `type:"boolean"` +} + +// String returns the string representation +func (s Delete) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Delete) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Delete) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Delete"} + + if s.Objects == nil { + invalidParams.Add(aws.NewErrParamRequired("Objects")) + } + if s.Objects != nil { + for i, v := range s.Objects { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Objects", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Delete) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Objects) > 0 { + v := s.Objects + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Object", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Quiet != nil { + v := *s.Quiet + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Quiet", protocol.BoolValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfigurationRequest +type DeleteBucketAnalyticsConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket from which an analytics configuration is deleted. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The identifier used to represent an analytics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketAnalyticsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketAnalyticsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketAnalyticsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketAnalyticsConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketAnalyticsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketAnalyticsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfigurationOutput +type DeleteBucketAnalyticsConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketAnalyticsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketAnalyticsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketAnalyticsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketAnalyticsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCorsRequest +type DeleteBucketCorsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketCorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketCorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketCorsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketCorsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketCorsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketCorsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCorsOutput +type DeleteBucketCorsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketCorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketCorsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketCorsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketCorsOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryptionRequest +type DeleteBucketEncryptionInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the server-side encryption configuration + // to delete. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketEncryptionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketEncryptionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketEncryptionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketEncryptionInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketEncryptionInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketEncryptionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryptionOutput +type DeleteBucketEncryptionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketEncryptionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketEncryptionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketEncryptionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketEncryptionOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketRequest +type DeleteBucketInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfigurationRequest +type DeleteBucketInventoryConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the inventory configuration to delete. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the inventory configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketInventoryConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketInventoryConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketInventoryConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketInventoryConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketInventoryConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketInventoryConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfigurationOutput +type DeleteBucketInventoryConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketInventoryConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketInventoryConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketInventoryConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketInventoryConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycleRequest +type DeleteBucketLifecycleInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketLifecycleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketLifecycleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketLifecycleInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketLifecycleInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketLifecycleInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketLifecycleInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycleOutput +type DeleteBucketLifecycleOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketLifecycleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketLifecycleOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketLifecycleOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketLifecycleOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfigurationRequest +type DeleteBucketMetricsConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the metrics configuration to delete. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the metrics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketMetricsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketMetricsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketMetricsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketMetricsConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketMetricsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketMetricsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfigurationOutput +type DeleteBucketMetricsConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketMetricsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketMetricsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketMetricsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketMetricsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketOutput +type DeleteBucketOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicyRequest +type DeleteBucketPolicyInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketPolicyInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketPolicyInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketPolicyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicyOutput +type DeleteBucketPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketPolicyOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplicationRequest +type DeleteBucketReplicationInput struct { + _ struct{} `type:"structure"` + + // Deletes the replication subresource associated with the specified bucket. + // + // There is usually some time lag before replication configuration deletion + // is fully propagated to all the Amazon S3 systems. + // + // For more information, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) + // in the Amazon S3 Developer Guide. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketReplicationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketReplicationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketReplicationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketReplicationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketReplicationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketReplicationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplicationOutput +type DeleteBucketReplicationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketReplicationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketReplicationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketReplicationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketReplicationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTaggingRequest +type DeleteBucketTaggingInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTaggingOutput +type DeleteBucketTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsiteRequest +type DeleteBucketWebsiteInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteBucketWebsiteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketWebsiteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteBucketWebsiteInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteBucketWebsiteInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteBucketWebsiteInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketWebsiteInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsiteOutput +type DeleteBucketWebsiteOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s DeleteBucketWebsiteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteBucketWebsiteOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteBucketWebsiteOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteBucketWebsiteOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteMarkerEntry +type DeleteMarkerEntry struct { + _ struct{} `type:"structure"` + + // Specifies whether the object is (true) or is not (false) the latest version + // of an object. + IsLatest *bool `type:"boolean"` + + // The object key. + Key *string `min:"1" type:"string"` + + // Date and time the object was last modified. + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + Owner *Owner `type:"structure"` + + // Version ID of an object. + VersionId *string `type:"string"` +} + +// String returns the string representation +func (s DeleteMarkerEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMarkerEntry) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteMarkerEntry) MarshalFields(e protocol.FieldEncoder) error { + if s.IsLatest != nil { + v := *s.IsLatest + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsLatest", protocol.BoolValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Specifies whether Amazon S3 should replicate delete makers. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteMarkerReplication +type DeleteMarkerReplication struct { + _ struct{} `type:"structure"` + + // The status of the delete marker replication. + // + // In the current implementation, Amazon S3 does not replicate the delete markers. + // Therefore, the status must be Disabled. + Status DeleteMarkerReplicationStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s DeleteMarkerReplication) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMarkerReplication) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteMarkerReplication) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectRequest +type DeleteObjectInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // The concatenation of the authentication device's serial number, a space, + // and the value that is displayed on your authentication device. + MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s DeleteObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.MFA != nil { + v := *s.MFA + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-mfa", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectOutput +type DeleteObjectOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Specifies whether the versioned object that was permanently deleted was (true) + // or was not (false) a delete marker. + DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // Returns the version ID of the delete marker created as a result of the DELETE + // operation. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s DeleteObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.DeleteMarker != nil { + v := *s.DeleteMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-delete-marker", protocol.BoolValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTaggingRequest +type DeleteObjectTaggingInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // The versionId of the object that the tag-set will be removed from. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s DeleteObjectTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteObjectTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteObjectTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteObjectTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTaggingOutput +type DeleteObjectTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The versionId of the object the tag-set was removed from. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s DeleteObjectTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteObjectTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectsRequest +type DeleteObjectsInput struct { + _ struct{} `type:"structure" payload:"Delete"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Delete is a required field + Delete *Delete `locationName:"Delete" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // The concatenation of the authentication device's serial number, a space, + // and the value that is displayed on your authentication device. + MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` +} + +// String returns the string representation +func (s DeleteObjectsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteObjectsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DeleteObjectsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Delete == nil { + invalidParams.Add(aws.NewErrParamRequired("Delete")) + } + if s.Delete != nil { + if err := s.Delete.Validate(); err != nil { + invalidParams.AddNested("Delete", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *DeleteObjectsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.MFA != nil { + v := *s.MFA + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-mfa", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Delete != nil { + v := s.Delete + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "Delete", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectsOutput +type DeleteObjectsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Deleted []DeletedObject `type:"list" flattened:"true"` + + Errors []Error `locationName:"Error" type:"list" flattened:"true"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` +} + +// String returns the string representation +func (s DeleteObjectsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteObjectsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DeleteObjectsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeleteObjectsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Deleted) > 0 { + v := s.Deleted + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Deleted", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.Errors) > 0 { + v := s.Errors + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Error", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeletedObject +type DeletedObject struct { + _ struct{} `type:"structure"` + + DeleteMarker *bool `type:"boolean"` + + DeleteMarkerVersionId *string `type:"string"` + + Key *string `min:"1" type:"string"` + + VersionId *string `type:"string"` +} + +// String returns the string representation +func (s DeletedObject) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeletedObject) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s DeletedObject) MarshalFields(e protocol.FieldEncoder) error { + if s.DeleteMarker != nil { + v := *s.DeleteMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DeleteMarker", protocol.BoolValue(v), metadata) + } + if s.DeleteMarkerVersionId != nil { + v := *s.DeleteMarkerVersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DeleteMarkerVersionId", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for replication destination information. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Destination +type Destination struct { + _ struct{} `type:"structure"` + + // Container for information regarding the access control for replicas. + // + // Use only in a cross-account scenario, where source and destination bucket + // owners are not the same, when you want to change replica ownership to the + // AWS account that owns the destination bucket. If you don't add this element + // to the replication configuration, the replicas are owned by same AWS account + // that owns the source object. + AccessControlTranslation *AccessControlTranslation `type:"structure"` + + // Account ID of the destination bucket. Currently Amazon S3 verifies this value + // only if Access Control Translation is enabled. + // + // In a cross-account scenario, if you tell Amazon S3 to change replica ownership + // to the AWS account that owns the destination bucket by adding the AccessControlTranslation + // element, this is the account ID of the destination bucket owner. + Account *string `type:"string"` + + // Amazon resource name (ARN) of the bucket where you want Amazon S3 to store + // replicas of the object identified by the rule. + // + // If you have multiple rules in your replication configuration, all rules must + // specify the same bucket as the destination. A replication configuration can + // replicate objects only to one destination bucket. + // + // Bucket is a required field + Bucket *string `type:"string" required:"true"` + + // Container that provides encryption-related information. You must specify + // this element if the SourceSelectionCriteria is specified. + EncryptionConfiguration *EncryptionConfiguration `type:"structure"` + + // The class of storage used to store the object. + StorageClass StorageClass `type:"string" enum:"true"` +} + +// String returns the string representation +func (s Destination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Destination) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Destination) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Destination"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if s.AccessControlTranslation != nil { + if err := s.AccessControlTranslation.Validate(); err != nil { + invalidParams.AddNested("AccessControlTranslation", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *Destination) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Destination) MarshalFields(e protocol.FieldEncoder) error { + if s.AccessControlTranslation != nil { + v := s.AccessControlTranslation + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "AccessControlTranslation", v, metadata) + } + if s.Account != nil { + v := *s.Account + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Account", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.EncryptionConfiguration != nil { + v := s.EncryptionConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "EncryptionConfiguration", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + return nil +} + +// Describes the server-side encryption that will be applied to the restore +// results. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Encryption +type Encryption struct { + _ struct{} `type:"structure"` + + // The server-side encryption algorithm used when storing job results in Amazon + // S3 (e.g., AES256, aws:kms). + // + // EncryptionType is a required field + EncryptionType ServerSideEncryption `type:"string" required:"true" enum:"true"` + + // If the encryption type is aws:kms, this optional value can be used to specify + // the encryption context for the restore results. + KMSContext *string `type:"string"` + + // If the encryption type is aws:kms, this optional value specifies the AWS + // KMS key ID to use for encryption of job results. + KMSKeyId *string `type:"string"` +} + +// String returns the string representation +func (s Encryption) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Encryption) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Encryption) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Encryption"} + if len(s.EncryptionType) == 0 { + invalidParams.Add(aws.NewErrParamRequired("EncryptionType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Encryption) MarshalFields(e protocol.FieldEncoder) error { + if len(s.EncryptionType) > 0 { + v := s.EncryptionType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EncryptionType", v, metadata) + } + if s.KMSContext != nil { + v := *s.KMSContext + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSContext", protocol.StringValue(v), metadata) + } + if s.KMSKeyId != nil { + v := *s.KMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSKeyId", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for information regarding encryption based configuration for replicas. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/EncryptionConfiguration +type EncryptionConfiguration struct { + _ struct{} `type:"structure"` + + // The ID of the AWS KMS key for the region where the destination bucket resides. + // Amazon S3 uses this key to encrypt the replica object. + ReplicaKmsKeyID *string `type:"string"` +} + +// String returns the string representation +func (s EncryptionConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EncryptionConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s EncryptionConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.ReplicaKmsKeyID != nil { + v := *s.ReplicaKmsKeyID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ReplicaKmsKeyID", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Error +type Error struct { + _ struct{} `type:"structure"` + + Code *string `type:"string"` + + Key *string `min:"1" type:"string"` + + Message *string `type:"string"` + + VersionId *string `type:"string"` +} + +// String returns the string representation +func (s Error) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Error) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Error) MarshalFields(e protocol.FieldEncoder) error { + if s.Code != nil { + v := *s.Code + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Code", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Message != nil { + v := *s.Message + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Message", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ErrorDocument +type ErrorDocument struct { + _ struct{} `type:"structure"` + + // The object key name to use when a 4XX class error occurs. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ErrorDocument) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ErrorDocument) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ErrorDocument) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ErrorDocument"} + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ErrorDocument) MarshalFields(e protocol.FieldEncoder) error { + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for key value pair that defines the criteria for the filter rule. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/FilterRule +type FilterRule struct { + _ struct{} `type:"structure"` + + // Object key name prefix or suffix identifying one or more objects to which + // the filtering rule applies. Maximum prefix length can be up to 1,024 characters. + // Overlapping prefixes and suffixes are not supported. For more information, + // go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + Name FilterRuleName `type:"string" enum:"true"` + + Value *string `type:"string"` +} + +// String returns the string representation +func (s FilterRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FilterRule) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s FilterRule) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Name) > 0 { + v := s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", v, metadata) + } + if s.Value != nil { + v := *s.Value + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Value", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfigurationRequest +type GetBucketAccelerateConfigurationInput struct { + _ struct{} `type:"structure"` + + // Name of the bucket for which the accelerate configuration is retrieved. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketAccelerateConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAccelerateConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketAccelerateConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketAccelerateConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketAccelerateConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAccelerateConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfigurationOutput +type GetBucketAccelerateConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The accelerate configuration of the bucket. + Status BucketAccelerateStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetBucketAccelerateConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAccelerateConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketAccelerateConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAccelerateConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAclRequest +type GetBucketAclInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketAclInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAclInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketAclInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketAclInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketAclInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAclInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAclOutput +type GetBucketAclOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of grants. + Grants []Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` + + Owner *Owner `type:"structure"` +} + +// String returns the string representation +func (s GetBucketAclOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAclOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketAclOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAclOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Grants) > 0 { + v := s.Grants + + metadata := protocol.Metadata{ListLocationName: "Grant"} + ls0 := e.List(protocol.BodyTarget, "AccessControlList", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfigurationRequest +type GetBucketAnalyticsConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket from which an analytics configuration is retrieved. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The identifier used to represent an analytics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketAnalyticsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAnalyticsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketAnalyticsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketAnalyticsConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketAnalyticsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAnalyticsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfigurationOutput +type GetBucketAnalyticsConfigurationOutput struct { + _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` + + responseMetadata aws.Response + + // The configuration and any analyses for the analytics filter. + AnalyticsConfiguration *AnalyticsConfiguration `type:"structure"` +} + +// String returns the string representation +func (s GetBucketAnalyticsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketAnalyticsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketAnalyticsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketAnalyticsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.AnalyticsConfiguration != nil { + v := s.AnalyticsConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "AnalyticsConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCorsRequest +type GetBucketCorsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketCorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketCorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketCorsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketCorsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketCorsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketCorsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCorsOutput +type GetBucketCorsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + CORSRules []CORSRule `locationName:"CORSRule" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s GetBucketCorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketCorsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketCorsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketCorsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.CORSRules) > 0 { + v := s.CORSRules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CORSRule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryptionRequest +type GetBucketEncryptionInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket from which the server-side encryption configuration + // is retrieved. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketEncryptionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketEncryptionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketEncryptionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketEncryptionInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketEncryptionInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketEncryptionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryptionOutput +type GetBucketEncryptionOutput struct { + _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` + + responseMetadata aws.Response + + // Container for server-side encryption configuration rules. Currently S3 supports + // one rule only. + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `type:"structure"` +} + +// String returns the string representation +func (s GetBucketEncryptionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketEncryptionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketEncryptionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketEncryptionOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ServerSideEncryptionConfiguration != nil { + v := s.ServerSideEncryptionConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "ServerSideEncryptionConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfigurationRequest +type GetBucketInventoryConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the inventory configuration to retrieve. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the inventory configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketInventoryConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketInventoryConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketInventoryConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketInventoryConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketInventoryConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketInventoryConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfigurationOutput +type GetBucketInventoryConfigurationOutput struct { + _ struct{} `type:"structure" payload:"InventoryConfiguration"` + + responseMetadata aws.Response + + // Specifies the inventory configuration. + InventoryConfiguration *InventoryConfiguration `type:"structure"` +} + +// String returns the string representation +func (s GetBucketInventoryConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketInventoryConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketInventoryConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketInventoryConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.InventoryConfiguration != nil { + v := s.InventoryConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "InventoryConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfigurationRequest +type GetBucketLifecycleConfigurationInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketLifecycleConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLifecycleConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLifecycleConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketLifecycleConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketLifecycleConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLifecycleConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfigurationOutput +type GetBucketLifecycleConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Rules []LifecycleRule `locationName:"Rule" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s GetBucketLifecycleConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLifecycleConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketLifecycleConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLifecycleConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleRequest +type GetBucketLifecycleInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketLifecycleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLifecycleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLifecycleInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketLifecycleInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketLifecycleInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLifecycleInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleOutput +type GetBucketLifecycleOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Rules []Rule `locationName:"Rule" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s GetBucketLifecycleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLifecycleOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketLifecycleOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLifecycleOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocationRequest +type GetBucketLocationInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketLocationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLocationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLocationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketLocationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketLocationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLocationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocationOutput +type GetBucketLocationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + LocationConstraint BucketLocationConstraint `type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetBucketLocationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLocationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketLocationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLocationOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.LocationConstraint) > 0 { + v := s.LocationConstraint + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LocationConstraint", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLoggingRequest +type GetBucketLoggingInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketLoggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLoggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketLoggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketLoggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketLoggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLoggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLoggingOutput +type GetBucketLoggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Container for logging information. Presence of this element indicates that + // logging is enabled. Parameters TargetBucket and TargetPrefix are required + // in this case. + LoggingEnabled *LoggingEnabled `type:"structure"` +} + +// String returns the string representation +func (s GetBucketLoggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketLoggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketLoggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketLoggingOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.LoggingEnabled != nil { + v := s.LoggingEnabled + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "LoggingEnabled", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfigurationRequest +type GetBucketMetricsConfigurationInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the metrics configuration to retrieve. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the metrics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketMetricsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketMetricsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketMetricsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketMetricsConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketMetricsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketMetricsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfigurationOutput +type GetBucketMetricsConfigurationOutput struct { + _ struct{} `type:"structure" payload:"MetricsConfiguration"` + + responseMetadata aws.Response + + // Specifies the metrics configuration. + MetricsConfiguration *MetricsConfiguration `type:"structure"` +} + +// String returns the string representation +func (s GetBucketMetricsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketMetricsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketMetricsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketMetricsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.MetricsConfiguration != nil { + v := s.MetricsConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "MetricsConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationInput +type GetBucketNotificationConfigurationInput struct { + _ struct{} `type:"structure"` + + // Name of the bucket to get the notification configuration for. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketNotificationConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketNotificationConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketNotificationConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketNotificationConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketNotificationConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketNotificationConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for specifying the notification configuration of the bucket. If +// this element is empty, notifications are turned off on the bucket. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfiguration +type GetBucketNotificationConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + LambdaFunctionConfigurations []LambdaFunctionConfiguration `locationName:"CloudFunctionConfiguration" type:"list" flattened:"true"` + + QueueConfigurations []QueueConfiguration `locationName:"QueueConfiguration" type:"list" flattened:"true"` + + TopicConfigurations []TopicConfiguration `locationName:"TopicConfiguration" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s GetBucketNotificationConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketNotificationConfigurationOutput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketNotificationConfigurationOutput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketNotificationConfigurationOutput"} + if s.LambdaFunctionConfigurations != nil { + for i, v := range s.LambdaFunctionConfigurations { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LambdaFunctionConfigurations", i), err.(aws.ErrInvalidParams)) + } + } + } + if s.QueueConfigurations != nil { + for i, v := range s.QueueConfigurations { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "QueueConfigurations", i), err.(aws.ErrInvalidParams)) + } + } + } + if s.TopicConfigurations != nil { + for i, v := range s.TopicConfigurations { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TopicConfigurations", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketNotificationConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketNotificationConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.LambdaFunctionConfigurations) > 0 { + v := s.LambdaFunctionConfigurations + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CloudFunctionConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.QueueConfigurations) > 0 { + v := s.QueueConfigurations + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "QueueConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.TopicConfigurations) > 0 { + v := s.TopicConfigurations + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "TopicConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfigurationDeprecated +type GetBucketNotificationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + CloudFunctionConfiguration *CloudFunctionConfiguration `type:"structure"` + + QueueConfiguration *QueueConfigurationDeprecated `type:"structure"` + + TopicConfiguration *TopicConfigurationDeprecated `type:"structure"` +} + +// String returns the string representation +func (s GetBucketNotificationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketNotificationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketNotificationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketNotificationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.CloudFunctionConfiguration != nil { + v := s.CloudFunctionConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "CloudFunctionConfiguration", v, metadata) + } + if s.QueueConfiguration != nil { + v := s.QueueConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "QueueConfiguration", v, metadata) + } + if s.TopicConfiguration != nil { + v := s.TopicConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "TopicConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyRequest +type GetBucketPolicyInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketPolicyInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketPolicyInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketPolicyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyOutput +type GetBucketPolicyOutput struct { + _ struct{} `type:"structure" payload:"Policy"` + + responseMetadata aws.Response + + // The bucket policy as a JSON document. + Policy *string `type:"string"` +} + +// String returns the string representation +func (s GetBucketPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketPolicyOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Policy != nil { + v := *s.Policy + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Policy", protocol.StringStream(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplicationRequest +type GetBucketReplicationInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketReplicationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketReplicationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketReplicationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketReplicationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketReplicationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketReplicationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplicationOutput +type GetBucketReplicationOutput struct { + _ struct{} `type:"structure" payload:"ReplicationConfiguration"` + + responseMetadata aws.Response + + // Container for replication rules. You can add as many as 1,000 rules. Total + // replication configuration size can be up to 2 MB. + ReplicationConfiguration *ReplicationConfiguration `type:"structure"` +} + +// String returns the string representation +func (s GetBucketReplicationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketReplicationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketReplicationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketReplicationOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ReplicationConfiguration != nil { + v := s.ReplicationConfiguration + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "ReplicationConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPaymentRequest +type GetBucketRequestPaymentInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketRequestPaymentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketRequestPaymentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketRequestPaymentInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketRequestPaymentInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketRequestPaymentInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketRequestPaymentInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPaymentOutput +type GetBucketRequestPaymentOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Specifies who pays for the download and request fees. + Payer Payer `type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetBucketRequestPaymentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketRequestPaymentOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketRequestPaymentOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketRequestPaymentOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Payer) > 0 { + v := s.Payer + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Payer", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTaggingRequest +type GetBucketTaggingInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTaggingOutput +type GetBucketTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // TagSet is a required field + TagSet []Tag `locationNameList:"Tag" type:"list" required:"true"` +} + +// String returns the string representation +func (s GetBucketTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.TagSet) > 0 { + v := s.TagSet + + metadata := protocol.Metadata{ListLocationName: "Tag"} + ls0 := e.List(protocol.BodyTarget, "TagSet", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioningRequest +type GetBucketVersioningInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketVersioningInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketVersioningInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketVersioningInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketVersioningInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketVersioningInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketVersioningInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioningOutput +type GetBucketVersioningOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Specifies whether MFA delete is enabled in the bucket versioning configuration. + // This element is only returned if the bucket has been configured with MFA + // delete. If the bucket has never been so configured, this element is not returned. + MFADelete MFADeleteStatus `locationName:"MfaDelete" type:"string" enum:"true"` + + // The versioning state of the bucket. + Status BucketVersioningStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetBucketVersioningOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketVersioningOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketVersioningOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketVersioningOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.MFADelete) > 0 { + v := s.MFADelete + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MfaDelete", v, metadata) + } + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsiteRequest +type GetBucketWebsiteInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetBucketWebsiteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketWebsiteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetBucketWebsiteInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetBucketWebsiteInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetBucketWebsiteInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketWebsiteInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsiteOutput +type GetBucketWebsiteOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + ErrorDocument *ErrorDocument `type:"structure"` + + IndexDocument *IndexDocument `type:"structure"` + + RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` + + RoutingRules []RoutingRule `locationNameList:"RoutingRule" type:"list"` +} + +// String returns the string representation +func (s GetBucketWebsiteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetBucketWebsiteOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetBucketWebsiteOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetBucketWebsiteOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ErrorDocument != nil { + v := s.ErrorDocument + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "ErrorDocument", v, metadata) + } + if s.IndexDocument != nil { + v := s.IndexDocument + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "IndexDocument", v, metadata) + } + if s.RedirectAllRequestsTo != nil { + v := s.RedirectAllRequestsTo + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "RedirectAllRequestsTo", v, metadata) + } + if len(s.RoutingRules) > 0 { + v := s.RoutingRules + + metadata := protocol.Metadata{ListLocationName: "RoutingRule"} + ls0 := e.List(protocol.BodyTarget, "RoutingRules", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAclRequest +type GetObjectAclInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s GetObjectAclInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectAclInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectAclInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetObjectAclInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetObjectAclInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectAclInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAclOutput +type GetObjectAclOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // A list of grants. + Grants []Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` + + Owner *Owner `type:"structure"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetObjectAclOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectAclOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetObjectAclOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectAclOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Grants) > 0 { + v := s.Grants + + metadata := protocol.Metadata{ListLocationName: "Grant"} + ls0 := e.List(protocol.BodyTarget, "AccessControlList", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectRequest +type GetObjectInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Return the object only if its entity tag (ETag) is the same as the one specified, + // otherwise return a 412 (precondition failed). + IfMatch *string `location:"header" locationName:"If-Match" type:"string"` + + // Return the object only if it has been modified since the specified time, + // otherwise return a 304 (not modified). + IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` + + // Return the object only if its entity tag (ETag) is different from the one + // specified, otherwise return a 304 (not modified). + IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` + + // Return the object only if it has not been modified since the specified time, + // otherwise return a 412 (precondition failed). + IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Part number of the object being read. This is a positive integer between + // 1 and 10,000. Effectively performs a 'ranged' GET request for the part specified. + // Useful for downloading just a part of an object. + PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` + + // Downloads the specified range bytes of an object. For more information about + // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. + Range *string `location:"header" locationName:"Range" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Sets the Cache-Control header of the response. + ResponseCacheControl *string `location:"querystring" locationName:"response-cache-control" type:"string"` + + // Sets the Content-Disposition header of the response + ResponseContentDisposition *string `location:"querystring" locationName:"response-content-disposition" type:"string"` + + // Sets the Content-Encoding header of the response. + ResponseContentEncoding *string `location:"querystring" locationName:"response-content-encoding" type:"string"` + + // Sets the Content-Language header of the response. + ResponseContentLanguage *string `location:"querystring" locationName:"response-content-language" type:"string"` + + // Sets the Content-Type header of the response. + ResponseContentType *string `location:"querystring" locationName:"response-content-type" type:"string"` + + // Sets the Expires header of the response. + ResponseExpires *time.Time `location:"querystring" locationName:"response-expires" type:"timestamp" timestampFormat:"iso8601"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s GetObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *GetObjectInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.IfMatch != nil { + v := *s.IfMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Match", protocol.StringValue(v), metadata) + } + if s.IfModifiedSince != nil { + v := *s.IfModifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Modified-Since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.IfNoneMatch != nil { + v := *s.IfNoneMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-None-Match", protocol.StringValue(v), metadata) + } + if s.IfUnmodifiedSince != nil { + v := *s.IfUnmodifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Unmodified-Since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.Range != nil { + v := *s.Range + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Range", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "partNumber", protocol.Int64Value(v), metadata) + } + if s.ResponseCacheControl != nil { + v := *s.ResponseCacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-cache-control", protocol.StringValue(v), metadata) + } + if s.ResponseContentDisposition != nil { + v := *s.ResponseContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-content-disposition", protocol.StringValue(v), metadata) + } + if s.ResponseContentEncoding != nil { + v := *s.ResponseContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-content-encoding", protocol.StringValue(v), metadata) + } + if s.ResponseContentLanguage != nil { + v := *s.ResponseContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-content-language", protocol.StringValue(v), metadata) + } + if s.ResponseContentType != nil { + v := *s.ResponseContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-content-type", protocol.StringValue(v), metadata) + } + if s.ResponseExpires != nil { + v := *s.ResponseExpires + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "response-expires", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectOutput +type GetObjectOutput struct { + _ struct{} `type:"structure" payload:"Body"` + + responseMetadata aws.Response + + AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` + + // Object data. + Body io.ReadCloser `type:"blob"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` + + // Size of the body in bytes. + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + + // The portion of the object returned in the response. + ContentRange *string `location:"header" locationName:"Content-Range" type:"string"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"Content-Type" type:"string"` + + // Specifies whether the object retrieved was (true) or was not (false) a Delete + // Marker. If false, this response header does not appear in the response. + DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` + + // An ETag is an opaque identifier assigned by a web server to a specific version + // of a resource found at a URL + ETag *string `location:"header" locationName:"ETag" type:"string"` + + // If the object expiration is configured (see PUT Bucket lifecycle), the response + // includes this header. It includes the expiry-date and rule-id key value pairs + // providing object expiration information. The value of the rule-id is URL + // encoded. + Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *string `location:"header" locationName:"Expires" type:"string"` + + // Last modified date of the object + LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` + + // A map of metadata to store with the object in S3. + Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // This is set to the number of metadata entries not returned in x-amz-meta + // headers. This can happen if you create metadata using an API like SOAP that + // supports more flexible metadata than the REST API. For example, using SOAP, + // you can create metadata whose values are not legal HTTP headers. + MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` + + // The count of parts this object has. + PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` + + ReplicationStatus ReplicationStatus `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"true"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // Provides information about object restoration operation and expiration time + // of the restored object copy. + Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + StorageClass StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"true"` + + // The number of tags, if any, on the object. + TagCount *int64 `location:"header" locationName:"x-amz-tagging-count" type:"integer"` + + // Version of the object. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` + + // If the bucket is configured as a website, redirects requests for this object + // to another object in the same bucket or to an external URL. Amazon S3 stores + // the value of this header in the object metadata. + WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` +} + +// String returns the string representation +func (s GetObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.AcceptRanges != nil { + v := *s.AcceptRanges + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "accept-ranges", protocol.StringValue(v), metadata) + } + if s.CacheControl != nil { + v := *s.CacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Cache-Control", protocol.StringValue(v), metadata) + } + if s.ContentDisposition != nil { + v := *s.ContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Disposition", protocol.StringValue(v), metadata) + } + if s.ContentEncoding != nil { + v := *s.ContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Encoding", protocol.StringValue(v), metadata) + } + if s.ContentLanguage != nil { + v := *s.ContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Language", protocol.StringValue(v), metadata) + } + if s.ContentLength != nil { + v := *s.ContentLength + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Length", protocol.Int64Value(v), metadata) + } + if s.ContentRange != nil { + v := *s.ContentRange + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Range", protocol.StringValue(v), metadata) + } + if s.ContentType != nil { + v := *s.ContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue(v), metadata) + } + if s.DeleteMarker != nil { + v := *s.DeleteMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-delete-marker", protocol.BoolValue(v), metadata) + } + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.Expiration != nil { + v := *s.Expiration + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-expiration", protocol.StringValue(v), metadata) + } + if s.Expires != nil { + v := *s.Expires + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Expires", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Last-Modified", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.MissingMeta != nil { + v := *s.MissingMeta + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-missing-meta", protocol.Int64Value(v), metadata) + } + if s.PartsCount != nil { + v := *s.PartsCount + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-mp-parts-count", protocol.Int64Value(v), metadata) + } + if len(s.ReplicationStatus) > 0 { + v := s.ReplicationStatus + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-replication-status", v, metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.Restore != nil { + v := *s.Restore + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-restore", protocol.StringValue(v), metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-storage-class", v, metadata) + } + if s.TagCount != nil { + v := *s.TagCount + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-tagging-count", protocol.Int64Value(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + if s.WebsiteRedirectLocation != nil { + v := *s.WebsiteRedirectLocation + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-website-redirect-location", protocol.StringValue(v), metadata) + } + if len(s.Metadata) > 0 { + v := s.Metadata + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.HeadersTarget, "x-amz-meta-", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.StringValue(v1)) + } + ms0.End() + + } + // Skipping Body Output type's body not valid. + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTaggingRequest +type GetObjectTaggingInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s GetObjectTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetObjectTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetObjectTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTaggingOutput +type GetObjectTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // TagSet is a required field + TagSet []Tag `locationNameList:"Tag" type:"list" required:"true"` + + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s GetObjectTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetObjectTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.TagSet) > 0 { + v := s.TagSet + + metadata := protocol.Metadata{ListLocationName: "Tag"} + ls0 := e.List(protocol.BodyTarget, "TagSet", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrentRequest +type GetObjectTorrentInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetObjectTorrentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectTorrentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetObjectTorrentInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetObjectTorrentInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *GetObjectTorrentInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectTorrentInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrentOutput +type GetObjectTorrentOutput struct { + _ struct{} `type:"structure" payload:"Body"` + + responseMetadata aws.Response + + Body io.ReadCloser `type:"blob"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` +} + +// String returns the string representation +func (s GetObjectTorrentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetObjectTorrentOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetObjectTorrentOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GetObjectTorrentOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + // Skipping Body Output type's body not valid. + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GlacierJobParameters +type GlacierJobParameters struct { + _ struct{} `type:"structure"` + + // Glacier retrieval tier at which the restore will be processed. + // + // Tier is a required field + Tier Tier `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s GlacierJobParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GlacierJobParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GlacierJobParameters) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GlacierJobParameters"} + if len(s.Tier) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Tier")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s GlacierJobParameters) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Tier) > 0 { + v := s.Tier + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Tier", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Grant +type Grant struct { + _ struct{} `type:"structure"` + + Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` + + // Specifies the permission given to the grantee. + Permission Permission `type:"string" enum:"true"` +} + +// String returns the string representation +func (s Grant) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Grant) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Grant) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Grant"} + if s.Grantee != nil { + if err := s.Grantee.Validate(); err != nil { + invalidParams.AddNested("Grantee", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Grant) MarshalFields(e protocol.FieldEncoder) error { + if s.Grantee != nil { + v := s.Grantee + attrs := make([]protocol.Attribute, 0, 1) + + if len(s.Grantee.Type) > 0 { + + v := s.Grantee.Type + attrs = append(attrs, protocol.Attribute{Name: "xsi:type", Value: v, Meta: protocol.Metadata{}}) + } + metadata := protocol.Metadata{Attributes: attrs, XMLNamespacePrefix: "xsi", XMLNamespaceURI: "http://www.w3.org/2001/XMLSchema-instance"} + e.SetFields(protocol.BodyTarget, "Grantee", v, metadata) + } + if len(s.Permission) > 0 { + v := s.Permission + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Permission", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Grantee +type Grantee struct { + _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` + + // Screen name of the grantee. + DisplayName *string `type:"string"` + + // Email address of the grantee. + EmailAddress *string `type:"string"` + + // The canonical user ID of the grantee. + ID *string `type:"string"` + + // Type of grantee + // + // Type is a required field + Type Type `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"true"` + + // URI of the grantee group. + URI *string `type:"string"` +} + +// String returns the string representation +func (s Grantee) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Grantee) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Grantee) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Grantee"} + if len(s.Type) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Grantee) MarshalFields(e protocol.FieldEncoder) error { + if s.DisplayName != nil { + v := *s.DisplayName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DisplayName", protocol.StringValue(v), metadata) + } + if s.EmailAddress != nil { + v := *s.EmailAddress + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EmailAddress", protocol.StringValue(v), metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + // Skipping Type XML Attribute. + if s.URI != nil { + v := *s.URI + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "URI", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucketRequest +type HeadBucketInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s HeadBucketInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HeadBucketInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HeadBucketInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "HeadBucketInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *HeadBucketInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s HeadBucketInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucketOutput +type HeadBucketOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s HeadBucketOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HeadBucketOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s HeadBucketOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s HeadBucketOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObjectRequest +type HeadObjectInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Return the object only if its entity tag (ETag) is the same as the one specified, + // otherwise return a 412 (precondition failed). + IfMatch *string `location:"header" locationName:"If-Match" type:"string"` + + // Return the object only if it has been modified since the specified time, + // otherwise return a 304 (not modified). + IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` + + // Return the object only if its entity tag (ETag) is different from the one + // specified, otherwise return a 304 (not modified). + IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` + + // Return the object only if it has not been modified since the specified time, + // otherwise return a 412 (precondition failed). + IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Part number of the object being read. This is a positive integer between + // 1 and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. + // Useful querying about the size of the part and the number of parts in this + // object. + PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` + + // Downloads the specified range bytes of an object. For more information about + // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. + Range *string `location:"header" locationName:"Range" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s HeadObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HeadObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HeadObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "HeadObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *HeadObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *HeadObjectInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s HeadObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.IfMatch != nil { + v := *s.IfMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Match", protocol.StringValue(v), metadata) + } + if s.IfModifiedSince != nil { + v := *s.IfModifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Modified-Since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.IfNoneMatch != nil { + v := *s.IfNoneMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-None-Match", protocol.StringValue(v), metadata) + } + if s.IfUnmodifiedSince != nil { + v := *s.IfUnmodifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "If-Unmodified-Since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.Range != nil { + v := *s.Range + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Range", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "partNumber", protocol.Int64Value(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObjectOutput +type HeadObjectOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` + + // Size of the body in bytes. + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"Content-Type" type:"string"` + + // Specifies whether the object retrieved was (true) or was not (false) a Delete + // Marker. If false, this response header does not appear in the response. + DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` + + // An ETag is an opaque identifier assigned by a web server to a specific version + // of a resource found at a URL + ETag *string `location:"header" locationName:"ETag" type:"string"` + + // If the object expiration is configured (see PUT Bucket lifecycle), the response + // includes this header. It includes the expiry-date and rule-id key value pairs + // providing object expiration information. The value of the rule-id is URL + // encoded. + Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *string `location:"header" locationName:"Expires" type:"string"` + + // Last modified date of the object + LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` + + // A map of metadata to store with the object in S3. + Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // This is set to the number of metadata entries not returned in x-amz-meta + // headers. This can happen if you create metadata using an API like SOAP that + // supports more flexible metadata than the REST API. For example, using SOAP, + // you can create metadata whose values are not legal HTTP headers. + MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` + + // The count of parts this object has. + PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` + + ReplicationStatus ReplicationStatus `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"true"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // Provides information about object restoration operation and expiration time + // of the restored object copy. + Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + StorageClass StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"true"` + + // Version of the object. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` + + // If the bucket is configured as a website, redirects requests for this object + // to another object in the same bucket or to an external URL. Amazon S3 stores + // the value of this header in the object metadata. + WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` +} + +// String returns the string representation +func (s HeadObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HeadObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s HeadObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s HeadObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.AcceptRanges != nil { + v := *s.AcceptRanges + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "accept-ranges", protocol.StringValue(v), metadata) + } + if s.CacheControl != nil { + v := *s.CacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Cache-Control", protocol.StringValue(v), metadata) + } + if s.ContentDisposition != nil { + v := *s.ContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Disposition", protocol.StringValue(v), metadata) + } + if s.ContentEncoding != nil { + v := *s.ContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Encoding", protocol.StringValue(v), metadata) + } + if s.ContentLanguage != nil { + v := *s.ContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Language", protocol.StringValue(v), metadata) + } + if s.ContentLength != nil { + v := *s.ContentLength + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Length", protocol.Int64Value(v), metadata) + } + if s.ContentType != nil { + v := *s.ContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue(v), metadata) + } + if s.DeleteMarker != nil { + v := *s.DeleteMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-delete-marker", protocol.BoolValue(v), metadata) + } + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.Expiration != nil { + v := *s.Expiration + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-expiration", protocol.StringValue(v), metadata) + } + if s.Expires != nil { + v := *s.Expires + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Expires", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Last-Modified", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.MissingMeta != nil { + v := *s.MissingMeta + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-missing-meta", protocol.Int64Value(v), metadata) + } + if s.PartsCount != nil { + v := *s.PartsCount + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-mp-parts-count", protocol.Int64Value(v), metadata) + } + if len(s.ReplicationStatus) > 0 { + v := s.ReplicationStatus + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-replication-status", v, metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.Restore != nil { + v := *s.Restore + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-restore", protocol.StringValue(v), metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-storage-class", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + if s.WebsiteRedirectLocation != nil { + v := *s.WebsiteRedirectLocation + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-website-redirect-location", protocol.StringValue(v), metadata) + } + if len(s.Metadata) > 0 { + v := s.Metadata + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.HeadersTarget, "x-amz-meta-", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.StringValue(v1)) + } + ms0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/IndexDocument +type IndexDocument struct { + _ struct{} `type:"structure"` + + // A suffix that is appended to a request that is for a directory on the website + // endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ + // the data that is returned will be for the object with the key name images/index.html) + // The suffix must not be empty and must not include a slash character. + // + // Suffix is a required field + Suffix *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s IndexDocument) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s IndexDocument) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *IndexDocument) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "IndexDocument"} + + if s.Suffix == nil { + invalidParams.Add(aws.NewErrParamRequired("Suffix")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s IndexDocument) MarshalFields(e protocol.FieldEncoder) error { + if s.Suffix != nil { + v := *s.Suffix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Suffix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Initiator +type Initiator struct { + _ struct{} `type:"structure"` + + // Name of the Principal. + DisplayName *string `type:"string"` + + // If the principal is an AWS account, it provides the Canonical User ID. If + // the principal is an IAM User, it provides a user ARN value. + ID *string `type:"string"` +} + +// String returns the string representation +func (s Initiator) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Initiator) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Initiator) MarshalFields(e protocol.FieldEncoder) error { + if s.DisplayName != nil { + v := *s.DisplayName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DisplayName", protocol.StringValue(v), metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + return nil +} + +// Describes the serialization format of the object. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InputSerialization +type InputSerialization struct { + _ struct{} `type:"structure"` + + // Describes the serialization of a CSV-encoded object. + CSV *CSVInput `type:"structure"` + + // Specifies object's compression format. Valid values: NONE, GZIP, BZIP2. Default + // Value: NONE. + CompressionType CompressionType `type:"string" enum:"true"` + + // Specifies JSON as object's input serialization format. + JSON *JSONInput `type:"structure"` + + // Specifies Parquet as object's input serialization format. + Parquet *ParquetInput `type:"structure"` +} + +// String returns the string representation +func (s InputSerialization) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InputSerialization) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InputSerialization) MarshalFields(e protocol.FieldEncoder) error { + if s.CSV != nil { + v := s.CSV + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "CSV", v, metadata) + } + if len(s.CompressionType) > 0 { + v := s.CompressionType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CompressionType", v, metadata) + } + if s.JSON != nil { + v := s.JSON + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "JSON", v, metadata) + } + if s.Parquet != nil { + v := s.Parquet + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Parquet", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryConfiguration +type InventoryConfiguration struct { + _ struct{} `type:"structure"` + + // Contains information about where to publish the inventory results. + // + // Destination is a required field + Destination *InventoryDestination `type:"structure" required:"true"` + + // Specifies an inventory filter. The inventory only includes objects that meet + // the filter's criteria. + Filter *InventoryFilter `type:"structure"` + + // The ID used to identify the inventory configuration. + // + // Id is a required field + Id *string `type:"string" required:"true"` + + // Specifies which object version(s) to included in the inventory results. + // + // IncludedObjectVersions is a required field + IncludedObjectVersions InventoryIncludedObjectVersions `type:"string" required:"true" enum:"true"` + + // Specifies whether the inventory is enabled or disabled. + // + // IsEnabled is a required field + IsEnabled *bool `type:"boolean" required:"true"` + + // Contains the optional fields that are included in the inventory results. + OptionalFields []InventoryOptionalField `locationNameList:"Field" type:"list"` + + // Specifies the schedule for generating inventory results. + // + // Schedule is a required field + Schedule *InventorySchedule `type:"structure" required:"true"` +} + +// String returns the string representation +func (s InventoryConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventoryConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventoryConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventoryConfiguration"} + + if s.Destination == nil { + invalidParams.Add(aws.NewErrParamRequired("Destination")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + if len(s.IncludedObjectVersions) == 0 { + invalidParams.Add(aws.NewErrParamRequired("IncludedObjectVersions")) + } + + if s.IsEnabled == nil { + invalidParams.Add(aws.NewErrParamRequired("IsEnabled")) + } + + if s.Schedule == nil { + invalidParams.Add(aws.NewErrParamRequired("Schedule")) + } + if s.Destination != nil { + if err := s.Destination.Validate(); err != nil { + invalidParams.AddNested("Destination", err.(aws.ErrInvalidParams)) + } + } + if s.Filter != nil { + if err := s.Filter.Validate(); err != nil { + invalidParams.AddNested("Filter", err.(aws.ErrInvalidParams)) + } + } + if s.Schedule != nil { + if err := s.Schedule.Validate(); err != nil { + invalidParams.AddNested("Schedule", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventoryConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.Destination != nil { + v := s.Destination + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Destination", v, metadata) + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if len(s.IncludedObjectVersions) > 0 { + v := s.IncludedObjectVersions + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IncludedObjectVersions", v, metadata) + } + if s.IsEnabled != nil { + v := *s.IsEnabled + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsEnabled", protocol.BoolValue(v), metadata) + } + if len(s.OptionalFields) > 0 { + v := s.OptionalFields + + metadata := protocol.Metadata{ListLocationName: "Field"} + ls0 := e.List(protocol.BodyTarget, "OptionalFields", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Schedule != nil { + v := s.Schedule + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Schedule", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryDestination +type InventoryDestination struct { + _ struct{} `type:"structure"` + + // Contains the bucket name, file format, bucket owner (optional), and prefix + // (optional) where inventory results are published. + // + // S3BucketDestination is a required field + S3BucketDestination *InventoryS3BucketDestination `type:"structure" required:"true"` +} + +// String returns the string representation +func (s InventoryDestination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventoryDestination) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventoryDestination) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventoryDestination"} + + if s.S3BucketDestination == nil { + invalidParams.Add(aws.NewErrParamRequired("S3BucketDestination")) + } + if s.S3BucketDestination != nil { + if err := s.S3BucketDestination.Validate(); err != nil { + invalidParams.AddNested("S3BucketDestination", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventoryDestination) MarshalFields(e protocol.FieldEncoder) error { + if s.S3BucketDestination != nil { + v := s.S3BucketDestination + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "S3BucketDestination", v, metadata) + } + return nil +} + +// Contains the type of server-side encryption used to encrypt the inventory +// results. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryEncryption +type InventoryEncryption struct { + _ struct{} `type:"structure"` + + // Specifies the use of SSE-KMS to encrypt delievered Inventory reports. + SSEKMS *SSEKMS `locationName:"SSE-KMS" type:"structure"` + + // Specifies the use of SSE-S3 to encrypt delievered Inventory reports. + SSES3 *SSES3 `locationName:"SSE-S3" type:"structure"` +} + +// String returns the string representation +func (s InventoryEncryption) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventoryEncryption) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventoryEncryption) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventoryEncryption"} + if s.SSEKMS != nil { + if err := s.SSEKMS.Validate(); err != nil { + invalidParams.AddNested("SSEKMS", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventoryEncryption) MarshalFields(e protocol.FieldEncoder) error { + if s.SSEKMS != nil { + v := s.SSEKMS + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "SSE-KMS", v, metadata) + } + if s.SSES3 != nil { + v := s.SSES3 + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "SSE-S3", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryFilter +type InventoryFilter struct { + _ struct{} `type:"structure"` + + // The prefix that an object must have to be included in the inventory results. + // + // Prefix is a required field + Prefix *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s InventoryFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventoryFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventoryFilter) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventoryFilter"} + + if s.Prefix == nil { + invalidParams.Add(aws.NewErrParamRequired("Prefix")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventoryFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryS3BucketDestination +type InventoryS3BucketDestination struct { + _ struct{} `type:"structure"` + + // The ID of the account that owns the destination bucket. + AccountId *string `type:"string"` + + // The Amazon resource name (ARN) of the bucket where inventory results will + // be published. + // + // Bucket is a required field + Bucket *string `type:"string" required:"true"` + + // Contains the type of server-side encryption used to encrypt the inventory + // results. + Encryption *InventoryEncryption `type:"structure"` + + // Specifies the output format of the inventory results. + // + // Format is a required field + Format InventoryFormat `type:"string" required:"true" enum:"true"` + + // The prefix that is prepended to all inventory results. + Prefix *string `type:"string"` +} + +// String returns the string representation +func (s InventoryS3BucketDestination) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventoryS3BucketDestination) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventoryS3BucketDestination) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventoryS3BucketDestination"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if len(s.Format) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Format")) + } + if s.Encryption != nil { + if err := s.Encryption.Validate(); err != nil { + invalidParams.AddNested("Encryption", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *InventoryS3BucketDestination) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventoryS3BucketDestination) MarshalFields(e protocol.FieldEncoder) error { + if s.AccountId != nil { + v := *s.AccountId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "AccountId", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Encryption != nil { + v := s.Encryption + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Encryption", v, metadata) + } + if len(s.Format) > 0 { + v := s.Format + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Format", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventorySchedule +type InventorySchedule struct { + _ struct{} `type:"structure"` + + // Specifies how frequently inventory results are produced. + // + // Frequency is a required field + Frequency InventoryFrequency `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s InventorySchedule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InventorySchedule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InventorySchedule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "InventorySchedule"} + if len(s.Frequency) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Frequency")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s InventorySchedule) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Frequency) > 0 { + v := s.Frequency + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Frequency", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/JSONInput +type JSONInput struct { + _ struct{} `type:"structure"` + + // The type of JSON. Valid values: Document, Lines. + Type JSONType `type:"string" enum:"true"` +} + +// String returns the string representation +func (s JSONInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s JSONInput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s JSONInput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Type) > 0 { + v := s.Type + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Type", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/JSONOutput +type JSONOutput struct { + _ struct{} `type:"structure"` + + // The value used to separate individual records in the output. + RecordDelimiter *string `type:"string"` +} + +// String returns the string representation +func (s JSONOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s JSONOutput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s JSONOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.RecordDelimiter != nil { + v := *s.RecordDelimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "RecordDelimiter", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for object key name prefix and suffix filtering rules. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/S3KeyFilter +type KeyFilter struct { + _ struct{} `type:"structure"` + + // A list of containers for key value pair that defines the criteria for the + // filter rule. + FilterRules []FilterRule `locationName:"FilterRule" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s KeyFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s KeyFilter) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s KeyFilter) MarshalFields(e protocol.FieldEncoder) error { + if len(s.FilterRules) > 0 { + v := s.FilterRules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "FilterRule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Container for specifying the AWS Lambda notification configuration. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LambdaFunctionConfiguration +type LambdaFunctionConfiguration struct { + _ struct{} `type:"structure"` + + // Events is a required field + Events []Event `locationName:"Event" type:"list" flattened:"true" required:"true"` + + // Container for object key name filtering rules. For information about key + // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + Filter *NotificationConfigurationFilter `type:"structure"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + // Lambda cloud function ARN that Amazon S3 can invoke when it detects events + // of the specified type. + // + // LambdaFunctionArn is a required field + LambdaFunctionArn *string `locationName:"CloudFunction" type:"string" required:"true"` +} + +// String returns the string representation +func (s LambdaFunctionConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LambdaFunctionConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LambdaFunctionConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LambdaFunctionConfiguration"} + + if s.Events == nil { + invalidParams.Add(aws.NewErrParamRequired("Events")) + } + + if s.LambdaFunctionArn == nil { + invalidParams.Add(aws.NewErrParamRequired("LambdaFunctionArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LambdaFunctionConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.LambdaFunctionArn != nil { + v := *s.LambdaFunctionArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CloudFunction", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleConfiguration +type LifecycleConfiguration struct { + _ struct{} `type:"structure"` + + // Rules is a required field + Rules []Rule `locationName:"Rule" type:"list" flattened:"true" required:"true"` +} + +// String returns the string representation +func (s LifecycleConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LifecycleConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LifecycleConfiguration"} + + if s.Rules == nil { + invalidParams.Add(aws.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LifecycleConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleExpiration +type LifecycleExpiration struct { + _ struct{} `type:"structure"` + + // Indicates at what date the object is to be moved or deleted. Should be in + // GMT ISO 8601 Format. + Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Indicates the lifetime, in days, of the objects that are subject to the rule. + // The value must be a non-zero positive integer. + Days *int64 `type:"integer"` + + // Indicates whether Amazon S3 will remove a delete marker with no noncurrent + // versions. If set to true, the delete marker will be expired; if set to false + // the policy takes no action. This cannot be specified with Days or Date in + // a Lifecycle Expiration Policy. + ExpiredObjectDeleteMarker *bool `type:"boolean"` +} + +// String returns the string representation +func (s LifecycleExpiration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LifecycleExpiration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LifecycleExpiration) MarshalFields(e protocol.FieldEncoder) error { + if s.Date != nil { + v := *s.Date + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Date", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Days != nil { + v := *s.Days + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Days", protocol.Int64Value(v), metadata) + } + if s.ExpiredObjectDeleteMarker != nil { + v := *s.ExpiredObjectDeleteMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ExpiredObjectDeleteMarker", protocol.BoolValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRule +type LifecycleRule struct { + _ struct{} `type:"structure"` + + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + + Expiration *LifecycleExpiration `type:"structure"` + + // The Filter is used to identify objects that a Lifecycle Rule applies to. + // A Filter must have exactly one of Prefix, Tag, or And specified. + Filter *LifecycleRuleFilter `type:"structure"` + + // Unique identifier for the rule. The value cannot be longer than 255 characters. + ID *string `type:"string"` + + // Specifies when noncurrent object versions expire. Upon expiration, Amazon + // S3 permanently deletes the noncurrent object versions. You set this lifecycle + // configuration action on a bucket that has versioning enabled (or suspended) + // to request that Amazon S3 delete noncurrent object versions at a specific + // period in the object's lifetime. + NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` + + NoncurrentVersionTransitions []NoncurrentVersionTransition `locationName:"NoncurrentVersionTransition" type:"list" flattened:"true"` + + // Prefix identifying one or more objects to which the rule applies. This is + // deprecated; use Filter instead. + Prefix *string `deprecated:"true" type:"string"` + + // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule + // is not currently being applied. + // + // Status is a required field + Status ExpirationStatus `type:"string" required:"true" enum:"true"` + + Transitions []Transition `locationName:"Transition" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s LifecycleRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LifecycleRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleRule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LifecycleRule"} + if len(s.Status) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Status")) + } + if s.Filter != nil { + if err := s.Filter.Validate(); err != nil { + invalidParams.AddNested("Filter", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LifecycleRule) MarshalFields(e protocol.FieldEncoder) error { + if s.AbortIncompleteMultipartUpload != nil { + v := s.AbortIncompleteMultipartUpload + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "AbortIncompleteMultipartUpload", v, metadata) + } + if s.Expiration != nil { + v := s.Expiration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Expiration", v, metadata) + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + if s.NoncurrentVersionExpiration != nil { + v := s.NoncurrentVersionExpiration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "NoncurrentVersionExpiration", v, metadata) + } + if len(s.NoncurrentVersionTransitions) > 0 { + v := s.NoncurrentVersionTransitions + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "NoncurrentVersionTransition", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + if len(s.Transitions) > 0 { + v := s.Transitions + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Transition", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// This is used in a Lifecycle Rule Filter to apply a logical AND to two or +// more predicates. The Lifecycle Rule will apply to any object matching all +// of the predicates configured inside the And operator. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRuleAndOperator +type LifecycleRuleAndOperator struct { + _ struct{} `type:"structure"` + + Prefix *string `type:"string"` + + // All of these tags must exist in the object's tag set in order for the rule + // to apply. + Tags []Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s LifecycleRuleAndOperator) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LifecycleRuleAndOperator) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleRuleAndOperator) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LifecycleRuleAndOperator"} + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LifecycleRuleAndOperator) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Tag", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// The Filter is used to identify objects that a Lifecycle Rule applies to. +// A Filter must have exactly one of Prefix, Tag, or And specified. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRuleFilter +type LifecycleRuleFilter struct { + _ struct{} `type:"structure"` + + // This is used in a Lifecycle Rule Filter to apply a logical AND to two or + // more predicates. The Lifecycle Rule will apply to any object matching all + // of the predicates configured inside the And operator. + And *LifecycleRuleAndOperator `type:"structure"` + + // Prefix identifying one or more objects to which the rule applies. + Prefix *string `type:"string"` + + // This tag must exist in the object's tag set in order for the rule to apply. + Tag *Tag `type:"structure"` +} + +// String returns the string representation +func (s LifecycleRuleFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LifecycleRuleFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LifecycleRuleFilter) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LifecycleRuleFilter"} + if s.And != nil { + if err := s.And.Validate(); err != nil { + invalidParams.AddNested("And", err.(aws.ErrInvalidParams)) + } + } + if s.Tag != nil { + if err := s.Tag.Validate(); err != nil { + invalidParams.AddNested("Tag", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LifecycleRuleFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.And != nil { + v := s.And + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "And", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.Tag != nil { + v := s.Tag + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Tag", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurationsRequest +type ListBucketAnalyticsConfigurationsInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket from which analytics configurations are retrieved. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ContinuationToken that represents a placeholder from where this request + // should begin. + ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` +} + +// String returns the string representation +func (s ListBucketAnalyticsConfigurationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketAnalyticsConfigurationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListBucketAnalyticsConfigurationsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListBucketAnalyticsConfigurationsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListBucketAnalyticsConfigurationsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketAnalyticsConfigurationsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "continuation-token", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurationsOutput +type ListBucketAnalyticsConfigurationsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The list of analytics configurations for a bucket. + AnalyticsConfigurationList []AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"list" flattened:"true"` + + // The ContinuationToken that represents where this request began. + ContinuationToken *string `type:"string"` + + // Indicates whether the returned list of analytics configurations is complete. + // A value of true indicates that the list is not complete and the NextContinuationToken + // will be provided for a subsequent request. + IsTruncated *bool `type:"boolean"` + + // NextContinuationToken is sent when isTruncated is true, which indicates that + // there are more analytics configurations to list. The next request must include + // this NextContinuationToken. The token is obfuscated and is not a usable value. + NextContinuationToken *string `type:"string"` +} + +// String returns the string representation +func (s ListBucketAnalyticsConfigurationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketAnalyticsConfigurationsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListBucketAnalyticsConfigurationsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketAnalyticsConfigurationsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.AnalyticsConfigurationList) > 0 { + v := s.AnalyticsConfigurationList + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "AnalyticsConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ContinuationToken", protocol.StringValue(v), metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.NextContinuationToken != nil { + v := *s.NextContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextContinuationToken", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurationsRequest +type ListBucketInventoryConfigurationsInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the inventory configurations to retrieve. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The marker used to continue an inventory configuration listing that has been + // truncated. Use the NextContinuationToken from a previously truncated list + // response to continue the listing. The continuation token is an opaque value + // that Amazon S3 understands. + ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` +} + +// String returns the string representation +func (s ListBucketInventoryConfigurationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketInventoryConfigurationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListBucketInventoryConfigurationsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListBucketInventoryConfigurationsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListBucketInventoryConfigurationsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketInventoryConfigurationsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "continuation-token", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurationsOutput +type ListBucketInventoryConfigurationsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If sent in the request, the marker that is used as a starting point for this + // inventory configuration list response. + ContinuationToken *string `type:"string"` + + // The list of inventory configurations for a bucket. + InventoryConfigurationList []InventoryConfiguration `locationName:"InventoryConfiguration" type:"list" flattened:"true"` + + // Indicates whether the returned list of inventory configurations is truncated + // in this response. A value of true indicates that the list is truncated. + IsTruncated *bool `type:"boolean"` + + // The marker used to continue this inventory configuration listing. Use the + // NextContinuationToken from this response to continue the listing in a subsequent + // request. The continuation token is an opaque value that Amazon S3 understands. + NextContinuationToken *string `type:"string"` +} + +// String returns the string representation +func (s ListBucketInventoryConfigurationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketInventoryConfigurationsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListBucketInventoryConfigurationsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketInventoryConfigurationsOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ContinuationToken", protocol.StringValue(v), metadata) + } + if len(s.InventoryConfigurationList) > 0 { + v := s.InventoryConfigurationList + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "InventoryConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.NextContinuationToken != nil { + v := *s.NextContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextContinuationToken", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurationsRequest +type ListBucketMetricsConfigurationsInput struct { + _ struct{} `type:"structure"` + + // The name of the bucket containing the metrics configurations to retrieve. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The marker that is used to continue a metrics configuration listing that + // has been truncated. Use the NextContinuationToken from a previously truncated + // list response to continue the listing. The continuation token is an opaque + // value that Amazon S3 understands. + ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` +} + +// String returns the string representation +func (s ListBucketMetricsConfigurationsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketMetricsConfigurationsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListBucketMetricsConfigurationsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListBucketMetricsConfigurationsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListBucketMetricsConfigurationsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketMetricsConfigurationsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "continuation-token", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurationsOutput +type ListBucketMetricsConfigurationsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The marker that is used as a starting point for this metrics configuration + // list response. This value is present if it was sent in the request. + ContinuationToken *string `type:"string"` + + // Indicates whether the returned list of metrics configurations is complete. + // A value of true indicates that the list is not complete and the NextContinuationToken + // will be provided for a subsequent request. + IsTruncated *bool `type:"boolean"` + + // The list of metrics configurations for a bucket. + MetricsConfigurationList []MetricsConfiguration `locationName:"MetricsConfiguration" type:"list" flattened:"true"` + + // The marker used to continue a metrics configuration listing that has been + // truncated. Use the NextContinuationToken from a previously truncated list + // response to continue the listing. The continuation token is an opaque value + // that Amazon S3 understands. + NextContinuationToken *string `type:"string"` +} + +// String returns the string representation +func (s ListBucketMetricsConfigurationsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketMetricsConfigurationsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListBucketMetricsConfigurationsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketMetricsConfigurationsOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ContinuationToken", protocol.StringValue(v), metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if len(s.MetricsConfigurationList) > 0 { + v := s.MetricsConfigurationList + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "MetricsConfiguration", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.NextContinuationToken != nil { + v := *s.NextContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextContinuationToken", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketsInput +type ListBucketsInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ListBucketsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketsInput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketsInput) MarshalFields(e protocol.FieldEncoder) error { + + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketsOutput +type ListBucketsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + Buckets []Bucket `locationNameList:"Bucket" type:"list"` + + Owner *Owner `type:"structure"` +} + +// String returns the string representation +func (s ListBucketsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListBucketsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListBucketsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListBucketsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Buckets) > 0 { + v := s.Buckets + + metadata := protocol.Metadata{ListLocationName: "Bucket"} + ls0 := e.List(protocol.BodyTarget, "Buckets", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploadsRequest +type ListMultipartUploadsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Character you use to group keys. + Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` + + // Requests Amazon S3 to encode the object keys in the response and specifies + // the encoding method to use. An object key may contain any Unicode character; + // however, XML 1.0 parser cannot parse some characters, such as characters + // with an ASCII value from 0 to 10. For characters that are not supported in + // XML 1.0, you can add this parameter to request that Amazon S3 encode the + // keys in the response. + EncodingType EncodingType `location:"querystring" locationName:"encoding-type" type:"string" enum:"true"` + + // Together with upload-id-marker, this parameter specifies the multipart upload + // after which listing should begin. + KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` + + // Sets the maximum number of multipart uploads, from 1 to 1,000, to return + // in the response body. 1,000 is the maximum number of uploads that can be + // returned in a response. + MaxUploads *int64 `location:"querystring" locationName:"max-uploads" type:"integer"` + + // Lists in-progress uploads only for those keys that begin with the specified + // prefix. + Prefix *string `location:"querystring" locationName:"prefix" type:"string"` + + // Together with key-marker, specifies the multipart upload after which listing + // should begin. If key-marker is not specified, the upload-id-marker parameter + // is ignored. + UploadIdMarker *string `location:"querystring" locationName:"upload-id-marker" type:"string"` +} + +// String returns the string representation +func (s ListMultipartUploadsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListMultipartUploadsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListMultipartUploadsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListMultipartUploadsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListMultipartUploadsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListMultipartUploadsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "encoding-type", v, metadata) + } + if s.KeyMarker != nil { + v := *s.KeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "key-marker", protocol.StringValue(v), metadata) + } + if s.MaxUploads != nil { + v := *s.MaxUploads + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "max-uploads", protocol.Int64Value(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "prefix", protocol.StringValue(v), metadata) + } + if s.UploadIdMarker != nil { + v := *s.UploadIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "upload-id-marker", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploadsOutput +type ListMultipartUploadsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Name of the bucket to which the multipart upload was initiated. + Bucket *string `type:"string"` + + CommonPrefixes []CommonPrefix `type:"list" flattened:"true"` + + Delimiter *string `type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType EncodingType `type:"string" enum:"true"` + + // Indicates whether the returned list of multipart uploads is truncated. A + // value of true indicates that the list was truncated. The list can be truncated + // if the number of multipart uploads exceeds the limit allowed or specified + // by max uploads. + IsTruncated *bool `type:"boolean"` + + // The key at or after which the listing began. + KeyMarker *string `type:"string"` + + // Maximum number of multipart uploads that could have been included in the + // response. + MaxUploads *int64 `type:"integer"` + + // When a list is truncated, this element specifies the value that should be + // used for the key-marker request parameter in a subsequent request. + NextKeyMarker *string `type:"string"` + + // When a list is truncated, this element specifies the value that should be + // used for the upload-id-marker request parameter in a subsequent request. + NextUploadIdMarker *string `type:"string"` + + // When a prefix is provided in the request, this field contains the specified + // prefix. The result contains only keys starting with the specified prefix. + Prefix *string `type:"string"` + + // Upload ID after which listing began. + UploadIdMarker *string `type:"string"` + + Uploads []MultipartUpload `locationName:"Upload" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s ListMultipartUploadsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListMultipartUploadsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListMultipartUploadsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +func (s *ListMultipartUploadsOutput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListMultipartUploadsOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if len(s.CommonPrefixes) > 0 { + v := s.CommonPrefixes + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CommonPrefixes", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EncodingType", v, metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.KeyMarker != nil { + v := *s.KeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KeyMarker", protocol.StringValue(v), metadata) + } + if s.MaxUploads != nil { + v := *s.MaxUploads + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxUploads", protocol.Int64Value(v), metadata) + } + if s.NextKeyMarker != nil { + v := *s.NextKeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextKeyMarker", protocol.StringValue(v), metadata) + } + if s.NextUploadIdMarker != nil { + v := *s.NextUploadIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextUploadIdMarker", protocol.StringValue(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.UploadIdMarker != nil { + v := *s.UploadIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UploadIdMarker", protocol.StringValue(v), metadata) + } + if len(s.Uploads) > 0 { + v := s.Uploads + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Upload", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersionsRequest +type ListObjectVersionsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // A delimiter is a character you use to group keys. + Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` + + // Requests Amazon S3 to encode the object keys in the response and specifies + // the encoding method to use. An object key may contain any Unicode character; + // however, XML 1.0 parser cannot parse some characters, such as characters + // with an ASCII value from 0 to 10. For characters that are not supported in + // XML 1.0, you can add this parameter to request that Amazon S3 encode the + // keys in the response. + EncodingType EncodingType `location:"querystring" locationName:"encoding-type" type:"string" enum:"true"` + + // Specifies the key to start with when listing objects in a bucket. + KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `location:"querystring" locationName:"prefix" type:"string"` + + // Specifies the object version you want to start listing from. + VersionIdMarker *string `location:"querystring" locationName:"version-id-marker" type:"string"` +} + +// String returns the string representation +func (s ListObjectVersionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectVersionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectVersionsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListObjectVersionsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListObjectVersionsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectVersionsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "encoding-type", v, metadata) + } + if s.KeyMarker != nil { + v := *s.KeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "key-marker", protocol.StringValue(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "max-keys", protocol.Int64Value(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "prefix", protocol.StringValue(v), metadata) + } + if s.VersionIdMarker != nil { + v := *s.VersionIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "version-id-marker", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersionsOutput +type ListObjectVersionsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + CommonPrefixes []CommonPrefix `type:"list" flattened:"true"` + + DeleteMarkers []DeleteMarkerEntry `locationName:"DeleteMarker" type:"list" flattened:"true"` + + Delimiter *string `type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType EncodingType `type:"string" enum:"true"` + + // A flag that indicates whether or not Amazon S3 returned all of the results + // that satisfied the search criteria. If your results were truncated, you can + // make a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker + // response parameters as a starting place in another request to return the + // rest of the results. + IsTruncated *bool `type:"boolean"` + + // Marks the last Key returned in a truncated response. + KeyMarker *string `type:"string"` + + MaxKeys *int64 `type:"integer"` + + Name *string `type:"string"` + + // Use this value for the key marker request parameter in a subsequent request. + NextKeyMarker *string `type:"string"` + + // Use this value for the next version id marker parameter in a subsequent request. + NextVersionIdMarker *string `type:"string"` + + Prefix *string `type:"string"` + + VersionIdMarker *string `type:"string"` + + Versions []ObjectVersion `locationName:"Version" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s ListObjectVersionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectVersionsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListObjectVersionsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectVersionsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.CommonPrefixes) > 0 { + v := s.CommonPrefixes + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CommonPrefixes", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.DeleteMarkers) > 0 { + v := s.DeleteMarkers + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "DeleteMarker", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EncodingType", v, metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.KeyMarker != nil { + v := *s.KeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KeyMarker", protocol.StringValue(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxKeys", protocol.Int64Value(v), metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.StringValue(v), metadata) + } + if s.NextKeyMarker != nil { + v := *s.NextKeyMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextKeyMarker", protocol.StringValue(v), metadata) + } + if s.NextVersionIdMarker != nil { + v := *s.NextVersionIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextVersionIdMarker", protocol.StringValue(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.VersionIdMarker != nil { + v := *s.VersionIdMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionIdMarker", protocol.StringValue(v), metadata) + } + if len(s.Versions) > 0 { + v := s.Versions + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Version", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsRequest +type ListObjectsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // A delimiter is a character you use to group keys. + Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` + + // Requests Amazon S3 to encode the object keys in the response and specifies + // the encoding method to use. An object key may contain any Unicode character; + // however, XML 1.0 parser cannot parse some characters, such as characters + // with an ASCII value from 0 to 10. For characters that are not supported in + // XML 1.0, you can add this parameter to request that Amazon S3 encode the + // keys in the response. + EncodingType EncodingType `location:"querystring" locationName:"encoding-type" type:"string" enum:"true"` + + // Specifies the key to start with when listing objects in a bucket. + Marker *string `location:"querystring" locationName:"marker" type:"string"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `location:"querystring" locationName:"prefix" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // list objects request. Bucket owners need not specify this parameter in their + // requests. + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` +} + +// String returns the string representation +func (s ListObjectsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListObjectsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListObjectsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectsInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "encoding-type", v, metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "marker", protocol.StringValue(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "max-keys", protocol.Int64Value(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsOutput +type ListObjectsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + CommonPrefixes []CommonPrefix `type:"list" flattened:"true"` + + Contents []Object `type:"list" flattened:"true"` + + Delimiter *string `type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType EncodingType `type:"string" enum:"true"` + + // A flag that indicates whether or not Amazon S3 returned all of the results + // that satisfied the search criteria. + IsTruncated *bool `type:"boolean"` + + Marker *string `type:"string"` + + MaxKeys *int64 `type:"integer"` + + Name *string `type:"string"` + + // When response is truncated (the IsTruncated element value in the response + // is true), you can use the key name in this field as marker in the subsequent + // request to get next set of objects. Amazon S3 lists objects in alphabetical + // order Note: This element is returned only if you have delimiter request parameter + // specified. If response does not include the NextMaker and it is truncated, + // you can use the value of the last Key in the response as the marker in the + // subsequent request to get the next set of object keys. + NextMarker *string `type:"string"` + + Prefix *string `type:"string"` +} + +// String returns the string representation +func (s ListObjectsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListObjectsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectsOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.CommonPrefixes) > 0 { + v := s.CommonPrefixes + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CommonPrefixes", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.Contents) > 0 { + v := s.Contents + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Contents", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EncodingType", v, metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.Marker != nil { + v := *s.Marker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Marker", protocol.StringValue(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxKeys", protocol.Int64Value(v), metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.StringValue(v), metadata) + } + if s.NextMarker != nil { + v := *s.NextMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextMarker", protocol.StringValue(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2Request +type ListObjectsV2Input struct { + _ struct{} `type:"structure"` + + // Name of the bucket to list. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // ContinuationToken indicates Amazon S3 that the list is being continued on + // this bucket with a token. ContinuationToken is obfuscated and is not a real + // key + ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` + + // A delimiter is a character you use to group keys. + Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType EncodingType `location:"querystring" locationName:"encoding-type" type:"string" enum:"true"` + + // The owner field is not present in listV2 by default, if you want to return + // owner field with each key in the result then set the fetch owner field to + // true + FetchOwner *bool `location:"querystring" locationName:"fetch-owner" type:"boolean"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `location:"querystring" locationName:"prefix" type:"string"` + + // Confirms that the requester knows that she or he will be charged for the + // list objects request in V2 style. Bucket owners need not specify this parameter + // in their requests. + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts + // listing after this specified key. StartAfter can be any key in the bucket + StartAfter *string `location:"querystring" locationName:"start-after" type:"string"` +} + +// String returns the string representation +func (s ListObjectsV2Input) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsV2Input) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListObjectsV2Input) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListObjectsV2Input"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListObjectsV2Input) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectsV2Input) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "continuation-token", protocol.StringValue(v), metadata) + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "encoding-type", v, metadata) + } + if s.FetchOwner != nil { + v := *s.FetchOwner + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "fetch-owner", protocol.BoolValue(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "max-keys", protocol.Int64Value(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "prefix", protocol.StringValue(v), metadata) + } + if s.StartAfter != nil { + v := *s.StartAfter + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "start-after", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2Output +type ListObjectsV2Output struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // CommonPrefixes contains all (if there are any) keys between Prefix and the + // next occurrence of the string specified by delimiter + CommonPrefixes []CommonPrefix `type:"list" flattened:"true"` + + // Metadata about each object returned. + Contents []Object `type:"list" flattened:"true"` + + // ContinuationToken indicates Amazon S3 that the list is being continued on + // this bucket with a token. ContinuationToken is obfuscated and is not a real + // key + ContinuationToken *string `type:"string"` + + // A delimiter is a character you use to group keys. + Delimiter *string `type:"string"` + + // Encoding type used by Amazon S3 to encode object keys in the response. + EncodingType EncodingType `type:"string" enum:"true"` + + // A flag that indicates whether or not Amazon S3 returned all of the results + // that satisfied the search criteria. + IsTruncated *bool `type:"boolean"` + + // KeyCount is the number of keys returned with this request. KeyCount will + // always be less than equals to MaxKeys field. Say you ask for 50 keys, your + // result will include less than equals 50 keys + KeyCount *int64 `type:"integer"` + + // Sets the maximum number of keys returned in the response. The response might + // contain fewer keys but will never contain more. + MaxKeys *int64 `type:"integer"` + + // Name of the bucket to list. + Name *string `type:"string"` + + // NextContinuationToken is sent when isTruncated is true which means there + // are more keys in the bucket that can be listed. The next list requests to + // Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken + // is obfuscated and is not a real key + NextContinuationToken *string `type:"string"` + + // Limits the response to keys that begin with the specified prefix. + Prefix *string `type:"string"` + + // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts + // listing after this specified key. StartAfter can be any key in the bucket + StartAfter *string `type:"string"` +} + +// String returns the string representation +func (s ListObjectsV2Output) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListObjectsV2Output) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListObjectsV2Output) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListObjectsV2Output) MarshalFields(e protocol.FieldEncoder) error { + if len(s.CommonPrefixes) > 0 { + v := s.CommonPrefixes + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "CommonPrefixes", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.Contents) > 0 { + v := s.Contents + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Contents", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.ContinuationToken != nil { + v := *s.ContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ContinuationToken", protocol.StringValue(v), metadata) + } + if s.Delimiter != nil { + v := *s.Delimiter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Delimiter", protocol.StringValue(v), metadata) + } + if len(s.EncodingType) > 0 { + v := s.EncodingType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "EncodingType", v, metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.KeyCount != nil { + v := *s.KeyCount + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KeyCount", protocol.Int64Value(v), metadata) + } + if s.MaxKeys != nil { + v := *s.MaxKeys + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxKeys", protocol.Int64Value(v), metadata) + } + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.StringValue(v), metadata) + } + if s.NextContinuationToken != nil { + v := *s.NextContinuationToken + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextContinuationToken", protocol.StringValue(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.StartAfter != nil { + v := *s.StartAfter + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StartAfter", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListPartsRequest +type ListPartsInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Sets the maximum number of parts to return. + MaxParts *int64 `location:"querystring" locationName:"max-parts" type:"integer"` + + // Specifies the part after which listing should begin. Only parts with higher + // part numbers will be listed. + PartNumberMarker *int64 `location:"querystring" locationName:"part-number-marker" type:"integer"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Upload ID identifying the multipart upload whose parts are being listed. + // + // UploadId is a required field + UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListPartsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListPartsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListPartsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ListPartsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.UploadId == nil { + invalidParams.Add(aws.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *ListPartsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListPartsInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.MaxParts != nil { + v := *s.MaxParts + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "max-parts", protocol.Int64Value(v), metadata) + } + if s.PartNumberMarker != nil { + v := *s.PartNumberMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "part-number-marker", protocol.Int64Value(v), metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "uploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListPartsOutput +type ListPartsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Date when multipart upload will become eligible for abort operation by lifecycle. + AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` + + // Id of the lifecycle rule that makes a multipart upload eligible for abort + // operation. + AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` + + // Name of the bucket to which the multipart upload was initiated. + Bucket *string `type:"string"` + + // Identifies who initiated the multipart upload. + Initiator *Initiator `type:"structure"` + + // Indicates whether the returned list of parts is truncated. + IsTruncated *bool `type:"boolean"` + + // Object key for which the multipart upload was initiated. + Key *string `min:"1" type:"string"` + + // Maximum number of parts that were allowed in the response. + MaxParts *int64 `type:"integer"` + + // When a list is truncated, this element specifies the last part in the list, + // as well as the value to use for the part-number-marker request parameter + // in a subsequent request. + NextPartNumberMarker *int64 `type:"integer"` + + Owner *Owner `type:"structure"` + + // Part number after which listing begins. + PartNumberMarker *int64 `type:"integer"` + + Parts []Part `locationName:"Part" type:"list" flattened:"true"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // The class of storage used to store the object. + StorageClass StorageClass `type:"string" enum:"true"` + + // Upload ID identifying the multipart upload whose parts are being listed. + UploadId *string `type:"string"` +} + +// String returns the string representation +func (s ListPartsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListPartsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s ListPartsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +func (s *ListPartsOutput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ListPartsOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Initiator != nil { + v := s.Initiator + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Initiator", v, metadata) + } + if s.IsTruncated != nil { + v := *s.IsTruncated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsTruncated", protocol.BoolValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.MaxParts != nil { + v := *s.MaxParts + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MaxParts", protocol.Int64Value(v), metadata) + } + if s.NextPartNumberMarker != nil { + v := *s.NextPartNumberMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NextPartNumberMarker", protocol.Int64Value(v), metadata) + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if s.PartNumberMarker != nil { + v := *s.PartNumberMarker + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "PartNumberMarker", protocol.Int64Value(v), metadata) + } + if len(s.Parts) > 0 { + v := s.Parts + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Part", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UploadId", protocol.StringValue(v), metadata) + } + if s.AbortDate != nil { + v := *s.AbortDate + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-abort-date", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.AbortRuleId != nil { + v := *s.AbortRuleId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-abort-rule-id", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + return nil +} + +// Describes an S3 location that will receive the results of the restore request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/S3Location +type Location struct { + _ struct{} `type:"structure"` + + // A list of grants that control access to the staged results. + AccessControlList []Grant `locationNameList:"Grant" type:"list"` + + // The name of the bucket where the restore results will be placed. + // + // BucketName is a required field + BucketName *string `type:"string" required:"true"` + + // The canned ACL to apply to the restore results. + CannedACL ObjectCannedACL `type:"string" enum:"true"` + + // Describes the server-side encryption that will be applied to the restore + // results. + Encryption *Encryption `type:"structure"` + + // The prefix that is prepended to the restore results for this request. + // + // Prefix is a required field + Prefix *string `type:"string" required:"true"` + + // The class of storage used to store the restore results. + StorageClass StorageClass `type:"string" enum:"true"` + + // The tag-set that is applied to the restore results. + Tagging *Tagging `type:"structure"` + + // A list of metadata to store with the restore results in S3. + UserMetadata []MetadataEntry `locationNameList:"MetadataEntry" type:"list"` +} + +// String returns the string representation +func (s Location) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Location) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Location) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Location"} + + if s.BucketName == nil { + invalidParams.Add(aws.NewErrParamRequired("BucketName")) + } + + if s.Prefix == nil { + invalidParams.Add(aws.NewErrParamRequired("Prefix")) + } + if s.AccessControlList != nil { + for i, v := range s.AccessControlList { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "AccessControlList", i), err.(aws.ErrInvalidParams)) + } + } + } + if s.Encryption != nil { + if err := s.Encryption.Validate(); err != nil { + invalidParams.AddNested("Encryption", err.(aws.ErrInvalidParams)) + } + } + if s.Tagging != nil { + if err := s.Tagging.Validate(); err != nil { + invalidParams.AddNested("Tagging", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Location) MarshalFields(e protocol.FieldEncoder) error { + if len(s.AccessControlList) > 0 { + v := s.AccessControlList + + metadata := protocol.Metadata{ListLocationName: "Grant"} + ls0 := e.List(protocol.BodyTarget, "AccessControlList", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.BucketName != nil { + v := *s.BucketName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "BucketName", protocol.StringValue(v), metadata) + } + if len(s.CannedACL) > 0 { + v := s.CannedACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "CannedACL", v, metadata) + } + if s.Encryption != nil { + v := s.Encryption + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Encryption", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + if s.Tagging != nil { + v := s.Tagging + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Tagging", v, metadata) + } + if len(s.UserMetadata) > 0 { + v := s.UserMetadata + + metadata := protocol.Metadata{ListLocationName: "MetadataEntry"} + ls0 := e.List(protocol.BodyTarget, "UserMetadata", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Container for logging information. Presence of this element indicates that +// logging is enabled. Parameters TargetBucket and TargetPrefix are required +// in this case. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LoggingEnabled +type LoggingEnabled struct { + _ struct{} `type:"structure"` + + // Specifies the bucket where you want Amazon S3 to store server access logs. + // You can have your logs delivered to any bucket that you own, including the + // same bucket that is being logged. You can also configure multiple buckets + // to deliver their logs to the same target bucket. In this case you should + // choose a different TargetPrefix for each source bucket so that the delivered + // log files can be distinguished by key. + // + // TargetBucket is a required field + TargetBucket *string `type:"string" required:"true"` + + TargetGrants []TargetGrant `locationNameList:"Grant" type:"list"` + + // This element lets you specify a prefix for the keys that the log files will + // be stored under. + // + // TargetPrefix is a required field + TargetPrefix *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s LoggingEnabled) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LoggingEnabled) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *LoggingEnabled) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "LoggingEnabled"} + + if s.TargetBucket == nil { + invalidParams.Add(aws.NewErrParamRequired("TargetBucket")) + } + + if s.TargetPrefix == nil { + invalidParams.Add(aws.NewErrParamRequired("TargetPrefix")) + } + if s.TargetGrants != nil { + for i, v := range s.TargetGrants { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TargetGrants", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s LoggingEnabled) MarshalFields(e protocol.FieldEncoder) error { + if s.TargetBucket != nil { + v := *s.TargetBucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "TargetBucket", protocol.StringValue(v), metadata) + } + if len(s.TargetGrants) > 0 { + v := s.TargetGrants + + metadata := protocol.Metadata{ListLocationName: "Grant"} + ls0 := e.List(protocol.BodyTarget, "TargetGrants", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + if s.TargetPrefix != nil { + v := *s.TargetPrefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "TargetPrefix", protocol.StringValue(v), metadata) + } + return nil +} + +// A metadata key-value pair to store with an object. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetadataEntry +type MetadataEntry struct { + _ struct{} `type:"structure"` + + Name *string `type:"string"` + + Value *string `type:"string"` +} + +// String returns the string representation +func (s MetadataEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetadataEntry) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s MetadataEntry) MarshalFields(e protocol.FieldEncoder) error { + if s.Name != nil { + v := *s.Name + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Name", protocol.StringValue(v), metadata) + } + if s.Value != nil { + v := *s.Value + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Value", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsAndOperator +type MetricsAndOperator struct { + _ struct{} `type:"structure"` + + // The prefix used when evaluating an AND predicate. + Prefix *string `type:"string"` + + // The list of tags used when evaluating an AND predicate. + Tags []Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s MetricsAndOperator) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricsAndOperator) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricsAndOperator) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "MetricsAndOperator"} + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s MetricsAndOperator) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Tag", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsConfiguration +type MetricsConfiguration struct { + _ struct{} `type:"structure"` + + // Specifies a metrics configuration filter. The metrics configuration will + // only include objects that meet the filter's criteria. A filter must be a + // prefix, a tag, or a conjunction (MetricsAndOperator). + Filter *MetricsFilter `type:"structure"` + + // The ID used to identify the metrics configuration. + // + // Id is a required field + Id *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s MetricsConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricsConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricsConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "MetricsConfiguration"} + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + if s.Filter != nil { + if err := s.Filter.Validate(); err != nil { + invalidParams.AddNested("Filter", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s MetricsConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsFilter +type MetricsFilter struct { + _ struct{} `type:"structure"` + + // A conjunction (logical AND) of predicates, which is used in evaluating a + // metrics filter. The operator must have at least two predicates, and an object + // must match all of the predicates in order for the filter to apply. + And *MetricsAndOperator `type:"structure"` + + // The prefix used when evaluating a metrics filter. + Prefix *string `type:"string"` + + // The tag used when evaluating a metrics filter. + Tag *Tag `type:"structure"` +} + +// String returns the string representation +func (s MetricsFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MetricsFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MetricsFilter) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "MetricsFilter"} + if s.And != nil { + if err := s.And.Validate(); err != nil { + invalidParams.AddNested("And", err.(aws.ErrInvalidParams)) + } + } + if s.Tag != nil { + if err := s.Tag.Validate(); err != nil { + invalidParams.AddNested("Tag", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s MetricsFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.And != nil { + v := s.And + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "And", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.Tag != nil { + v := s.Tag + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Tag", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MultipartUpload +type MultipartUpload struct { + _ struct{} `type:"structure"` + + // Date and time at which the multipart upload was initiated. + Initiated *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Identifies who initiated the multipart upload. + Initiator *Initiator `type:"structure"` + + // Key of the object for which the multipart upload was initiated. + Key *string `min:"1" type:"string"` + + Owner *Owner `type:"structure"` + + // The class of storage used to store the object. + StorageClass StorageClass `type:"string" enum:"true"` + + // Upload ID that identifies the multipart upload. + UploadId *string `type:"string"` +} + +// String returns the string representation +func (s MultipartUpload) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MultipartUpload) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s MultipartUpload) MarshalFields(e protocol.FieldEncoder) error { + if s.Initiated != nil { + v := *s.Initiated + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Initiated", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Initiator != nil { + v := s.Initiator + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Initiator", v, metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "UploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Specifies when noncurrent object versions expire. Upon expiration, Amazon +// S3 permanently deletes the noncurrent object versions. You set this lifecycle +// configuration action on a bucket that has versioning enabled (or suspended) +// to request that Amazon S3 delete noncurrent object versions at a specific +// period in the object's lifetime. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoncurrentVersionExpiration +type NoncurrentVersionExpiration struct { + _ struct{} `type:"structure"` + + // Specifies the number of days an object is noncurrent before Amazon S3 can + // perform the associated action. For information about the noncurrent days + // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent + // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in + // the Amazon Simple Storage Service Developer Guide. + NoncurrentDays *int64 `type:"integer"` +} + +// String returns the string representation +func (s NoncurrentVersionExpiration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s NoncurrentVersionExpiration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s NoncurrentVersionExpiration) MarshalFields(e protocol.FieldEncoder) error { + if s.NoncurrentDays != nil { + v := *s.NoncurrentDays + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NoncurrentDays", protocol.Int64Value(v), metadata) + } + return nil +} + +// Container for the transition rule that describes when noncurrent objects +// transition to the STANDARD_IA, ONEZONE_IA or GLACIER storage class. If your +// bucket is versioning-enabled (or versioning is suspended), you can set this +// action to request that Amazon S3 transition noncurrent object versions to +// the STANDARD_IA, ONEZONE_IA or GLACIER storage class at a specific period +// in the object's lifetime. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoncurrentVersionTransition +type NoncurrentVersionTransition struct { + _ struct{} `type:"structure"` + + // Specifies the number of days an object is noncurrent before Amazon S3 can + // perform the associated action. For information about the noncurrent days + // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent + // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in + // the Amazon Simple Storage Service Developer Guide. + NoncurrentDays *int64 `type:"integer"` + + // The class of storage used to store the object. + StorageClass TransitionStorageClass `type:"string" enum:"true"` +} + +// String returns the string representation +func (s NoncurrentVersionTransition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s NoncurrentVersionTransition) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s NoncurrentVersionTransition) MarshalFields(e protocol.FieldEncoder) error { + if s.NoncurrentDays != nil { + v := *s.NoncurrentDays + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "NoncurrentDays", protocol.Int64Value(v), metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + return nil +} + +// Container for object key name filtering rules. For information about key +// name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) +// in the Amazon Simple Storage Service Developer Guide. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfigurationFilter +type NotificationConfigurationFilter struct { + _ struct{} `type:"structure"` + + // Container for object key name prefix and suffix filtering rules. + Key *KeyFilter `locationName:"S3Key" type:"structure"` +} + +// String returns the string representation +func (s NotificationConfigurationFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s NotificationConfigurationFilter) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s NotificationConfigurationFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.Key != nil { + v := s.Key + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "S3Key", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Object +type Object struct { + _ struct{} `type:"structure"` + + ETag *string `type:"string"` + + Key *string `min:"1" type:"string"` + + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + Owner *Owner `type:"structure"` + + Size *int64 `type:"integer"` + + // The class of storage used to store the object. + StorageClass ObjectStorageClass `type:"string" enum:"true"` +} + +// String returns the string representation +func (s Object) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Object) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Object) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if s.Size != nil { + v := *s.Size + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Size", protocol.Int64Value(v), metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectIdentifier +type ObjectIdentifier struct { + _ struct{} `type:"structure"` + + // Key name of the object to delete. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` + + // VersionId for the specific version of the object to delete. + VersionId *string `type:"string"` +} + +// String returns the string representation +func (s ObjectIdentifier) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ObjectIdentifier) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ObjectIdentifier) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ObjectIdentifier"} + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ObjectIdentifier) MarshalFields(e protocol.FieldEncoder) error { + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectVersion +type ObjectVersion struct { + _ struct{} `type:"structure"` + + ETag *string `type:"string"` + + // Specifies whether the object is (true) or is not (false) the latest version + // of an object. + IsLatest *bool `type:"boolean"` + + // The object key. + Key *string `min:"1" type:"string"` + + // Date and time the object was last modified. + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + Owner *Owner `type:"structure"` + + // Size in bytes of the object. + Size *int64 `type:"integer"` + + // The class of storage used to store the object. + StorageClass ObjectVersionStorageClass `type:"string" enum:"true"` + + // Version ID of an object. + VersionId *string `type:"string"` +} + +// String returns the string representation +func (s ObjectVersion) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ObjectVersion) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ObjectVersion) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.IsLatest != nil { + v := *s.IsLatest + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "IsLatest", protocol.BoolValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Owner != nil { + v := s.Owner + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Owner", v, metadata) + } + if s.Size != nil { + v := *s.Size + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Size", protocol.Int64Value(v), metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "VersionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Describes the location where the restore job's output is stored. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/OutputLocation +type OutputLocation struct { + _ struct{} `type:"structure"` + + // Describes an S3 location that will receive the results of the restore request. + S3 *Location `type:"structure"` +} + +// String returns the string representation +func (s OutputLocation) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OutputLocation) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *OutputLocation) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "OutputLocation"} + if s.S3 != nil { + if err := s.S3.Validate(); err != nil { + invalidParams.AddNested("S3", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s OutputLocation) MarshalFields(e protocol.FieldEncoder) error { + if s.S3 != nil { + v := s.S3 + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "S3", v, metadata) + } + return nil +} + +// Describes how results of the Select job are serialized. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/OutputSerialization +type OutputSerialization struct { + _ struct{} `type:"structure"` + + // Describes the serialization of CSV-encoded Select results. + CSV *CSVOutput `type:"structure"` + + // Specifies JSON as request's output serialization format. + JSON *JSONOutput `type:"structure"` +} + +// String returns the string representation +func (s OutputSerialization) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s OutputSerialization) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s OutputSerialization) MarshalFields(e protocol.FieldEncoder) error { + if s.CSV != nil { + v := s.CSV + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "CSV", v, metadata) + } + if s.JSON != nil { + v := s.JSON + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "JSON", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Owner +type Owner struct { + _ struct{} `type:"structure"` + + DisplayName *string `type:"string"` + + ID *string `type:"string"` +} + +// String returns the string representation +func (s Owner) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Owner) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Owner) MarshalFields(e protocol.FieldEncoder) error { + if s.DisplayName != nil { + v := *s.DisplayName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "DisplayName", protocol.StringValue(v), metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ParquetInput +type ParquetInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s ParquetInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ParquetInput) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ParquetInput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Part +type Part struct { + _ struct{} `type:"structure"` + + // Entity tag returned when the part was uploaded. + ETag *string `type:"string"` + + // Date and time at which the part was uploaded. + LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Part number identifying the part. This is a positive integer between 1 and + // 10,000. + PartNumber *int64 `type:"integer"` + + // Size of the uploaded part data. + Size *int64 `type:"integer"` +} + +// String returns the string representation +func (s Part) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Part) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Part) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.LastModified != nil { + v := *s.LastModified + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "LastModified", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "PartNumber", protocol.Int64Value(v), metadata) + } + if s.Size != nil { + v := *s.Size + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Size", protocol.Int64Value(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfigurationRequest +type PutBucketAccelerateConfigurationInput struct { + _ struct{} `type:"structure" payload:"AccelerateConfiguration"` + + // Specifies the Accelerate Configuration you want to set for the bucket. + // + // AccelerateConfiguration is a required field + AccelerateConfiguration *AccelerateConfiguration `locationName:"AccelerateConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // Name of the bucket for which the accelerate configuration is set. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutBucketAccelerateConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAccelerateConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketAccelerateConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketAccelerateConfigurationInput"} + + if s.AccelerateConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("AccelerateConfiguration")) + } + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketAccelerateConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAccelerateConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.AccelerateConfiguration != nil { + v := s.AccelerateConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "AccelerateConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfigurationOutput +type PutBucketAccelerateConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketAccelerateConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAccelerateConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketAccelerateConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAccelerateConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAclRequest +type PutBucketAclInput struct { + _ struct{} `type:"structure" payload:"AccessControlPolicy"` + + // The canned ACL to apply to the bucket. + ACL BucketCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Allows grantee the read, write, read ACP, and write ACP permissions on the + // bucket. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to list the objects in the bucket. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the bucket ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to create, overwrite, and delete any object in the bucket. + GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` + + // Allows grantee to write the ACL for the applicable bucket. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` +} + +// String returns the string representation +func (s PutBucketAclInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAclInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketAclInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketAclInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if s.AccessControlPolicy != nil { + if err := s.AccessControlPolicy.Validate(); err != nil { + invalidParams.AddNested("AccessControlPolicy", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketAclInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAclInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWrite != nil { + v := *s.GrantWrite + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.AccessControlPolicy != nil { + v := s.AccessControlPolicy + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "AccessControlPolicy", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAclOutput +type PutBucketAclOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketAclOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAclOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketAclOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAclOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfigurationRequest +type PutBucketAnalyticsConfigurationInput struct { + _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` + + // The configuration and any analyses for the analytics filter. + // + // AnalyticsConfiguration is a required field + AnalyticsConfiguration *AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // The name of the bucket to which an analytics configuration is stored. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The identifier used to represent an analytics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` +} + +// String returns the string representation +func (s PutBucketAnalyticsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAnalyticsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketAnalyticsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketAnalyticsConfigurationInput"} + + if s.AnalyticsConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("AnalyticsConfiguration")) + } + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + if s.AnalyticsConfiguration != nil { + if err := s.AnalyticsConfiguration.Validate(); err != nil { + invalidParams.AddNested("AnalyticsConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketAnalyticsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAnalyticsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.AnalyticsConfiguration != nil { + v := s.AnalyticsConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "AnalyticsConfiguration", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfigurationOutput +type PutBucketAnalyticsConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketAnalyticsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketAnalyticsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketAnalyticsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketAnalyticsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCorsRequest +type PutBucketCorsInput struct { + _ struct{} `type:"structure" payload:"CORSConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // CORSConfiguration is a required field + CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketCorsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketCorsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketCorsInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketCorsInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.CORSConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("CORSConfiguration")) + } + if s.CORSConfiguration != nil { + if err := s.CORSConfiguration.Validate(); err != nil { + invalidParams.AddNested("CORSConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketCorsInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketCorsInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.CORSConfiguration != nil { + v := s.CORSConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "CORSConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCorsOutput +type PutBucketCorsOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketCorsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketCorsOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketCorsOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketCorsOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryptionRequest +type PutBucketEncryptionInput struct { + _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` + + // The name of the bucket for which the server-side encryption configuration + // is set. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Container for server-side encryption configuration rules. Currently S3 supports + // one rule only. + // + // ServerSideEncryptionConfiguration is a required field + ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketEncryptionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketEncryptionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketEncryptionInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketEncryptionInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.ServerSideEncryptionConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("ServerSideEncryptionConfiguration")) + } + if s.ServerSideEncryptionConfiguration != nil { + if err := s.ServerSideEncryptionConfiguration.Validate(); err != nil { + invalidParams.AddNested("ServerSideEncryptionConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketEncryptionInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketEncryptionInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ServerSideEncryptionConfiguration != nil { + v := s.ServerSideEncryptionConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "ServerSideEncryptionConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryptionOutput +type PutBucketEncryptionOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketEncryptionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketEncryptionOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketEncryptionOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketEncryptionOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfigurationRequest +type PutBucketInventoryConfigurationInput struct { + _ struct{} `type:"structure" payload:"InventoryConfiguration"` + + // The name of the bucket where the inventory configuration will be stored. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the inventory configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` + + // Specifies the inventory configuration. + // + // InventoryConfiguration is a required field + InventoryConfiguration *InventoryConfiguration `locationName:"InventoryConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketInventoryConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketInventoryConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketInventoryConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketInventoryConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if s.InventoryConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("InventoryConfiguration")) + } + if s.InventoryConfiguration != nil { + if err := s.InventoryConfiguration.Validate(); err != nil { + invalidParams.AddNested("InventoryConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketInventoryConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketInventoryConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.InventoryConfiguration != nil { + v := s.InventoryConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "InventoryConfiguration", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfigurationOutput +type PutBucketInventoryConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketInventoryConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketInventoryConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketInventoryConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketInventoryConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfigurationRequest +type PutBucketLifecycleConfigurationInput struct { + _ struct{} `type:"structure" payload:"LifecycleConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + LifecycleConfiguration *BucketLifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketLifecycleConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLifecycleConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLifecycleConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketLifecycleConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if s.LifecycleConfiguration != nil { + if err := s.LifecycleConfiguration.Validate(); err != nil { + invalidParams.AddNested("LifecycleConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketLifecycleConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLifecycleConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.LifecycleConfiguration != nil { + v := s.LifecycleConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "LifecycleConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfigurationOutput +type PutBucketLifecycleConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketLifecycleConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLifecycleConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketLifecycleConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLifecycleConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleRequest +type PutBucketLifecycleInput struct { + _ struct{} `type:"structure" payload:"LifecycleConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + LifecycleConfiguration *LifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketLifecycleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLifecycleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLifecycleInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketLifecycleInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + if s.LifecycleConfiguration != nil { + if err := s.LifecycleConfiguration.Validate(); err != nil { + invalidParams.AddNested("LifecycleConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketLifecycleInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLifecycleInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.LifecycleConfiguration != nil { + v := s.LifecycleConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "LifecycleConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleOutput +type PutBucketLifecycleOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketLifecycleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLifecycleOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketLifecycleOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLifecycleOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLoggingRequest +type PutBucketLoggingInput struct { + _ struct{} `type:"structure" payload:"BucketLoggingStatus"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // BucketLoggingStatus is a required field + BucketLoggingStatus *BucketLoggingStatus `locationName:"BucketLoggingStatus" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketLoggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLoggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketLoggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketLoggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.BucketLoggingStatus == nil { + invalidParams.Add(aws.NewErrParamRequired("BucketLoggingStatus")) + } + if s.BucketLoggingStatus != nil { + if err := s.BucketLoggingStatus.Validate(); err != nil { + invalidParams.AddNested("BucketLoggingStatus", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketLoggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLoggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.BucketLoggingStatus != nil { + v := s.BucketLoggingStatus + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "BucketLoggingStatus", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLoggingOutput +type PutBucketLoggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketLoggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketLoggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketLoggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketLoggingOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfigurationRequest +type PutBucketMetricsConfigurationInput struct { + _ struct{} `type:"structure" payload:"MetricsConfiguration"` + + // The name of the bucket for which the metrics configuration is set. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The ID used to identify the metrics configuration. + // + // Id is a required field + Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` + + // Specifies the metrics configuration. + // + // MetricsConfiguration is a required field + MetricsConfiguration *MetricsConfiguration `locationName:"MetricsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketMetricsConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketMetricsConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketMetricsConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketMetricsConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Id == nil { + invalidParams.Add(aws.NewErrParamRequired("Id")) + } + + if s.MetricsConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("MetricsConfiguration")) + } + if s.MetricsConfiguration != nil { + if err := s.MetricsConfiguration.Validate(); err != nil { + invalidParams.AddNested("MetricsConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketMetricsConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketMetricsConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.MetricsConfiguration != nil { + v := s.MetricsConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "MetricsConfiguration", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfigurationOutput +type PutBucketMetricsConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketMetricsConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketMetricsConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketMetricsConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketMetricsConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfigurationRequest +type PutBucketNotificationConfigurationInput struct { + _ struct{} `type:"structure" payload:"NotificationConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Container for specifying the notification configuration of the bucket. If + // this element is empty, notifications are turned off on the bucket. + // + // NotificationConfiguration is a required field + NotificationConfiguration *GetBucketNotificationConfigurationOutput `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketNotificationConfigurationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketNotificationConfigurationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketNotificationConfigurationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketNotificationConfigurationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.NotificationConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("NotificationConfiguration")) + } + if s.NotificationConfiguration != nil { + if err := s.NotificationConfiguration.Validate(); err != nil { + invalidParams.AddNested("NotificationConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketNotificationConfigurationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketNotificationConfigurationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.NotificationConfiguration != nil { + v := s.NotificationConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "NotificationConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfigurationOutput +type PutBucketNotificationConfigurationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketNotificationConfigurationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketNotificationConfigurationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketNotificationConfigurationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketNotificationConfigurationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationRequest +type PutBucketNotificationInput struct { + _ struct{} `type:"structure" payload:"NotificationConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // NotificationConfiguration is a required field + NotificationConfiguration *GetBucketNotificationOutput `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketNotificationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketNotificationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketNotificationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketNotificationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.NotificationConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("NotificationConfiguration")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketNotificationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketNotificationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.NotificationConfiguration != nil { + v := s.NotificationConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "NotificationConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationOutput +type PutBucketNotificationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketNotificationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketNotificationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketNotificationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketNotificationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicyRequest +type PutBucketPolicyInput struct { + _ struct{} `type:"structure" payload:"Policy"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Set this parameter to true to confirm that you want to remove your permissions + // to change this bucket policy in the future. + ConfirmRemoveSelfBucketAccess *bool `location:"header" locationName:"x-amz-confirm-remove-self-bucket-access" type:"boolean"` + + // The bucket policy as a JSON document. + // + // Policy is a required field + Policy *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s PutBucketPolicyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketPolicyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketPolicyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketPolicyInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Policy == nil { + invalidParams.Add(aws.NewErrParamRequired("Policy")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketPolicyInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketPolicyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.ConfirmRemoveSelfBucketAccess != nil { + v := *s.ConfirmRemoveSelfBucketAccess + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-confirm-remove-self-bucket-access", protocol.BoolValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Policy != nil { + v := *s.Policy + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Policy", protocol.StringStream(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicyOutput +type PutBucketPolicyOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketPolicyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketPolicyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketPolicyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketPolicyOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplicationRequest +type PutBucketReplicationInput struct { + _ struct{} `type:"structure" payload:"ReplicationConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Container for replication rules. You can add as many as 1,000 rules. Total + // replication configuration size can be up to 2 MB. + // + // ReplicationConfiguration is a required field + ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketReplicationInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketReplicationInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketReplicationInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketReplicationInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.ReplicationConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("ReplicationConfiguration")) + } + if s.ReplicationConfiguration != nil { + if err := s.ReplicationConfiguration.Validate(); err != nil { + invalidParams.AddNested("ReplicationConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketReplicationInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketReplicationInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.ReplicationConfiguration != nil { + v := s.ReplicationConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "ReplicationConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplicationOutput +type PutBucketReplicationOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketReplicationOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketReplicationOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketReplicationOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketReplicationOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPaymentRequest +type PutBucketRequestPaymentInput struct { + _ struct{} `type:"structure" payload:"RequestPaymentConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // RequestPaymentConfiguration is a required field + RequestPaymentConfiguration *RequestPaymentConfiguration `locationName:"RequestPaymentConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketRequestPaymentInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketRequestPaymentInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketRequestPaymentInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketRequestPaymentInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.RequestPaymentConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("RequestPaymentConfiguration")) + } + if s.RequestPaymentConfiguration != nil { + if err := s.RequestPaymentConfiguration.Validate(); err != nil { + invalidParams.AddNested("RequestPaymentConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketRequestPaymentInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketRequestPaymentInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.RequestPaymentConfiguration != nil { + v := s.RequestPaymentConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "RequestPaymentConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPaymentOutput +type PutBucketRequestPaymentOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketRequestPaymentOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketRequestPaymentOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketRequestPaymentOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketRequestPaymentOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTaggingRequest +type PutBucketTaggingInput struct { + _ struct{} `type:"structure" payload:"Tagging"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Tagging is a required field + Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Tagging == nil { + invalidParams.Add(aws.NewErrParamRequired("Tagging")) + } + if s.Tagging != nil { + if err := s.Tagging.Validate(); err != nil { + invalidParams.AddNested("Tagging", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Tagging != nil { + v := s.Tagging + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "Tagging", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTaggingOutput +type PutBucketTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioningRequest +type PutBucketVersioningInput struct { + _ struct{} `type:"structure" payload:"VersioningConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The concatenation of the authentication device's serial number, a space, + // and the value that is displayed on your authentication device. + MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` + + // VersioningConfiguration is a required field + VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketVersioningInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketVersioningInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketVersioningInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketVersioningInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.VersioningConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("VersioningConfiguration")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketVersioningInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketVersioningInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.MFA != nil { + v := *s.MFA + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-mfa", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.VersioningConfiguration != nil { + v := s.VersioningConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "VersioningConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioningOutput +type PutBucketVersioningOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketVersioningOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketVersioningOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketVersioningOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketVersioningOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsiteRequest +type PutBucketWebsiteInput struct { + _ struct{} `type:"structure" payload:"WebsiteConfiguration"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // WebsiteConfiguration is a required field + WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` +} + +// String returns the string representation +func (s PutBucketWebsiteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketWebsiteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutBucketWebsiteInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutBucketWebsiteInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.WebsiteConfiguration == nil { + invalidParams.Add(aws.NewErrParamRequired("WebsiteConfiguration")) + } + if s.WebsiteConfiguration != nil { + if err := s.WebsiteConfiguration.Validate(); err != nil { + invalidParams.AddNested("WebsiteConfiguration", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutBucketWebsiteInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketWebsiteInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.WebsiteConfiguration != nil { + v := s.WebsiteConfiguration + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "WebsiteConfiguration", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsiteOutput +type PutBucketWebsiteOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response +} + +// String returns the string representation +func (s PutBucketWebsiteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutBucketWebsiteOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutBucketWebsiteOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutBucketWebsiteOutput) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAclRequest +type PutObjectAclInput struct { + _ struct{} `type:"structure" payload:"AccessControlPolicy"` + + // The canned ACL to apply to the object. + ACL ObjectCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Allows grantee the read, write, read ACP, and write ACP permissions on the + // bucket. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to list the objects in the bucket. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the bucket ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to create, overwrite, and delete any object in the bucket. + GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` + + // Allows grantee to write the ACL for the applicable bucket. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // VersionId used to reference a specific version of the object. + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s PutObjectAclInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectAclInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutObjectAclInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutObjectAclInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + if s.AccessControlPolicy != nil { + if err := s.AccessControlPolicy.Validate(); err != nil { + invalidParams.AddNested("AccessControlPolicy", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutObjectAclInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectAclInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWrite != nil { + v := *s.GrantWrite + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.AccessControlPolicy != nil { + v := s.AccessControlPolicy + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "AccessControlPolicy", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAclOutput +type PutObjectAclOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` +} + +// String returns the string representation +func (s PutObjectAclOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectAclOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutObjectAclOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectAclOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectRequest +type PutObjectInput struct { + _ struct{} `type:"structure" payload:"Body"` + + // The canned ACL to apply to the object. + ACL ObjectCannedACL `location:"header" locationName:"x-amz-acl" type:"string" enum:"true"` + + // Object data. + Body io.ReadSeeker `type:"blob"` + + // Name of the bucket to which the PUT operation was initiated. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` + + // Size of the body in bytes. This parameter is useful when the size of the + // body cannot be determined automatically. + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + + // The base64-encoded 128-bit MD5 digest of the part data. + ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"Content-Type" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` + + // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` + + // Allows grantee to read the object data and its metadata. + GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` + + // Allows grantee to read the object ACL. + GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` + + // Allows grantee to write the ACL for the applicable object. + GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` + + // Object key for which the PUT operation was initiated. + // + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // A map of metadata to store with the object in S3. + Metadata map[string]string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT + // requests for an object protected by AWS KMS will fail if not made via SSL + // or using SigV4. Documentation on configuring any of the officially supported + // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // The type of storage to use for the object. Defaults to 'STANDARD'. + StorageClass StorageClass `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"true"` + + // The tag-set for the object. The tag-set must be encoded as URL Query parameters + Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` + + // If the bucket is configured as a website, redirects requests for this object + // to another object in the same bucket or to an external URL. Amazon S3 stores + // the value of this header in the object metadata. + WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` +} + +// String returns the string representation +func (s PutObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *PutObjectInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.ACL) > 0 { + v := s.ACL + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-acl", v, metadata) + } + if s.CacheControl != nil { + v := *s.CacheControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Cache-Control", protocol.StringValue(v), metadata) + } + if s.ContentDisposition != nil { + v := *s.ContentDisposition + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Disposition", protocol.StringValue(v), metadata) + } + if s.ContentEncoding != nil { + v := *s.ContentEncoding + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Encoding", protocol.StringValue(v), metadata) + } + if s.ContentLanguage != nil { + v := *s.ContentLanguage + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Language", protocol.StringValue(v), metadata) + } + if s.ContentLength != nil { + v := *s.ContentLength + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Length", protocol.Int64Value(v), metadata) + } + if s.ContentMD5 != nil { + v := *s.ContentMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-MD5", protocol.StringValue(v), metadata) + } + if s.ContentType != nil { + v := *s.ContentType + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue(v), metadata) + } + if s.Expires != nil { + v := *s.Expires + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Expires", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.GrantFullControl != nil { + v := *s.GrantFullControl + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-full-control", protocol.StringValue(v), metadata) + } + if s.GrantRead != nil { + v := *s.GrantRead + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read", protocol.StringValue(v), metadata) + } + if s.GrantReadACP != nil { + v := *s.GrantReadACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-read-acp", protocol.StringValue(v), metadata) + } + if s.GrantWriteACP != nil { + v := *s.GrantWriteACP + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-grant-write-acp", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-storage-class", v, metadata) + } + if s.Tagging != nil { + v := *s.Tagging + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-tagging", protocol.StringValue(v), metadata) + } + if s.WebsiteRedirectLocation != nil { + v := *s.WebsiteRedirectLocation + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-website-redirect-location", protocol.StringValue(v), metadata) + } + if len(s.Metadata) > 0 { + v := s.Metadata + + metadata := protocol.Metadata{} + ms0 := e.Map(protocol.HeadersTarget, "x-amz-meta-", metadata) + ms0.Start() + for k1, v1 := range v { + ms0.MapSetValue(k1, protocol.StringValue(v1)) + } + ms0.End() + + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Body != nil { + v := s.Body + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Body", protocol.ReadSeekerStream{V: v}, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectOutput +type PutObjectOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Entity tag for the uploaded object. + ETag *string `location:"header" locationName:"ETag" type:"string"` + + // If the object expiration is configured, this will contain the expiration + // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. + Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` + + // Version of the object. + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s PutObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "ETag", protocol.StringValue(v), metadata) + } + if s.Expiration != nil { + v := *s.Expiration + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-expiration", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTaggingRequest +type PutObjectTaggingInput struct { + _ struct{} `type:"structure" payload:"Tagging"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Tagging is a required field + Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s PutObjectTaggingInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectTaggingInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutObjectTaggingInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "PutObjectTaggingInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.Tagging == nil { + invalidParams.Add(aws.NewErrParamRequired("Tagging")) + } + if s.Tagging != nil { + if err := s.Tagging.Validate(); err != nil { + invalidParams.AddNested("Tagging", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *PutObjectTaggingInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectTaggingInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Tagging != nil { + v := s.Tagging + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "Tagging", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTaggingOutput +type PutObjectTaggingOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s PutObjectTaggingOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutObjectTaggingOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s PutObjectTaggingOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s PutObjectTaggingOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-version-id", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for specifying an configuration when you want Amazon S3 to publish +// events to an Amazon Simple Queue Service (Amazon SQS) queue. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/QueueConfiguration +type QueueConfiguration struct { + _ struct{} `type:"structure"` + + // Events is a required field + Events []Event `locationName:"Event" type:"list" flattened:"true" required:"true"` + + // Container for object key name filtering rules. For information about key + // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + Filter *NotificationConfigurationFilter `type:"structure"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + // Amazon SQS queue ARN to which Amazon S3 will publish a message when it detects + // events of specified type. + // + // QueueArn is a required field + QueueArn *string `locationName:"Queue" type:"string" required:"true"` +} + +// String returns the string representation +func (s QueueConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueueConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *QueueConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "QueueConfiguration"} + + if s.Events == nil { + invalidParams.Add(aws.NewErrParamRequired("Events")) + } + + if s.QueueArn == nil { + invalidParams.Add(aws.NewErrParamRequired("QueueArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s QueueConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.QueueArn != nil { + v := *s.QueueArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Queue", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/QueueConfigurationDeprecated +type QueueConfigurationDeprecated struct { + _ struct{} `type:"structure"` + + // Bucket event for which to send notifications. + Event Event `deprecated:"true" type:"string" enum:"true"` + + Events []Event `locationName:"Event" type:"list" flattened:"true"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + Queue *string `type:"string"` +} + +// String returns the string representation +func (s QueueConfigurationDeprecated) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueueConfigurationDeprecated) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s QueueConfigurationDeprecated) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Event) > 0 { + v := s.Event + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Event", v, metadata) + } + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.Queue != nil { + v := *s.Queue + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Queue", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Redirect +type Redirect struct { + _ struct{} `type:"structure"` + + // The host name to use in the redirect request. + HostName *string `type:"string"` + + // The HTTP redirect code to use on the response. Not required if one of the + // siblings is present. + HttpRedirectCode *string `type:"string"` + + // Protocol to use (http, https) when redirecting requests. The default is the + // protocol that is used in the original request. + Protocol Protocol `type:"string" enum:"true"` + + // The object key prefix to use in the redirect request. For example, to redirect + // requests for all pages with prefix docs/ (objects in the docs/ folder) to + // documents/, you can set a condition block with KeyPrefixEquals set to docs/ + // and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required + // if one of the siblings is present. Can be present only if ReplaceKeyWith + // is not provided. + ReplaceKeyPrefixWith *string `type:"string"` + + // The specific object key to use in the redirect request. For example, redirect + // request to error.html. Not required if one of the sibling is present. Can + // be present only if ReplaceKeyPrefixWith is not provided. + ReplaceKeyWith *string `type:"string"` +} + +// String returns the string representation +func (s Redirect) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Redirect) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Redirect) MarshalFields(e protocol.FieldEncoder) error { + if s.HostName != nil { + v := *s.HostName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "HostName", protocol.StringValue(v), metadata) + } + if s.HttpRedirectCode != nil { + v := *s.HttpRedirectCode + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "HttpRedirectCode", protocol.StringValue(v), metadata) + } + if len(s.Protocol) > 0 { + v := s.Protocol + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Protocol", v, metadata) + } + if s.ReplaceKeyPrefixWith != nil { + v := *s.ReplaceKeyPrefixWith + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ReplaceKeyPrefixWith", protocol.StringValue(v), metadata) + } + if s.ReplaceKeyWith != nil { + v := *s.ReplaceKeyWith + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ReplaceKeyWith", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RedirectAllRequestsTo +type RedirectAllRequestsTo struct { + _ struct{} `type:"structure"` + + // Name of the host where requests will be redirected. + // + // HostName is a required field + HostName *string `type:"string" required:"true"` + + // Protocol to use (http, https) when redirecting requests. The default is the + // protocol that is used in the original request. + Protocol Protocol `type:"string" enum:"true"` +} + +// String returns the string representation +func (s RedirectAllRequestsTo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RedirectAllRequestsTo) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RedirectAllRequestsTo) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RedirectAllRequestsTo"} + + if s.HostName == nil { + invalidParams.Add(aws.NewErrParamRequired("HostName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RedirectAllRequestsTo) MarshalFields(e protocol.FieldEncoder) error { + if s.HostName != nil { + v := *s.HostName + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "HostName", protocol.StringValue(v), metadata) + } + if len(s.Protocol) > 0 { + v := s.Protocol + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Protocol", v, metadata) + } + return nil +} + +// Container for replication rules. You can add as many as 1,000 rules. Total +// replication configuration size can be up to 2 MB. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationConfiguration +type ReplicationConfiguration struct { + _ struct{} `type:"structure"` + + // Amazon Resource Name (ARN) of an IAM role for Amazon S3 to assume when replicating + // the objects. + // + // Role is a required field + Role *string `type:"string" required:"true"` + + // Container for one or more replication rules. Replication configuration must + // have at least one rule and can contain up to 1,000 rules. + // + // Rules is a required field + Rules []ReplicationRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` +} + +// String returns the string representation +func (s ReplicationConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ReplicationConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ReplicationConfiguration"} + + if s.Role == nil { + invalidParams.Add(aws.NewErrParamRequired("Role")) + } + + if s.Rules == nil { + invalidParams.Add(aws.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ReplicationConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.Role != nil { + v := *s.Role + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Role", protocol.StringValue(v), metadata) + } + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Container for information about a particular replication rule. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationRule +type ReplicationRule struct { + _ struct{} `type:"structure"` + + // Specifies whether Amazon S3 should replicate delete makers. + DeleteMarkerReplication *DeleteMarkerReplication `type:"structure"` + + // Container for replication destination information. + // + // Destination is a required field + Destination *Destination `type:"structure" required:"true"` + + // Filter that identifies subset of objects to which the replication rule applies. + // A Filter must specify exactly one Prefix, Tag, or an And child element. + Filter *ReplicationRuleFilter `type:"structure"` + + // Unique identifier for the rule. The value cannot be longer than 255 characters. + ID *string `type:"string"` + + // Object keyname prefix identifying one or more objects to which the rule applies. + // Maximum prefix length can be up to 1,024 characters. + Prefix *string `deprecated:"true" type:"string"` + + // The priority associated with the rule. If you specify multiple rules in a + // replication configuration, then Amazon S3 applies rule priority in the event + // there are conflicts (two or more rules identify the same object based on + // filter specified). The rule with higher priority takes precedence. For example, + // + // * Same object quality prefix based filter criteria If prefixes you specified + // in multiple rules overlap. + // + // * Same object qualify tag based filter criteria specified in multiple + // rules + // + // For more information, see Cross-Region Replication (CRR) ( https://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html) + // in the Amazon S3 Developer Guide. + Priority *int64 `type:"integer"` + + // Container that describes additional filters in identifying source objects + // that you want to replicate. Currently, Amazon S3 supports only the filter + // that you can specify for objects created with server-side encryption using + // an AWS KMS-managed key. You can choose to enable or disable replication of + // these objects. + // + // if you want Amazon S3 to replicate objects created with server-side encryption + // using AWS KMS-managed keys. + SourceSelectionCriteria *SourceSelectionCriteria `type:"structure"` + + // The rule is ignored if status is not Enabled. + // + // Status is a required field + Status ReplicationRuleStatus `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s ReplicationRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ReplicationRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationRule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ReplicationRule"} + + if s.Destination == nil { + invalidParams.Add(aws.NewErrParamRequired("Destination")) + } + if len(s.Status) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Status")) + } + if s.Destination != nil { + if err := s.Destination.Validate(); err != nil { + invalidParams.AddNested("Destination", err.(aws.ErrInvalidParams)) + } + } + if s.Filter != nil { + if err := s.Filter.Validate(); err != nil { + invalidParams.AddNested("Filter", err.(aws.ErrInvalidParams)) + } + } + if s.SourceSelectionCriteria != nil { + if err := s.SourceSelectionCriteria.Validate(); err != nil { + invalidParams.AddNested("SourceSelectionCriteria", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ReplicationRule) MarshalFields(e protocol.FieldEncoder) error { + if s.DeleteMarkerReplication != nil { + v := s.DeleteMarkerReplication + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "DeleteMarkerReplication", v, metadata) + } + if s.Destination != nil { + v := s.Destination + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Destination", v, metadata) + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.Priority != nil { + v := *s.Priority + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Priority", protocol.Int64Value(v), metadata) + } + if s.SourceSelectionCriteria != nil { + v := s.SourceSelectionCriteria + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "SourceSelectionCriteria", v, metadata) + } + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationRuleAndOperator +type ReplicationRuleAndOperator struct { + _ struct{} `type:"structure"` + + Prefix *string `type:"string"` + + Tags []Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` +} + +// String returns the string representation +func (s ReplicationRuleAndOperator) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ReplicationRuleAndOperator) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationRuleAndOperator) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ReplicationRuleAndOperator"} + if s.Tags != nil { + for i, v := range s.Tags { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ReplicationRuleAndOperator) MarshalFields(e protocol.FieldEncoder) error { + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Tags) > 0 { + v := s.Tags + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Tag", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Filter that identifies subset of objects to which the replication rule applies. +// A Filter must specify exactly one Prefix, Tag, or an And child element. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationRuleFilter +type ReplicationRuleFilter struct { + _ struct{} `type:"structure"` + + // Container for specifying rule filters. These filters determine the subset + // of objects to which the rule applies. The element is required only if you + // specify more than one filter. For example: + // + // * You specify both a Prefix and a Tag filters. Then you wrap these in + // an And tag. + // + // * You specify filter based on multiple tags. Then you wrap the Tag elements + // in an And tag. + And *ReplicationRuleAndOperator `type:"structure"` + + // Object keyname prefix that identifies subset of objects to which the rule + // applies. + Prefix *string `type:"string"` + + // Container for specifying a tag key and value. + // + // The rule applies only to objects having the tag in its tagset. + Tag *Tag `type:"structure"` +} + +// String returns the string representation +func (s ReplicationRuleFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ReplicationRuleFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReplicationRuleFilter) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ReplicationRuleFilter"} + if s.And != nil { + if err := s.And.Validate(); err != nil { + invalidParams.AddNested("And", err.(aws.ErrInvalidParams)) + } + } + if s.Tag != nil { + if err := s.Tag.Validate(); err != nil { + invalidParams.AddNested("Tag", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ReplicationRuleFilter) MarshalFields(e protocol.FieldEncoder) error { + if s.And != nil { + v := s.And + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "And", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if s.Tag != nil { + v := s.Tag + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Tag", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RequestPaymentConfiguration +type RequestPaymentConfiguration struct { + _ struct{} `type:"structure"` + + // Specifies who pays for the download and request fees. + // + // Payer is a required field + Payer Payer `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s RequestPaymentConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RequestPaymentConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RequestPaymentConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RequestPaymentConfiguration"} + if len(s.Payer) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Payer")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RequestPaymentConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Payer) > 0 { + v := s.Payer + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Payer", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObjectRequest +type RestoreObjectInput struct { + _ struct{} `type:"structure" payload:"RestoreRequest"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Container for restore job parameters. + RestoreRequest *RestoreRequest `locationName:"RestoreRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` + + VersionId *string `location:"querystring" locationName:"versionId" type:"string"` +} + +// String returns the string representation +func (s RestoreObjectInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RestoreObjectInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RestoreObjectInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RestoreObjectInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + if s.RestoreRequest != nil { + if err := s.RestoreRequest.Validate(); err != nil { + invalidParams.AddNested("RestoreRequest", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *RestoreObjectInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RestoreObjectInput) MarshalFields(e protocol.FieldEncoder) error { + + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.RestoreRequest != nil { + v := s.RestoreRequest + + metadata := protocol.Metadata{XMLNamespaceURI: "http://s3.amazonaws.com/doc/2006-03-01/"} + e.SetFields(protocol.PayloadTarget, "RestoreRequest", v, metadata) + } + if s.VersionId != nil { + v := *s.VersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "versionId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObjectOutput +type RestoreObjectOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // Indicates the path in the provided S3 output location where Select results + // will be restored to. + RestoreOutputPath *string `location:"header" locationName:"x-amz-restore-output-path" type:"string"` +} + +// String returns the string representation +func (s RestoreObjectOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RestoreObjectOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s RestoreObjectOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RestoreObjectOutput) MarshalFields(e protocol.FieldEncoder) error { + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.RestoreOutputPath != nil { + v := *s.RestoreOutputPath + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-restore-output-path", protocol.StringValue(v), metadata) + } + return nil +} + +// Container for restore job parameters. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreRequest +type RestoreRequest struct { + _ struct{} `type:"structure"` + + // Lifetime of the active copy in days. Do not use with restores that specify + // OutputLocation. + Days *int64 `type:"integer"` + + // The optional description for the job. + Description *string `type:"string"` + + // Glacier related parameters pertaining to this job. Do not use with restores + // that specify OutputLocation. + GlacierJobParameters *GlacierJobParameters `type:"structure"` + + // Describes the location where the restore job's output is stored. + OutputLocation *OutputLocation `type:"structure"` + + // Describes the parameters for Select job types. + SelectParameters *SelectParameters `type:"structure"` + + // Glacier retrieval tier at which the restore will be processed. + Tier Tier `type:"string" enum:"true"` + + // Type of restore request. + Type RestoreRequestType `type:"string" enum:"true"` +} + +// String returns the string representation +func (s RestoreRequest) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RestoreRequest) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RestoreRequest) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RestoreRequest"} + if s.GlacierJobParameters != nil { + if err := s.GlacierJobParameters.Validate(); err != nil { + invalidParams.AddNested("GlacierJobParameters", err.(aws.ErrInvalidParams)) + } + } + if s.OutputLocation != nil { + if err := s.OutputLocation.Validate(); err != nil { + invalidParams.AddNested("OutputLocation", err.(aws.ErrInvalidParams)) + } + } + if s.SelectParameters != nil { + if err := s.SelectParameters.Validate(); err != nil { + invalidParams.AddNested("SelectParameters", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RestoreRequest) MarshalFields(e protocol.FieldEncoder) error { + if s.Days != nil { + v := *s.Days + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Days", protocol.Int64Value(v), metadata) + } + if s.Description != nil { + v := *s.Description + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Description", protocol.StringValue(v), metadata) + } + if s.GlacierJobParameters != nil { + v := s.GlacierJobParameters + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "GlacierJobParameters", v, metadata) + } + if s.OutputLocation != nil { + v := s.OutputLocation + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "OutputLocation", v, metadata) + } + if s.SelectParameters != nil { + v := s.SelectParameters + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "SelectParameters", v, metadata) + } + if len(s.Tier) > 0 { + v := s.Tier + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Tier", v, metadata) + } + if len(s.Type) > 0 { + v := s.Type + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Type", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RoutingRule +type RoutingRule struct { + _ struct{} `type:"structure"` + + // A container for describing a condition that must be met for the specified + // redirect to apply. For example, 1. If request is for pages in the /docs folder, + // redirect to the /documents folder. 2. If request results in HTTP error 4xx, + // redirect request to another host where you might process the error. + Condition *Condition `type:"structure"` + + // Container for redirect information. You can redirect requests to another + // host, to another page, or with another protocol. In the event of an error, + // you can can specify a different error code to return. + // + // Redirect is a required field + Redirect *Redirect `type:"structure" required:"true"` +} + +// String returns the string representation +func (s RoutingRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RoutingRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RoutingRule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "RoutingRule"} + + if s.Redirect == nil { + invalidParams.Add(aws.NewErrParamRequired("Redirect")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s RoutingRule) MarshalFields(e protocol.FieldEncoder) error { + if s.Condition != nil { + v := s.Condition + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Condition", v, metadata) + } + if s.Redirect != nil { + v := s.Redirect + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Redirect", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Rule +type Rule struct { + _ struct{} `type:"structure"` + + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. + AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` + + Expiration *LifecycleExpiration `type:"structure"` + + // Unique identifier for the rule. The value cannot be longer than 255 characters. + ID *string `type:"string"` + + // Specifies when noncurrent object versions expire. Upon expiration, Amazon + // S3 permanently deletes the noncurrent object versions. You set this lifecycle + // configuration action on a bucket that has versioning enabled (or suspended) + // to request that Amazon S3 delete noncurrent object versions at a specific + // period in the object's lifetime. + NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` + + // Container for the transition rule that describes when noncurrent objects + // transition to the STANDARD_IA, ONEZONE_IA or GLACIER storage class. If your + // bucket is versioning-enabled (or versioning is suspended), you can set this + // action to request that Amazon S3 transition noncurrent object versions to + // the STANDARD_IA, ONEZONE_IA or GLACIER storage class at a specific period + // in the object's lifetime. + NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` + + // Prefix identifying one or more objects to which the rule applies. + // + // Prefix is a required field + Prefix *string `type:"string" required:"true"` + + // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule + // is not currently being applied. + // + // Status is a required field + Status ExpirationStatus `type:"string" required:"true" enum:"true"` + + Transition *Transition `type:"structure"` +} + +// String returns the string representation +func (s Rule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Rule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Rule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Rule"} + + if s.Prefix == nil { + invalidParams.Add(aws.NewErrParamRequired("Prefix")) + } + if len(s.Status) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Status")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Rule) MarshalFields(e protocol.FieldEncoder) error { + if s.AbortIncompleteMultipartUpload != nil { + v := s.AbortIncompleteMultipartUpload + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "AbortIncompleteMultipartUpload", v, metadata) + } + if s.Expiration != nil { + v := s.Expiration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Expiration", v, metadata) + } + if s.ID != nil { + v := *s.ID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ID", protocol.StringValue(v), metadata) + } + if s.NoncurrentVersionExpiration != nil { + v := s.NoncurrentVersionExpiration + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "NoncurrentVersionExpiration", v, metadata) + } + if s.NoncurrentVersionTransition != nil { + v := s.NoncurrentVersionTransition + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "NoncurrentVersionTransition", v, metadata) + } + if s.Prefix != nil { + v := *s.Prefix + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Prefix", protocol.StringValue(v), metadata) + } + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + if s.Transition != nil { + v := s.Transition + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Transition", v, metadata) + } + return nil +} + +// Specifies the use of SSE-KMS to encrypt delievered Inventory reports. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SSEKMS +type SSEKMS struct { + _ struct{} `type:"structure"` + + // Specifies the ID of the AWS Key Management Service (KMS) master encryption + // key to use for encrypting Inventory reports. + // + // KeyId is a required field + KeyId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s SSEKMS) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SSEKMS) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SSEKMS) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SSEKMS"} + + if s.KeyId == nil { + invalidParams.Add(aws.NewErrParamRequired("KeyId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s SSEKMS) MarshalFields(e protocol.FieldEncoder) error { + if s.KeyId != nil { + v := *s.KeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KeyId", protocol.StringValue(v), metadata) + } + return nil +} + +// Specifies the use of SSE-S3 to encrypt delievered Inventory reports. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SSES3 +type SSES3 struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s SSES3) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SSES3) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s SSES3) MarshalFields(e protocol.FieldEncoder) error { + return nil +} + +// Describes the parameters for Select job types. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectParameters +type SelectParameters struct { + _ struct{} `type:"structure"` + + // The expression that is used to query the object. + // + // Expression is a required field + Expression *string `type:"string" required:"true"` + + // The type of the provided expression (e.g., SQL). + // + // ExpressionType is a required field + ExpressionType ExpressionType `type:"string" required:"true" enum:"true"` + + // Describes the serialization format of the object. + // + // InputSerialization is a required field + InputSerialization *InputSerialization `type:"structure" required:"true"` + + // Describes how the results of the Select job are serialized. + // + // OutputSerialization is a required field + OutputSerialization *OutputSerialization `type:"structure" required:"true"` +} + +// String returns the string representation +func (s SelectParameters) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SelectParameters) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SelectParameters) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SelectParameters"} + + if s.Expression == nil { + invalidParams.Add(aws.NewErrParamRequired("Expression")) + } + if len(s.ExpressionType) == 0 { + invalidParams.Add(aws.NewErrParamRequired("ExpressionType")) + } + + if s.InputSerialization == nil { + invalidParams.Add(aws.NewErrParamRequired("InputSerialization")) + } + + if s.OutputSerialization == nil { + invalidParams.Add(aws.NewErrParamRequired("OutputSerialization")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s SelectParameters) MarshalFields(e protocol.FieldEncoder) error { + if s.Expression != nil { + v := *s.Expression + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Expression", protocol.StringValue(v), metadata) + } + if len(s.ExpressionType) > 0 { + v := s.ExpressionType + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "ExpressionType", v, metadata) + } + if s.InputSerialization != nil { + v := s.InputSerialization + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "InputSerialization", v, metadata) + } + if s.OutputSerialization != nil { + v := s.OutputSerialization + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "OutputSerialization", v, metadata) + } + return nil +} + +// Describes the default server-side encryption to apply to new objects in the +// bucket. If Put Object request does not specify any server-side encryption, +// this default encryption will be applied. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionByDefault +type ServerSideEncryptionByDefault struct { + _ struct{} `type:"structure"` + + // KMS master key ID to use for the default encryption. This parameter is allowed + // if SSEAlgorithm is aws:kms. + KMSMasterKeyID *string `type:"string"` + + // Server-side encryption algorithm to use for the default encryption. + // + // SSEAlgorithm is a required field + SSEAlgorithm ServerSideEncryption `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s ServerSideEncryptionByDefault) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ServerSideEncryptionByDefault) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ServerSideEncryptionByDefault) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ServerSideEncryptionByDefault"} + if len(s.SSEAlgorithm) == 0 { + invalidParams.Add(aws.NewErrParamRequired("SSEAlgorithm")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ServerSideEncryptionByDefault) MarshalFields(e protocol.FieldEncoder) error { + if s.KMSMasterKeyID != nil { + v := *s.KMSMasterKeyID + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "KMSMasterKeyID", protocol.StringValue(v), metadata) + } + if len(s.SSEAlgorithm) > 0 { + v := s.SSEAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "SSEAlgorithm", v, metadata) + } + return nil +} + +// Container for server-side encryption configuration rules. Currently S3 supports +// one rule only. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionConfiguration +type ServerSideEncryptionConfiguration struct { + _ struct{} `type:"structure"` + + // Container for information about a particular server-side encryption configuration + // rule. + // + // Rules is a required field + Rules []ServerSideEncryptionRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` +} + +// String returns the string representation +func (s ServerSideEncryptionConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ServerSideEncryptionConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ServerSideEncryptionConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ServerSideEncryptionConfiguration"} + + if s.Rules == nil { + invalidParams.Add(aws.NewErrParamRequired("Rules")) + } + if s.Rules != nil { + for i, v := range s.Rules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ServerSideEncryptionConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Rules) > 0 { + v := s.Rules + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Rule", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Container for information about a particular server-side encryption configuration +// rule. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionRule +type ServerSideEncryptionRule struct { + _ struct{} `type:"structure"` + + // Describes the default server-side encryption to apply to new objects in the + // bucket. If Put Object request does not specify any server-side encryption, + // this default encryption will be applied. + ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault `type:"structure"` +} + +// String returns the string representation +func (s ServerSideEncryptionRule) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ServerSideEncryptionRule) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ServerSideEncryptionRule) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "ServerSideEncryptionRule"} + if s.ApplyServerSideEncryptionByDefault != nil { + if err := s.ApplyServerSideEncryptionByDefault.Validate(); err != nil { + invalidParams.AddNested("ApplyServerSideEncryptionByDefault", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s ServerSideEncryptionRule) MarshalFields(e protocol.FieldEncoder) error { + if s.ApplyServerSideEncryptionByDefault != nil { + v := s.ApplyServerSideEncryptionByDefault + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "ApplyServerSideEncryptionByDefault", v, metadata) + } + return nil +} + +// Container for filters that define which source objects should be replicated. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SourceSelectionCriteria +type SourceSelectionCriteria struct { + _ struct{} `type:"structure"` + + // Container for filter information of selection of KMS Encrypted S3 objects. + // The element is required if you include SourceSelectionCriteria in the replication + // configuration. + SseKmsEncryptedObjects *SseKmsEncryptedObjects `type:"structure"` +} + +// String returns the string representation +func (s SourceSelectionCriteria) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SourceSelectionCriteria) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SourceSelectionCriteria) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SourceSelectionCriteria"} + if s.SseKmsEncryptedObjects != nil { + if err := s.SseKmsEncryptedObjects.Validate(); err != nil { + invalidParams.AddNested("SseKmsEncryptedObjects", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s SourceSelectionCriteria) MarshalFields(e protocol.FieldEncoder) error { + if s.SseKmsEncryptedObjects != nil { + v := s.SseKmsEncryptedObjects + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "SseKmsEncryptedObjects", v, metadata) + } + return nil +} + +// Container for filter information of selection of KMS Encrypted S3 objects. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SseKmsEncryptedObjects +type SseKmsEncryptedObjects struct { + _ struct{} `type:"structure"` + + // The replication for KMS encrypted S3 objects is disabled if status is not + // Enabled. + // + // Status is a required field + Status SseKmsEncryptedObjectsStatus `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s SseKmsEncryptedObjects) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s SseKmsEncryptedObjects) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *SseKmsEncryptedObjects) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "SseKmsEncryptedObjects"} + if len(s.Status) == 0 { + invalidParams.Add(aws.NewErrParamRequired("Status")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s SseKmsEncryptedObjects) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/StorageClassAnalysis +type StorageClassAnalysis struct { + _ struct{} `type:"structure"` + + // A container used to describe how data related to the storage class analysis + // should be exported. + DataExport *StorageClassAnalysisDataExport `type:"structure"` +} + +// String returns the string representation +func (s StorageClassAnalysis) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StorageClassAnalysis) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StorageClassAnalysis) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "StorageClassAnalysis"} + if s.DataExport != nil { + if err := s.DataExport.Validate(); err != nil { + invalidParams.AddNested("DataExport", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s StorageClassAnalysis) MarshalFields(e protocol.FieldEncoder) error { + if s.DataExport != nil { + v := s.DataExport + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "DataExport", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/StorageClassAnalysisDataExport +type StorageClassAnalysisDataExport struct { + _ struct{} `type:"structure"` + + // The place to store the data for an analysis. + // + // Destination is a required field + Destination *AnalyticsExportDestination `type:"structure" required:"true"` + + // The version of the output schema to use when exporting data. Must be V_1. + // + // OutputSchemaVersion is a required field + OutputSchemaVersion StorageClassAnalysisSchemaVersion `type:"string" required:"true" enum:"true"` +} + +// String returns the string representation +func (s StorageClassAnalysisDataExport) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StorageClassAnalysisDataExport) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StorageClassAnalysisDataExport) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "StorageClassAnalysisDataExport"} + + if s.Destination == nil { + invalidParams.Add(aws.NewErrParamRequired("Destination")) + } + if len(s.OutputSchemaVersion) == 0 { + invalidParams.Add(aws.NewErrParamRequired("OutputSchemaVersion")) + } + if s.Destination != nil { + if err := s.Destination.Validate(); err != nil { + invalidParams.AddNested("Destination", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s StorageClassAnalysisDataExport) MarshalFields(e protocol.FieldEncoder) error { + if s.Destination != nil { + v := s.Destination + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Destination", v, metadata) + } + if len(s.OutputSchemaVersion) > 0 { + v := s.OutputSchemaVersion + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "OutputSchemaVersion", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Tag +type Tag struct { + _ struct{} `type:"structure"` + + // Name of the tag. + // + // Key is a required field + Key *string `min:"1" type:"string" required:"true"` + + // Value of the tag. + // + // Value is a required field + Value *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s Tag) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tag) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tag) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Tag"} + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.Value == nil { + invalidParams.Add(aws.NewErrParamRequired("Value")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Tag) MarshalFields(e protocol.FieldEncoder) error { + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Value != nil { + v := *s.Value + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Value", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Tagging +type Tagging struct { + _ struct{} `type:"structure"` + + // TagSet is a required field + TagSet []Tag `locationNameList:"Tag" type:"list" required:"true"` +} + +// String returns the string representation +func (s Tagging) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Tagging) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Tagging) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "Tagging"} + + if s.TagSet == nil { + invalidParams.Add(aws.NewErrParamRequired("TagSet")) + } + if s.TagSet != nil { + for i, v := range s.TagSet { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TagSet", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Tagging) MarshalFields(e protocol.FieldEncoder) error { + if len(s.TagSet) > 0 { + v := s.TagSet + + metadata := protocol.Metadata{ListLocationName: "Tag"} + ls0 := e.List(protocol.BodyTarget, "TagSet", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TargetGrant +type TargetGrant struct { + _ struct{} `type:"structure"` + + Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` + + // Logging permissions assigned to the Grantee for the bucket. + Permission BucketLogsPermission `type:"string" enum:"true"` +} + +// String returns the string representation +func (s TargetGrant) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TargetGrant) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TargetGrant) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "TargetGrant"} + if s.Grantee != nil { + if err := s.Grantee.Validate(); err != nil { + invalidParams.AddNested("Grantee", err.(aws.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TargetGrant) MarshalFields(e protocol.FieldEncoder) error { + if s.Grantee != nil { + v := s.Grantee + attrs := make([]protocol.Attribute, 0, 1) + + if len(s.Grantee.Type) > 0 { + + v := s.Grantee.Type + attrs = append(attrs, protocol.Attribute{Name: "xsi:type", Value: v, Meta: protocol.Metadata{}}) + } + metadata := protocol.Metadata{Attributes: attrs, XMLNamespacePrefix: "xsi", XMLNamespaceURI: "http://www.w3.org/2001/XMLSchema-instance"} + e.SetFields(protocol.BodyTarget, "Grantee", v, metadata) + } + if len(s.Permission) > 0 { + v := s.Permission + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Permission", v, metadata) + } + return nil +} + +// Container for specifying the configuration when you want Amazon S3 to publish +// events to an Amazon Simple Notification Service (Amazon SNS) topic. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TopicConfiguration +type TopicConfiguration struct { + _ struct{} `type:"structure"` + + // Events is a required field + Events []Event `locationName:"Event" type:"list" flattened:"true" required:"true"` + + // Container for object key name filtering rules. For information about key + // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // in the Amazon Simple Storage Service Developer Guide. + Filter *NotificationConfigurationFilter `type:"structure"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + // Amazon SNS topic ARN to which Amazon S3 will publish a message when it detects + // events of specified type. + // + // TopicArn is a required field + TopicArn *string `locationName:"Topic" type:"string" required:"true"` +} + +// String returns the string representation +func (s TopicConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TopicConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TopicConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "TopicConfiguration"} + + if s.Events == nil { + invalidParams.Add(aws.NewErrParamRequired("Events")) + } + + if s.TopicArn == nil { + invalidParams.Add(aws.NewErrParamRequired("TopicArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TopicConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Filter != nil { + v := s.Filter + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "Filter", v, metadata) + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.TopicArn != nil { + v := *s.TopicArn + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Topic", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TopicConfigurationDeprecated +type TopicConfigurationDeprecated struct { + _ struct{} `type:"structure"` + + // Bucket event for which to send notifications. + Event Event `deprecated:"true" type:"string" enum:"true"` + + Events []Event `locationName:"Event" type:"list" flattened:"true"` + + // Optional unique identifier for configurations in a notification configuration. + // If you don't provide one, Amazon S3 will assign an ID. + Id *string `type:"string"` + + // Amazon SNS topic to which Amazon S3 will publish a message to report the + // specified events for the bucket. + Topic *string `type:"string"` +} + +// String returns the string representation +func (s TopicConfigurationDeprecated) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TopicConfigurationDeprecated) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s TopicConfigurationDeprecated) MarshalFields(e protocol.FieldEncoder) error { + if len(s.Event) > 0 { + v := s.Event + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Event", v, metadata) + } + if len(s.Events) > 0 { + v := s.Events + + metadata := protocol.Metadata{Flatten: true} + ls0 := e.List(protocol.BodyTarget, "Event", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddValue(protocol.StringValue(v1)) + } + ls0.End() + + } + if s.Id != nil { + v := *s.Id + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Id", protocol.StringValue(v), metadata) + } + if s.Topic != nil { + v := *s.Topic + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Topic", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Transition +type Transition struct { + _ struct{} `type:"structure"` + + // Indicates at what date the object is to be moved or deleted. Should be in + // GMT ISO 8601 Format. + Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` + + // Indicates the lifetime, in days, of the objects that are subject to the rule. + // The value must be a non-zero positive integer. + Days *int64 `type:"integer"` + + // The class of storage used to store the object. + StorageClass TransitionStorageClass `type:"string" enum:"true"` +} + +// String returns the string representation +func (s Transition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Transition) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s Transition) MarshalFields(e protocol.FieldEncoder) error { + if s.Date != nil { + v := *s.Date + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Date", protocol.TimeValue{V: v, Format: protocol.ISO8601TimeFormat}, metadata) + } + if s.Days != nil { + v := *s.Days + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Days", protocol.Int64Value(v), metadata) + } + if len(s.StorageClass) > 0 { + v := s.StorageClass + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "StorageClass", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopyRequest +type UploadPartCopyInput struct { + _ struct{} `type:"structure"` + + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // The name of the source bucket and key name of the source object, separated + // by a slash (/). Must be URL-encoded. + // + // CopySource is a required field + CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` + + // Copies the object if its entity tag (ETag) matches the specified tag. + CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` + + // Copies the object if it has been modified since the specified time. + CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` + + // Copies the object if its entity tag (ETag) is different than the specified + // ETag. + CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` + + // Copies the object if it hasn't been modified since the specified time. + CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` + + // The range of bytes to copy from the source object. The range value must use + // the form bytes=first-last, where the first and last are the zero-based byte + // offsets to copy. For example, bytes=0-9 indicates that you want to copy the + // first ten bytes of the source. You can copy a range only if the source object + // is greater than 5 GB. + CopySourceRange *string `location:"header" locationName:"x-amz-copy-source-range" type:"string"` + + // Specifies the algorithm to use when decrypting the source object (e.g., AES256). + CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt + // the source object. The encryption key provided in this header must be one + // that was used when the source object was created. + CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` + + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Part number of part being copied. This is a positive integer between 1 and + // 10,000. + // + // PartNumber is a required field + PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. This must be the same encryption key specified in the initiate multipart + // upload request. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // Upload ID identifying the multipart upload whose part is being copied. + // + // UploadId is a required field + UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s UploadPartCopyInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadPartCopyInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UploadPartCopyInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UploadPartCopyInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.CopySource == nil { + invalidParams.Add(aws.NewErrParamRequired("CopySource")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.PartNumber == nil { + invalidParams.Add(aws.NewErrParamRequired("PartNumber")) + } + + if s.UploadId == nil { + invalidParams.Add(aws.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *UploadPartCopyInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *UploadPartCopyInput) getCopySourceSSECustomerKey() (v string) { + if s.CopySourceSSECustomerKey == nil { + return v + } + return *s.CopySourceSSECustomerKey +} + +func (s *UploadPartCopyInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UploadPartCopyInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.CopySource != nil { + v := *s.CopySource + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source", protocol.StringValue(v), metadata) + } + if s.CopySourceIfMatch != nil { + v := *s.CopySourceIfMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-match", protocol.StringValue(v), metadata) + } + if s.CopySourceIfModifiedSince != nil { + v := *s.CopySourceIfModifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-modified-since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.CopySourceIfNoneMatch != nil { + v := *s.CopySourceIfNoneMatch + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-none-match", protocol.StringValue(v), metadata) + } + if s.CopySourceIfUnmodifiedSince != nil { + v := *s.CopySourceIfUnmodifiedSince + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-if-unmodified-since", protocol.TimeValue{V: v, Format: protocol.RFC822TimeFromat}, metadata) + } + if s.CopySourceRange != nil { + v := *s.CopySourceRange + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-range", protocol.StringValue(v), metadata) + } + if s.CopySourceSSECustomerAlgorithm != nil { + v := *s.CopySourceSSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.CopySourceSSECustomerKey != nil { + v := *s.CopySourceSSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.CopySourceSSECustomerKeyMD5 != nil { + v := *s.CopySourceSSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "partNumber", protocol.Int64Value(v), metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "uploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopyOutput +type UploadPartCopyOutput struct { + _ struct{} `type:"structure" payload:"CopyPartResult"` + + responseMetadata aws.Response + + CopyPartResult *CopyPartResult `type:"structure"` + + // The version of the source object that was copied, if you have enabled versioning + // on the source bucket. + CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` +} + +// String returns the string representation +func (s UploadPartCopyOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadPartCopyOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UploadPartCopyOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UploadPartCopyOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.CopySourceVersionId != nil { + v := *s.CopySourceVersionId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-copy-source-version-id", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + if s.CopyPartResult != nil { + v := s.CopyPartResult + + metadata := protocol.Metadata{} + e.SetFields(protocol.PayloadTarget, "CopyPartResult", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartRequest +type UploadPartInput struct { + _ struct{} `type:"structure" payload:"Body"` + + // Object data. + Body io.ReadSeeker `type:"blob"` + + // Name of the bucket to which the multipart upload was initiated. + // + // Bucket is a required field + Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` + + // Size of the body in bytes. This parameter is useful when the size of the + // body cannot be determined automatically. + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + + // The base64-encoded 128-bit MD5 digest of the part data. + ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` + + // Object key for which the multipart upload was initiated. + // + // Key is a required field + Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + + // Part number of part being uploaded. This is a positive integer between 1 + // and 10,000. + // + // PartNumber is a required field + PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` + + // Confirms that the requester knows that she or he will be charged for the + // request. Bucket owners need not specify this parameter in their requests. + // Documentation on downloading objects from requester pays buckets can be found + // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html + RequestPayer RequestPayer `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"true"` + + // Specifies the algorithm to use to when encrypting the object (e.g., AES256). + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting + // data. This value is used to store the object and then it is discarded; Amazon + // does not store the encryption key. The key must be appropriate for use with + // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm + // header. This must be the same encryption key specified in the initiate multipart + // upload request. + SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` + + // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. + // Amazon S3 uses this header for a message integrity check to ensure the encryption + // key was transmitted without error. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // Upload ID identifying the multipart upload whose part is being uploaded. + // + // UploadId is a required field + UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` +} + +// String returns the string representation +func (s UploadPartInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadPartInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UploadPartInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "UploadPartInput"} + + if s.Bucket == nil { + invalidParams.Add(aws.NewErrParamRequired("Bucket")) + } + + if s.Key == nil { + invalidParams.Add(aws.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Key", 1)) + } + + if s.PartNumber == nil { + invalidParams.Add(aws.NewErrParamRequired("PartNumber")) + } + + if s.UploadId == nil { + invalidParams.Add(aws.NewErrParamRequired("UploadId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +func (s *UploadPartInput) getBucket() (v string) { + if s.Bucket == nil { + return v + } + return *s.Bucket +} + +func (s *UploadPartInput) getSSECustomerKey() (v string) { + if s.SSECustomerKey == nil { + return v + } + return *s.SSECustomerKey +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UploadPartInput) MarshalFields(e protocol.FieldEncoder) error { + + if s.ContentLength != nil { + v := *s.ContentLength + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-Length", protocol.Int64Value(v), metadata) + } + if s.ContentMD5 != nil { + v := *s.ContentMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "Content-MD5", protocol.StringValue(v), metadata) + } + if len(s.RequestPayer) > 0 { + v := s.RequestPayer + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-payer", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKey != nil { + v := *s.SSECustomerKey + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.Bucket != nil { + v := *s.Bucket + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Bucket", protocol.StringValue(v), metadata) + } + if s.Key != nil { + v := *s.Key + + metadata := protocol.Metadata{} + e.SetValue(protocol.PathTarget, "Key", protocol.StringValue(v), metadata) + } + if s.Body != nil { + v := s.Body + + metadata := protocol.Metadata{} + e.SetStream(protocol.PayloadTarget, "Body", protocol.ReadSeekerStream{V: v}, metadata) + } + if s.PartNumber != nil { + v := *s.PartNumber + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "partNumber", protocol.Int64Value(v), metadata) + } + if s.UploadId != nil { + v := *s.UploadId + + metadata := protocol.Metadata{} + e.SetValue(protocol.QueryTarget, "uploadId", protocol.StringValue(v), metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartOutput +type UploadPartOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // Entity tag for the uploaded object. + ETag *string `location:"header" locationName:"ETag" type:"string"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged RequestCharged `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"true"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header confirming the encryption algorithm + // used. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // If server-side encryption with a customer-provided encryption key was requested, + // the response will include this header to provide round trip message integrity + // verification of the customer-provided encryption key. + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (KMS) master + // encryption key that was used for the object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` + + // The Server-side encryption algorithm used when storing this object in S3 + // (e.g., AES256, aws:kms). + ServerSideEncryption ServerSideEncryption `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"true"` +} + +// String returns the string representation +func (s UploadPartOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UploadPartOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s UploadPartOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s UploadPartOutput) MarshalFields(e protocol.FieldEncoder) error { + if s.ETag != nil { + v := *s.ETag + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "ETag", protocol.StringValue(v), metadata) + } + if len(s.RequestCharged) > 0 { + v := s.RequestCharged + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-request-charged", v, metadata) + } + if s.SSECustomerAlgorithm != nil { + v := *s.SSECustomerAlgorithm + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-algorithm", protocol.StringValue(v), metadata) + } + if s.SSECustomerKeyMD5 != nil { + v := *s.SSECustomerKeyMD5 + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-customer-key-MD5", protocol.StringValue(v), metadata) + } + if s.SSEKMSKeyId != nil { + v := *s.SSEKMSKeyId + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption-aws-kms-key-id", protocol.StringValue(v), metadata) + } + if len(s.ServerSideEncryption) > 0 { + v := s.ServerSideEncryption + + metadata := protocol.Metadata{} + e.SetValue(protocol.HeaderTarget, "x-amz-server-side-encryption", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/VersioningConfiguration +type VersioningConfiguration struct { + _ struct{} `type:"structure"` + + // Specifies whether MFA delete is enabled in the bucket versioning configuration. + // This element is only returned if the bucket has been configured with MFA + // delete. If the bucket has never been so configured, this element is not returned. + MFADelete MFADelete `locationName:"MfaDelete" type:"string" enum:"true"` + + // The versioning state of the bucket. + Status BucketVersioningStatus `type:"string" enum:"true"` +} + +// String returns the string representation +func (s VersioningConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VersioningConfiguration) GoString() string { + return s.String() +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s VersioningConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if len(s.MFADelete) > 0 { + v := s.MFADelete + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "MfaDelete", v, metadata) + } + if len(s.Status) > 0 { + v := s.Status + + metadata := protocol.Metadata{} + e.SetValue(protocol.BodyTarget, "Status", v, metadata) + } + return nil +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/WebsiteConfiguration +type WebsiteConfiguration struct { + _ struct{} `type:"structure"` + + ErrorDocument *ErrorDocument `type:"structure"` + + IndexDocument *IndexDocument `type:"structure"` + + RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` + + RoutingRules []RoutingRule `locationNameList:"RoutingRule" type:"list"` +} + +// String returns the string representation +func (s WebsiteConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s WebsiteConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *WebsiteConfiguration) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "WebsiteConfiguration"} + if s.ErrorDocument != nil { + if err := s.ErrorDocument.Validate(); err != nil { + invalidParams.AddNested("ErrorDocument", err.(aws.ErrInvalidParams)) + } + } + if s.IndexDocument != nil { + if err := s.IndexDocument.Validate(); err != nil { + invalidParams.AddNested("IndexDocument", err.(aws.ErrInvalidParams)) + } + } + if s.RedirectAllRequestsTo != nil { + if err := s.RedirectAllRequestsTo.Validate(); err != nil { + invalidParams.AddNested("RedirectAllRequestsTo", err.(aws.ErrInvalidParams)) + } + } + if s.RoutingRules != nil { + for i, v := range s.RoutingRules { + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RoutingRules", i), err.(aws.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// MarshalFields encodes the AWS API shape using the passed in protocol encoder. +func (s WebsiteConfiguration) MarshalFields(e protocol.FieldEncoder) error { + if s.ErrorDocument != nil { + v := s.ErrorDocument + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "ErrorDocument", v, metadata) + } + if s.IndexDocument != nil { + v := s.IndexDocument + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "IndexDocument", v, metadata) + } + if s.RedirectAllRequestsTo != nil { + v := s.RedirectAllRequestsTo + + metadata := protocol.Metadata{} + e.SetFields(protocol.BodyTarget, "RedirectAllRequestsTo", v, metadata) + } + if len(s.RoutingRules) > 0 { + v := s.RoutingRules + + metadata := protocol.Metadata{ListLocationName: "RoutingRule"} + ls0 := e.List(protocol.BodyTarget, "RoutingRules", metadata) + ls0.Start() + for _, v1 := range v { + ls0.ListAddFields(v1) + } + ls0.End() + + } + return nil +} + +type AnalyticsS3ExportFileFormat string + +// Enum values for AnalyticsS3ExportFileFormat +const ( + AnalyticsS3ExportFileFormatCsv AnalyticsS3ExportFileFormat = "CSV" +) + +func (enum AnalyticsS3ExportFileFormat) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum AnalyticsS3ExportFileFormat) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type BucketAccelerateStatus string + +// Enum values for BucketAccelerateStatus +const ( + BucketAccelerateStatusEnabled BucketAccelerateStatus = "Enabled" + BucketAccelerateStatusSuspended BucketAccelerateStatus = "Suspended" +) + +func (enum BucketAccelerateStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum BucketAccelerateStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type BucketCannedACL string + +// Enum values for BucketCannedACL +const ( + BucketCannedACLPrivate BucketCannedACL = "private" + BucketCannedACLPublicRead BucketCannedACL = "public-read" + BucketCannedACLPublicReadWrite BucketCannedACL = "public-read-write" + BucketCannedACLAuthenticatedRead BucketCannedACL = "authenticated-read" +) + +func (enum BucketCannedACL) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum BucketCannedACL) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type BucketLocationConstraint string + +// Enum values for BucketLocationConstraint +const ( + BucketLocationConstraintEu BucketLocationConstraint = "EU" + BucketLocationConstraintEuWest1 BucketLocationConstraint = "eu-west-1" + BucketLocationConstraintUsWest1 BucketLocationConstraint = "us-west-1" + BucketLocationConstraintUsWest2 BucketLocationConstraint = "us-west-2" + BucketLocationConstraintApSouth1 BucketLocationConstraint = "ap-south-1" + BucketLocationConstraintApSoutheast1 BucketLocationConstraint = "ap-southeast-1" + BucketLocationConstraintApSoutheast2 BucketLocationConstraint = "ap-southeast-2" + BucketLocationConstraintApNortheast1 BucketLocationConstraint = "ap-northeast-1" + BucketLocationConstraintSaEast1 BucketLocationConstraint = "sa-east-1" + BucketLocationConstraintCnNorth1 BucketLocationConstraint = "cn-north-1" + BucketLocationConstraintEuCentral1 BucketLocationConstraint = "eu-central-1" +) + +func (enum BucketLocationConstraint) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum BucketLocationConstraint) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type BucketLogsPermission string + +// Enum values for BucketLogsPermission +const ( + BucketLogsPermissionFullControl BucketLogsPermission = "FULL_CONTROL" + BucketLogsPermissionRead BucketLogsPermission = "READ" + BucketLogsPermissionWrite BucketLogsPermission = "WRITE" +) + +func (enum BucketLogsPermission) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum BucketLogsPermission) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type BucketVersioningStatus string + +// Enum values for BucketVersioningStatus +const ( + BucketVersioningStatusEnabled BucketVersioningStatus = "Enabled" + BucketVersioningStatusSuspended BucketVersioningStatus = "Suspended" +) + +func (enum BucketVersioningStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum BucketVersioningStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type CompressionType string + +// Enum values for CompressionType +const ( + CompressionTypeNone CompressionType = "NONE" + CompressionTypeGzip CompressionType = "GZIP" + CompressionTypeBzip2 CompressionType = "BZIP2" +) + +func (enum CompressionType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum CompressionType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type DeleteMarkerReplicationStatus string + +// Enum values for DeleteMarkerReplicationStatus +const ( + DeleteMarkerReplicationStatusEnabled DeleteMarkerReplicationStatus = "Enabled" + DeleteMarkerReplicationStatusDisabled DeleteMarkerReplicationStatus = "Disabled" +) + +func (enum DeleteMarkerReplicationStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum DeleteMarkerReplicationStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +// Requests Amazon S3 to encode the object keys in the response and specifies +// the encoding method to use. An object key may contain any Unicode character; +// however, XML 1.0 parser cannot parse some characters, such as characters +// with an ASCII value from 0 to 10. For characters that are not supported in +// XML 1.0, you can add this parameter to request that Amazon S3 encode the +// keys in the response. +type EncodingType string + +// Enum values for EncodingType +const ( + EncodingTypeUrl EncodingType = "url" +) + +func (enum EncodingType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum EncodingType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +// Bucket event for which to send notifications. +type Event string + +// Enum values for Event +const ( + EventS3ReducedRedundancyLostObject Event = "s3:ReducedRedundancyLostObject" + EventS3ObjectCreated Event = "s3:ObjectCreated:*" + EventS3ObjectCreatedPut Event = "s3:ObjectCreated:Put" + EventS3ObjectCreatedPost Event = "s3:ObjectCreated:Post" + EventS3ObjectCreatedCopy Event = "s3:ObjectCreated:Copy" + EventS3ObjectCreatedCompleteMultipartUpload Event = "s3:ObjectCreated:CompleteMultipartUpload" + EventS3ObjectRemoved Event = "s3:ObjectRemoved:*" + EventS3ObjectRemovedDelete Event = "s3:ObjectRemoved:Delete" + EventS3ObjectRemovedDeleteMarkerCreated Event = "s3:ObjectRemoved:DeleteMarkerCreated" +) + +func (enum Event) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Event) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ExpirationStatus string + +// Enum values for ExpirationStatus +const ( + ExpirationStatusEnabled ExpirationStatus = "Enabled" + ExpirationStatusDisabled ExpirationStatus = "Disabled" +) + +func (enum ExpirationStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ExpirationStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ExpressionType string + +// Enum values for ExpressionType +const ( + ExpressionTypeSql ExpressionType = "SQL" +) + +func (enum ExpressionType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ExpressionType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type FileHeaderInfo string + +// Enum values for FileHeaderInfo +const ( + FileHeaderInfoUse FileHeaderInfo = "USE" + FileHeaderInfoIgnore FileHeaderInfo = "IGNORE" + FileHeaderInfoNone FileHeaderInfo = "NONE" +) + +func (enum FileHeaderInfo) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum FileHeaderInfo) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type FilterRuleName string + +// Enum values for FilterRuleName +const ( + FilterRuleNamePrefix FilterRuleName = "prefix" + FilterRuleNameSuffix FilterRuleName = "suffix" +) + +func (enum FilterRuleName) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum FilterRuleName) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type InventoryFormat string + +// Enum values for InventoryFormat +const ( + InventoryFormatCsv InventoryFormat = "CSV" + InventoryFormatOrc InventoryFormat = "ORC" +) + +func (enum InventoryFormat) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum InventoryFormat) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type InventoryFrequency string + +// Enum values for InventoryFrequency +const ( + InventoryFrequencyDaily InventoryFrequency = "Daily" + InventoryFrequencyWeekly InventoryFrequency = "Weekly" +) + +func (enum InventoryFrequency) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum InventoryFrequency) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type InventoryIncludedObjectVersions string + +// Enum values for InventoryIncludedObjectVersions +const ( + InventoryIncludedObjectVersionsAll InventoryIncludedObjectVersions = "All" + InventoryIncludedObjectVersionsCurrent InventoryIncludedObjectVersions = "Current" +) + +func (enum InventoryIncludedObjectVersions) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum InventoryIncludedObjectVersions) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type InventoryOptionalField string + +// Enum values for InventoryOptionalField +const ( + InventoryOptionalFieldSize InventoryOptionalField = "Size" + InventoryOptionalFieldLastModifiedDate InventoryOptionalField = "LastModifiedDate" + InventoryOptionalFieldStorageClass InventoryOptionalField = "StorageClass" + InventoryOptionalFieldEtag InventoryOptionalField = "ETag" + InventoryOptionalFieldIsMultipartUploaded InventoryOptionalField = "IsMultipartUploaded" + InventoryOptionalFieldReplicationStatus InventoryOptionalField = "ReplicationStatus" + InventoryOptionalFieldEncryptionStatus InventoryOptionalField = "EncryptionStatus" +) + +func (enum InventoryOptionalField) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum InventoryOptionalField) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type JSONType string + +// Enum values for JSONType +const ( + JSONTypeDocument JSONType = "DOCUMENT" + JSONTypeLines JSONType = "LINES" +) + +func (enum JSONType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum JSONType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type MFADelete string + +// Enum values for MFADelete +const ( + MFADeleteEnabled MFADelete = "Enabled" + MFADeleteDisabled MFADelete = "Disabled" +) + +func (enum MFADelete) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum MFADelete) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type MFADeleteStatus string + +// Enum values for MFADeleteStatus +const ( + MFADeleteStatusEnabled MFADeleteStatus = "Enabled" + MFADeleteStatusDisabled MFADeleteStatus = "Disabled" +) + +func (enum MFADeleteStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum MFADeleteStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type MetadataDirective string + +// Enum values for MetadataDirective +const ( + MetadataDirectiveCopy MetadataDirective = "COPY" + MetadataDirectiveReplace MetadataDirective = "REPLACE" +) + +func (enum MetadataDirective) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum MetadataDirective) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ObjectCannedACL string + +// Enum values for ObjectCannedACL +const ( + ObjectCannedACLPrivate ObjectCannedACL = "private" + ObjectCannedACLPublicRead ObjectCannedACL = "public-read" + ObjectCannedACLPublicReadWrite ObjectCannedACL = "public-read-write" + ObjectCannedACLAuthenticatedRead ObjectCannedACL = "authenticated-read" + ObjectCannedACLAwsExecRead ObjectCannedACL = "aws-exec-read" + ObjectCannedACLBucketOwnerRead ObjectCannedACL = "bucket-owner-read" + ObjectCannedACLBucketOwnerFullControl ObjectCannedACL = "bucket-owner-full-control" +) + +func (enum ObjectCannedACL) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ObjectCannedACL) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ObjectStorageClass string + +// Enum values for ObjectStorageClass +const ( + ObjectStorageClassStandard ObjectStorageClass = "STANDARD" + ObjectStorageClassReducedRedundancy ObjectStorageClass = "REDUCED_REDUNDANCY" + ObjectStorageClassGlacier ObjectStorageClass = "GLACIER" + ObjectStorageClassStandardIa ObjectStorageClass = "STANDARD_IA" + ObjectStorageClassOnezoneIa ObjectStorageClass = "ONEZONE_IA" +) + +func (enum ObjectStorageClass) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ObjectStorageClass) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ObjectVersionStorageClass string + +// Enum values for ObjectVersionStorageClass +const ( + ObjectVersionStorageClassStandard ObjectVersionStorageClass = "STANDARD" +) + +func (enum ObjectVersionStorageClass) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ObjectVersionStorageClass) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type OwnerOverride string + +// Enum values for OwnerOverride +const ( + OwnerOverrideDestination OwnerOverride = "Destination" +) + +func (enum OwnerOverride) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum OwnerOverride) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Payer string + +// Enum values for Payer +const ( + PayerRequester Payer = "Requester" + PayerBucketOwner Payer = "BucketOwner" +) + +func (enum Payer) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Payer) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Permission string + +// Enum values for Permission +const ( + PermissionFullControl Permission = "FULL_CONTROL" + PermissionWrite Permission = "WRITE" + PermissionWriteAcp Permission = "WRITE_ACP" + PermissionRead Permission = "READ" + PermissionReadAcp Permission = "READ_ACP" +) + +func (enum Permission) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Permission) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Protocol string + +// Enum values for Protocol +const ( + ProtocolHttp Protocol = "http" + ProtocolHttps Protocol = "https" +) + +func (enum Protocol) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Protocol) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type QuoteFields string + +// Enum values for QuoteFields +const ( + QuoteFieldsAlways QuoteFields = "ALWAYS" + QuoteFieldsAsneeded QuoteFields = "ASNEEDED" +) + +func (enum QuoteFields) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum QuoteFields) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ReplicationRuleStatus string + +// Enum values for ReplicationRuleStatus +const ( + ReplicationRuleStatusEnabled ReplicationRuleStatus = "Enabled" + ReplicationRuleStatusDisabled ReplicationRuleStatus = "Disabled" +) + +func (enum ReplicationRuleStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ReplicationRuleStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ReplicationStatus string + +// Enum values for ReplicationStatus +const ( + ReplicationStatusComplete ReplicationStatus = "COMPLETE" + ReplicationStatusPending ReplicationStatus = "PENDING" + ReplicationStatusFailed ReplicationStatus = "FAILED" + ReplicationStatusReplica ReplicationStatus = "REPLICA" +) + +func (enum ReplicationStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ReplicationStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +// If present, indicates that the requester was successfully charged for the +// request. +type RequestCharged string + +// Enum values for RequestCharged +const ( + RequestChargedRequester RequestCharged = "requester" +) + +func (enum RequestCharged) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum RequestCharged) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +// Confirms that the requester knows that she or he will be charged for the +// request. Bucket owners need not specify this parameter in their requests. +// Documentation on downloading objects from requester pays buckets can be found +// at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html +type RequestPayer string + +// Enum values for RequestPayer +const ( + RequestPayerRequester RequestPayer = "requester" +) + +func (enum RequestPayer) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum RequestPayer) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type RestoreRequestType string + +// Enum values for RestoreRequestType +const ( + RestoreRequestTypeSelect RestoreRequestType = "SELECT" +) + +func (enum RestoreRequestType) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum RestoreRequestType) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type ServerSideEncryption string + +// Enum values for ServerSideEncryption +const ( + ServerSideEncryptionAes256 ServerSideEncryption = "AES256" + ServerSideEncryptionAwsKms ServerSideEncryption = "aws:kms" +) + +func (enum ServerSideEncryption) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum ServerSideEncryption) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type SseKmsEncryptedObjectsStatus string + +// Enum values for SseKmsEncryptedObjectsStatus +const ( + SseKmsEncryptedObjectsStatusEnabled SseKmsEncryptedObjectsStatus = "Enabled" + SseKmsEncryptedObjectsStatusDisabled SseKmsEncryptedObjectsStatus = "Disabled" +) + +func (enum SseKmsEncryptedObjectsStatus) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum SseKmsEncryptedObjectsStatus) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StorageClass string + +// Enum values for StorageClass +const ( + StorageClassStandard StorageClass = "STANDARD" + StorageClassReducedRedundancy StorageClass = "REDUCED_REDUNDANCY" + StorageClassStandardIa StorageClass = "STANDARD_IA" + StorageClassOnezoneIa StorageClass = "ONEZONE_IA" +) + +func (enum StorageClass) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StorageClass) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type StorageClassAnalysisSchemaVersion string + +// Enum values for StorageClassAnalysisSchemaVersion +const ( + StorageClassAnalysisSchemaVersionV1 StorageClassAnalysisSchemaVersion = "V_1" +) + +func (enum StorageClassAnalysisSchemaVersion) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum StorageClassAnalysisSchemaVersion) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type TaggingDirective string + +// Enum values for TaggingDirective +const ( + TaggingDirectiveCopy TaggingDirective = "COPY" + TaggingDirectiveReplace TaggingDirective = "REPLACE" +) + +func (enum TaggingDirective) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum TaggingDirective) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Tier string + +// Enum values for Tier +const ( + TierStandard Tier = "Standard" + TierBulk Tier = "Bulk" + TierExpedited Tier = "Expedited" +) + +func (enum Tier) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Tier) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type TransitionStorageClass string + +// Enum values for TransitionStorageClass +const ( + TransitionStorageClassGlacier TransitionStorageClass = "GLACIER" + TransitionStorageClassStandardIa TransitionStorageClass = "STANDARD_IA" + TransitionStorageClassOnezoneIa TransitionStorageClass = "ONEZONE_IA" +) + +func (enum TransitionStorageClass) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum TransitionStorageClass) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} + +type Type string + +// Enum values for Type +const ( + TypeCanonicalUser Type = "CanonicalUser" + TypeAmazonCustomerByEmail Type = "AmazonCustomerByEmail" + TypeGroup Type = "Group" +) + +func (enum Type) MarshalValue() (string, error) { + return string(enum), nil +} + +func (enum Type) MarshalValueBuf(b []byte) ([]byte, error) { + b = b[0:0] + return append(b, enum...), nil +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/bucket_location.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/bucket_location.go new file mode 100644 index 000000000000..f8086c07e937 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/bucket_location.go @@ -0,0 +1,103 @@ +package s3 + +import ( + "io/ioutil" + "regexp" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" +) + +var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) + +// NormalizeBucketLocation is a utility function which will update the +// passed in value to always be a region ID. Generally this would be used +// with GetBucketLocation API operation. +// +// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". +// +// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html +// for more information on the values that can be returned. +func NormalizeBucketLocation(loc BucketLocationConstraint) BucketLocationConstraint { + switch loc { + case "": + loc = "us-east-1" + case "EU": + loc = "eu-west-1" + } + + return loc +} + +// NormalizeBucketLocationHandler is a request handler which will update the +// GetBucketLocation's result LocationConstraint value to always be a region ID. +// +// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". +// +// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html +// for more information on the values that can be returned. +// +// req, result := svc.GetBucketLocationRequest(&s3.GetBucketLocationInput{ +// Bucket: aws.String(bucket), +// }) +// req.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) +// err := req.Send() +var NormalizeBucketLocationHandler = aws.NamedHandler{ + Name: "awssdk.s3.NormalizeBucketLocation", + Fn: func(req *aws.Request) { + if req.Error != nil { + return + } + + out := req.Data.(*GetBucketLocationOutput) + loc := NormalizeBucketLocation(out.LocationConstraint) + out.LocationConstraint = loc + }, +} + +// WithNormalizeBucketLocation is a request option which will update the +// GetBucketLocation's result LocationConstraint value to always be a region ID. +// +// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". +// +// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html +// for more information on the values that can be returned. +// +// result, err := svc.GetBucketLocationWithContext(ctx, +// &s3.GetBucketLocationInput{ +// Bucket: aws.String(bucket), +// }, +// s3.WithNormalizeBucketLocation, +// ) +func WithNormalizeBucketLocation(r *aws.Request) { + r.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) +} + +func buildGetBucketLocation(r *aws.Request) { + out := r.Data.(*GetBucketLocationOutput) + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "failed reading response body", err) + return + } + + match := reBucketLocation.FindSubmatch(b) + if len(match) > 1 { + loc := BucketLocationConstraint(match[1]) + out.LocationConstraint = loc + } +} + +func populateLocationConstraint(r *aws.Request) { + if r.ParamsFilled() && r.Config.Region != "us-east-1" { + in := r.Params.(*CreateBucketInput) + if in.CreateBucketConfiguration == nil { + r.Params = awsutil.CopyOf(r.Params) + in = r.Params.(*CreateBucketInput) + in.CreateBucketConfiguration = &CreateBucketConfiguration{ + LocationConstraint: BucketLocationConstraint(r.Config.Region), + } + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/content_md5.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/content_md5.go new file mode 100644 index 000000000000..f03445e59f6a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/content_md5.go @@ -0,0 +1,36 @@ +package s3 + +import ( + "crypto/md5" + "encoding/base64" + "io" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// contentMD5 computes and sets the HTTP Content-MD5 header for requests that +// require it. +func contentMD5(r *request.Request) { + h := md5.New() + + // hash the body. seek back to the first position after reading to reset + // the body for transmission. copy errors may be assumed to be from the + // body. + _, err := io.Copy(h, r.Body) + if err != nil { + r.Error = awserr.New("ContentMD5", "failed to read body", err) + return + } + _, err = r.Body.Seek(0, 0) + if err != nil { + r.Error = awserr.New("ContentMD5", "failed to seek body", err) + return + } + + // encode the md5 checksum in base64 and set the request header. + sum := h.Sum(nil) + sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) + base64.StdEncoding.Encode(sum64, sum) + r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/customizations.go new file mode 100644 index 000000000000..ec2b3255fd2d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/customizations.go @@ -0,0 +1,63 @@ +package s3 + +import ( + "github.com/aws/aws-sdk-go-v2/aws" +) + +func init() { + initClient = defaultInitClientFn + initRequest = defaultInitRequestFn +} + +func defaultInitClientFn(c *S3) { + // Require SSL when using SSE keys + c.Handlers.Validate.PushBack(validateSSERequiresSSL) + c.Handlers.Build.PushBack(computeSSEKeys) + + // S3 uses custom error unmarshaling logic + c.Handlers.UnmarshalError.Clear() + c.Handlers.UnmarshalError.PushBack(unmarshalError) +} + +func defaultInitRequestFn(c *S3, r *aws.Request) { + // Add reuest handlers for specific platforms. + // e.g. 100-continue support for PUT requests using Go 1.6 + platformRequestHandlers(c, r) + + // Support building custom endpoints based on config + r.Handlers.Build.PushFront(buildUpdateEndpointForS3Config(c)) + + switch r.Operation.Name { + case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, + opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, + opPutBucketReplication: + // These S3 operations require Content-MD5 to be set + r.Handlers.Build.PushBack(contentMD5) + case opGetBucketLocation: + // GetBucketLocation has custom parsing logic + r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) + case opCreateBucket: + // Auto-populate LocationConstraint with current region + r.Handlers.Validate.PushFront(populateLocationConstraint) + case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: + r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) + } +} + +// bucketGetter is an accessor interface to grab the "Bucket" field from +// an S3 type. +type bucketGetter interface { + getBucket() string +} + +// sseCustomerKeyGetter is an accessor interface to grab the "SSECustomerKey" +// field from an S3 type. +type sseCustomerKeyGetter interface { + getSSECustomerKey() string +} + +// copySourceSSECustomerKeyGetter is an accessor interface to grab the +// "CopySourceSSECustomerKey" field from an S3 type. +type copySourceSSECustomerKeyGetter interface { + getCopySourceSSECustomerKey() string +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc.go new file mode 100644 index 000000000000..30068d159505 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc.go @@ -0,0 +1,26 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package s3 provides the client and types for making API +// requests to Amazon Simple Storage Service. +// +// See https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01 for more information on this service. +// +// See s3 package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/ +// +// Using the Client +// +// To Amazon Simple Storage Service with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the Amazon Simple Storage Service client S3 for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#New +package s3 diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc_custom.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc_custom.go new file mode 100644 index 000000000000..957ed7fced45 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/doc_custom.go @@ -0,0 +1,109 @@ +// Upload Managers +// +// The s3manager package's Uploader provides concurrent upload of content to S3 +// by taking advantage of S3's Multipart APIs. The Uploader also supports both +// io.Reader for streaming uploads, and will also take advantage of io.ReadSeeker +// for optimizations if the Body satisfies that type. Once the Uploader instance +// is created you can call Upload concurrently from multiple goroutines safely. +// +// // The config the S3 Uploader will use +// cfg, err := external.LoadDefaultAWSConfig() +// +// // Create an uploader with the config and default options +// uploader := s3manager.NewUploader(cfg) +// +// f, err := os.Open(filename) +// if err != nil { +// return fmt.Errorf("failed to open file %q, %v", filename, err) +// } +// +// // Upload the file to S3. +// result, err := uploader.Upload(&s3manager.UploadInput{ +// Bucket: aws.String(myBucket), +// Key: aws.String(myString), +// Body: f, +// }) +// if err != nil { +// return fmt.Errorf("failed to upload file, %v", err) +// } +// fmt.Printf("file uploaded to, %s\n", aws.StringValue(result.Location)) +// +// See the s3manager package's Uploader type documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Uploader +// +// Download Manager +// +// The s3manager package's Downloader provides concurrently downloading of Objects +// from S3. The Downloader will write S3 Object content with an io.WriterAt. +// Once the Downloader instance is created you can call Upload concurrently from +// multiple goroutines safely. +// +// // The config the S3 Downloader will use +// cfg, err := external.LoadDefaultAWSConfig() +// +// // Create a downloader with the config and default options +// downloader := s3manager.NewDownloader(cfg) +// +// // Create a file to write the S3 Object contents to. +// f, err := os.Create(filename) +// if err != nil { +// return fmt.Errorf("failed to create file %q, %v", filename, err) +// } +// +// // Write the contents of S3 Object to the file +// n, err := downloader.Download(f, &s3.GetObjectInput{ +// Bucket: aws.String(myBucket), +// Key: aws.String(myString), +// }) +// if err != nil { +// return fmt.Errorf("failed to upload file, %v", err) +// } +// fmt.Printf("file downloaded, %d bytes\n", n) +// +// See the s3manager package's Downloader type documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader +// +// Get Bucket Region +// +// GetBucketRegion will attempt to get the region for a bucket using a region +// hint to determine which AWS partition to perform the query on. Use this utility +// to determine the region a bucket is in. +// +// cfg, err := external.LoadDefaultAWSConfig() +// +// bucket := "my-bucket" +// region, err := s3manager.GetBucketRegion(ctx, cfg, bucket, "us-west-2") +// if err != nil { +// if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" { +// fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket) +// } +// return err +// } +// fmt.Printf("Bucket %s is in %s region\n", bucket, region) +// +// See the s3manager package's GetBucketRegion function documentation for more information +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion +// +// S3 Crypto Client +// +// The s3crypto package provides the tools to upload and download encrypted +// content from S3. The Encryption and Decryption clients can be used concurrently +// once the client is created. +// +// cfg, err := external.LoadDefaultAWSConfig() +// +// // Create the decryption client. +// svc := s3crypto.NewDecryptionClient(cfg) +// +// // The object will be downloaded from S3 and decrypted locally. By metadata +// // about the object's encryption will instruct the decryption client how +// // decrypt the content of the object. By default KMS is used for keys. +// result, err := svc.GetObject(&s3.GetObjectInput { +// Bucket: aws.String(myBucket), +// Key: aws.String(myKey), +// }) +// +// See the s3crypto package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3crypto/ +// +package s3 diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/errors.go new file mode 100644 index 000000000000..931cb17bb053 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/errors.go @@ -0,0 +1,48 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package s3 + +const ( + + // ErrCodeBucketAlreadyExists for service response error code + // "BucketAlreadyExists". + // + // The requested bucket name is not available. The bucket namespace is shared + // by all users of the system. Please select a different name and try again. + ErrCodeBucketAlreadyExists = "BucketAlreadyExists" + + // ErrCodeBucketAlreadyOwnedByYou for service response error code + // "BucketAlreadyOwnedByYou". + ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou" + + // ErrCodeNoSuchBucket for service response error code + // "NoSuchBucket". + // + // The specified bucket does not exist. + ErrCodeNoSuchBucket = "NoSuchBucket" + + // ErrCodeNoSuchKey for service response error code + // "NoSuchKey". + // + // The specified key does not exist. + ErrCodeNoSuchKey = "NoSuchKey" + + // ErrCodeNoSuchUpload for service response error code + // "NoSuchUpload". + // + // The specified multipart upload does not exist. + ErrCodeNoSuchUpload = "NoSuchUpload" + + // ErrCodeObjectAlreadyInActiveTierError for service response error code + // "ObjectAlreadyInActiveTierError". + // + // This operation is not allowed against this storage tier + ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError" + + // ErrCodeObjectNotInActiveTierError for service response error code + // "ObjectNotInActiveTierError". + // + // The source object of the COPY operation is not in the active tier and is + // only stored in Amazon Glacier. + ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError" +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/host_style_bucket.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/host_style_bucket.go new file mode 100644 index 000000000000..25a3d788908b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/host_style_bucket.go @@ -0,0 +1,156 @@ +package s3 + +import ( + "fmt" + "net/url" + "regexp" + "strings" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +// an operationBlacklist is a list of operation names that should a +// request handler should not be executed with. +type operationBlacklist []string + +// Continue will return true of the Request's operation name is not +// in the blacklist. False otherwise. +func (b operationBlacklist) Continue(r *aws.Request) bool { + for i := 0; i < len(b); i++ { + if b[i] == r.Operation.Name { + return false + } + } + return true +} + +var accelerateOpBlacklist = operationBlacklist{ + opListBuckets, opCreateBucket, opDeleteBucket, +} + +// Request handler to automatically add the bucket name to the endpoint domain +// if possible. This style of bucket is valid for all bucket names which are +// DNS compatible and do not contain "." +func buildUpdateEndpointForS3Config(c *S3) func(*aws.Request) { + forceHostStyle := c.ForcePathStyle + accelerate := c.UseAccelerate + + return func(r *aws.Request) { + if accelerate && accelerateOpBlacklist.Continue(r) { + if forceHostStyle { + if r.Config.Logger != nil { + r.Config.Logger.Log("ERROR: s3.S3.UseAccelerate is not compatible with s3.S3.ForcePathStyle, ignoring ForcePathStyle.") + } + } + updateEndpointForAccelerate(r) + } else if !forceHostStyle && r.Operation.Name != opGetBucketLocation { + updateEndpointForHostStyle(r) + } + } +} + +func updateEndpointForHostStyle(r *aws.Request) { + bucket, ok := bucketNameFromReqParams(r.Params) + if !ok { + // Ignore operation requests if the bucketname was not provided + // if this is an input validation error the validation handler + // will report it. + return + } + + if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { + // bucket name must be valid to put into the host + return + } + + moveBucketToHost(r.HTTPRequest.URL, bucket) +} + +var ( + accelElem = []byte("s3-accelerate.dualstack.") +) + +func updateEndpointForAccelerate(r *aws.Request) { + bucket, ok := bucketNameFromReqParams(r.Params) + if !ok { + // Ignore operation requests if the bucketname was not provided + // if this is an input validation error the validation handler + // will report it. + return + } + + if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { + r.Error = awserr.New("InvalidParameterException", + fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucket), + nil) + return + } + + parts := strings.Split(r.HTTPRequest.URL.Host, ".") + if len(parts) < 3 { + r.Error = awserr.New("InvalidParameterExecption", + fmt.Sprintf("unable to update endpoint host for S3 accelerate, hostname invalid, %s", + r.HTTPRequest.URL.Host), nil) + return + } + + if parts[0] == "s3" || strings.HasPrefix(parts[0], "s3-") { + parts[0] = "s3-accelerate" + } + for i := 1; i+1 < len(parts); i++ { + if parts[i] == r.Config.Region { + parts = append(parts[:i], parts[i+1:]...) + break + } + } + + r.HTTPRequest.URL.Host = strings.Join(parts, ".") + + moveBucketToHost(r.HTTPRequest.URL, bucket) +} + +// Attempts to retrieve the bucket name from the request input parameters. +// If no bucket is found, or the field is empty "", false will be returned. +func bucketNameFromReqParams(params interface{}) (string, bool) { + if iface, ok := params.(bucketGetter); ok { + b := iface.getBucket() + return b, len(b) > 0 + } + + return "", false +} + +// hostCompatibleBucketName returns true if the request should +// put the bucket in the host. This is false if ForcePathStyle is +// explicitly set or if the bucket is not DNS compatible. +func hostCompatibleBucketName(u *url.URL, bucket string) bool { + // Bucket might be DNS compatible but dots in the hostname will fail + // certificate validation, so do not use host-style. + if u.Scheme == "https" && strings.Contains(bucket, ".") { + return false + } + + // if the bucket is DNS compatible + return dnsCompatibleBucketName(bucket) +} + +var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`) +var reIPAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`) + +// dnsCompatibleBucketName returns true if the bucket name is DNS compatible. +// Buckets created outside of the classic region MUST be DNS compatible. +func dnsCompatibleBucketName(bucket string) bool { + return reDomain.MatchString(bucket) && + !reIPAddress.MatchString(bucket) && + !strings.Contains(bucket, "..") +} + +// moveBucketToHost moves the bucket name from the URI path to URL host. +func moveBucketToHost(u *url.URL, bucket string) { + u.Host = bucket + "." + u.Host + u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1) + if u.Path == "" { + u.Path = "/" + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers.go new file mode 100644 index 000000000000..635882fe8ba1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers.go @@ -0,0 +1,8 @@ +// +build !go1.6 + +package s3 + +import request "github.com/aws/aws-sdk-go-v2/aws" + +func platformRequestHandlers(r *request.Request) { +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers_go1.6.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers_go1.6.go new file mode 100644 index 000000000000..951816ad54c1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/platform_handlers_go1.6.go @@ -0,0 +1,24 @@ +// +build go1.6 + +package s3 + +import ( + request "github.com/aws/aws-sdk-go-v2/aws" +) + +func platformRequestHandlers(c *S3, r *request.Request) { + if r.Operation.HTTPMethod == "PUT" && !c.Disable100Continue { + // 100-Continue should only be used on put requests. + r.Handlers.Sign.PushBack(add100Continue) + } +} + +func add100Continue(r *request.Request) { + if r.HTTPRequest.ContentLength < 1024*1024*2 { + // Ignore requests smaller than 2MB. This helps prevent delaying + // requests unnecessarily. + return + } + + r.HTTPRequest.Header.Set("Expect", "100-Continue") +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/service.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/service.go new file mode 100644 index 000000000000..73f034d2d08f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/service.go @@ -0,0 +1,121 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package s3 + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/private/protocol/restxml" +) + +// S3 provides the API operation methods for making requests to +// Amazon Simple Storage Service. See this package's package overview docs +// for details on the service. +// +// S3 methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type S3 struct { + *aws.Client + + // Service specific configurations. (codegen: service_specific_config.go) + + // Disables the S3 client from using the Expect: 100-Continue header to wait for + // the service to respond with a 100 status code before sending the HTTP request + // body. + // + // You should disable 100-Continue if you experience issues with proxies or third + // party S3 compatible services. + // + // See http.Transport's ExpectContinueTimeout for information on adjusting the + // continue wait timeout. https://golang.org/pkg/net/http/#Transport + Disable100Continue bool + + // Forces the client to use path-style addressing for S3 API operations. By + // default the S3 client will use virtual hosted bucket addressing when possible. + // The S3 client will automatically fall back to path-style when the bucket name + // is not DNS compatible. + // + // With ForcePathStyle + // + // https://s3.us-west-2.amazonaws.com/BUCKET/KEY + // + // Without ForcePathStyle + // + // https://BUCKET.s3.us-west-2.amazonaws.com/KEY + // + // See http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html + ForcePathStyle bool + + // Enables S3 Accelerate feature for API operation that support S3 Accelerate. + // For all operations compatible with S3 Accelerate will use the accelerate + // endpoint for requests. Requests not compatible will fall back to normal S3 + // requests. + // + // The bucket must be enable for accelerate to be used with S3 client with + // accelerate enabled. If the bucket is not enabled for accelerate an error will + // be returned. The bucket name must be DNS compatible to also work with + // accelerate. + // + UseAccelerate bool +} + +// Used for custom client initialization logic +var initClient func(*S3) + +// Used for custom request initialization logic +var initRequest func(*S3, *aws.Request) + +// Service information constants +const ( + ServiceName = "s3" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the S3 client with a config. +// +// Example: +// // Create a S3 client from just a config. +// svc := s3.New(myConfig) +func New(config aws.Config) *S3 { + var signingName string + signingRegion := config.Region + + svc := &S3{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + APIVersion: "2006-03-01", + }, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc) + } + + return svc +} + +// newRequest creates a new request for a S3 operation and runs any +// custom request initialization. +func (c *S3) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(c, req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/sse.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/sse.go new file mode 100644 index 000000000000..5ce2a5b4fd26 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/sse.go @@ -0,0 +1,54 @@ +package s3 + +import ( + "crypto/md5" + "encoding/base64" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) + +func validateSSERequiresSSL(r *request.Request) { + if r.HTTPRequest.URL.Scheme == "https" { + return + } + + if iface, ok := r.Params.(sseCustomerKeyGetter); ok { + if len(iface.getSSECustomerKey()) > 0 { + r.Error = errSSERequiresSSL + return + } + } + + if iface, ok := r.Params.(copySourceSSECustomerKeyGetter); ok { + if len(iface.getCopySourceSSECustomerKey()) > 0 { + r.Error = errSSERequiresSSL + return + } + } +} + +func computeSSEKeys(r *request.Request) { + headers := []string{ + "x-amz-server-side-encryption-customer-key", + "x-amz-copy-source-server-side-encryption-customer-key", + } + + for _, h := range headers { + md5h := h + "-md5" + if key := r.HTTPRequest.Header.Get(h); key != "" { + // Base64-encode the value + b64v := base64.StdEncoding.EncodeToString([]byte(key)) + r.HTTPRequest.Header.Set(h, b64v) + + // Add MD5 if it wasn't computed + if r.HTTPRequest.Header.Get(md5h) == "" { + sum := md5.Sum([]byte(key)) + b64sum := base64.StdEncoding.EncodeToString(sum[:]) + r.HTTPRequest.Header.Set(md5h, b64sum) + } + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/statusok_error.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/statusok_error.go new file mode 100644 index 000000000000..050b631a6083 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/statusok_error.go @@ -0,0 +1,35 @@ +package s3 + +import ( + "bytes" + "io/ioutil" + "net/http" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +func copyMultipartStatusOKUnmarhsalError(r *request.Request) { + b, err := ioutil.ReadAll(r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.New("SerializationError", "unable to read response body", err) + return + } + body := bytes.NewReader(b) + r.HTTPResponse.Body = ioutil.NopCloser(body) + defer body.Seek(0, 0) + + if body.Len() == 0 { + // If there is no body don't attempt to parse the body. + return + } + + unmarshalError(r) + if err, ok := r.Error.(awserr.Error); ok && err != nil { + if err.Code() == "SerializationError" { + r.Error = nil + return + } + r.HTTPResponse.StatusCode = http.StatusServiceUnavailable + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/unmarshal_error.go new file mode 100644 index 000000000000..4226e1c3628c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/unmarshal_error.go @@ -0,0 +1,102 @@ +package s3 + +import ( + "encoding/xml" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" + + request "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" +) + +type xmlErrorResponse struct { + XMLName xml.Name `xml:"Error"` + Code string `xml:"Code"` + Message string `xml:"Message"` +} + +func unmarshalError(r *request.Request) { + defer r.HTTPResponse.Body.Close() + defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) + + hostID := r.HTTPResponse.Header.Get("X-Amz-Id-2") + + // Bucket exists in a different region, and request needs + // to be made to the correct region. + if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { + r.Error = requestFailure{ + RequestFailure: awserr.NewRequestFailure( + awserr.New("BucketRegionError", + fmt.Sprintf("incorrect region, the bucket is not in '%s' region", + r.Config.Region), + nil), + r.HTTPResponse.StatusCode, + r.RequestID, + ), + hostID: hostID, + } + return + } + + var errCode, errMsg string + + // Attempt to parse error from body if it is known + resp := &xmlErrorResponse{} + err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) + if err != nil && err != io.EOF { + errCode = "SerializationError" + errMsg = "failed to decode S3 XML error response" + } else { + errCode = resp.Code + errMsg = resp.Message + err = nil + } + + // Fallback to status code converted to message if still no error code + if len(errCode) == 0 { + statusText := http.StatusText(r.HTTPResponse.StatusCode) + errCode = strings.Replace(statusText, " ", "", -1) + errMsg = statusText + } + + r.Error = requestFailure{ + RequestFailure: awserr.NewRequestFailure( + awserr.New(errCode, errMsg, err), + r.HTTPResponse.StatusCode, + r.RequestID, + ), + hostID: hostID, + } +} + +// A RequestFailure provides access to the S3 Request ID and Host ID values +// returned from API operation errors. Getting the error as a string will +// return the formated error with the same information as awserr.RequestFailure, +// while also adding the HostID value from the response. +type RequestFailure interface { + awserr.RequestFailure + + // Host ID is the S3 Host ID needed for debug, and contacting support + HostID() string +} + +type requestFailure struct { + awserr.RequestFailure + + hostID string +} + +func (r requestFailure) Error() string { + extra := fmt.Sprintf("status code: %d, request id: %s, host id: %s", + r.StatusCode(), r.RequestID(), r.hostID) + return awserr.SprintError(r.Code(), r.Message(), extra, r.OrigErr()) +} +func (r requestFailure) String() string { + return r.Error() +} +func (r requestFailure) HostID() string { + return r.hostID +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/s3/waiters.go b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/waiters.go new file mode 100644 index 000000000000..4c5b933a1958 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/s3/waiters.go @@ -0,0 +1,213 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package s3 + +import ( + "time" + + "github.com/aws/aws-sdk-go-v2/aws" +) + +// WaitUntilBucketExists uses the Amazon S3 API operation +// HeadBucket to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *S3) WaitUntilBucketExists(input *HeadBucketInput) error { + return c.WaitUntilBucketExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilBucketExistsWithContext is an extended version of WaitUntilBucketExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *S3) WaitUntilBucketExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilBucketExists", + MaxAttempts: 20, + Delay: aws.ConstantWaiterDelay(5 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 200, + }, + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 301, + }, + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 403, + }, + { + State: aws.RetryWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 404, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *HeadBucketInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.HeadBucketRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilBucketNotExists uses the Amazon S3 API operation +// HeadBucket to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error { + return c.WaitUntilBucketNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilBucketNotExistsWithContext is an extended version of WaitUntilBucketNotExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *S3) WaitUntilBucketNotExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilBucketNotExists", + MaxAttempts: 20, + Delay: aws.ConstantWaiterDelay(5 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 404, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *HeadBucketInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.HeadBucketRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilObjectExists uses the Amazon S3 API operation +// HeadObject to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *S3) WaitUntilObjectExists(input *HeadObjectInput) error { + return c.WaitUntilObjectExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilObjectExistsWithContext is an extended version of WaitUntilObjectExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *S3) WaitUntilObjectExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilObjectExists", + MaxAttempts: 20, + Delay: aws.ConstantWaiterDelay(5 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 200, + }, + { + State: aws.RetryWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 404, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *HeadObjectInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.HeadObjectRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} + +// WaitUntilObjectNotExists uses the Amazon S3 API operation +// HeadObject to wait for a condition to be met before returning. +// If the condition is not met within the max attempt window, an error will +// be returned. +func (c *S3) WaitUntilObjectNotExists(input *HeadObjectInput) error { + return c.WaitUntilObjectNotExistsWithContext(aws.BackgroundContext(), input) +} + +// WaitUntilObjectNotExistsWithContext is an extended version of WaitUntilObjectNotExists. +// With the support for passing in a context and options to configure the +// Waiter and the underlying request options. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *S3) WaitUntilObjectNotExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...aws.WaiterOption) error { + w := aws.Waiter{ + Name: "WaitUntilObjectNotExists", + MaxAttempts: 20, + Delay: aws.ConstantWaiterDelay(5 * time.Second), + Acceptors: []aws.WaiterAcceptor{ + { + State: aws.SuccessWaiterState, + Matcher: aws.StatusWaiterMatch, + Expected: 404, + }, + }, + Logger: c.Config.Logger, + NewRequest: func(opts []aws.Option) (*aws.Request, error) { + var inCpy *HeadObjectInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req := c.HeadObjectRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req.Request, nil + }, + } + w.ApplyOptions(opts...) + + return w.WaitWithContext(ctx) +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api.go new file mode 100644 index 000000000000..fad7e8b60097 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api.go @@ -0,0 +1,1832 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package sts + +import ( + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/awsutil" +) + +const opAssumeRole = "AssumeRole" + +// AssumeRoleRequest is a API request type for the AssumeRole API operation. +type AssumeRoleRequest struct { + *aws.Request + Input *AssumeRoleInput + Copy func(*AssumeRoleInput) AssumeRoleRequest +} + +// Send marshals and sends the AssumeRole API request. +func (r AssumeRoleRequest) Send() (*AssumeRoleOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AssumeRoleOutput), nil +} + +// AssumeRoleRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns a set of temporary security credentials (consisting of an access +// key ID, a secret access key, and a security token) that you can use to access +// AWS resources that you might not normally have access to. Typically, you +// use AssumeRole for cross-account access or federation. For a comparison of +// AssumeRole with the other APIs that produce temporary credentials, see Requesting +// Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. +// +// Important: You cannot call AssumeRole by using AWS root account credentials; +// access is denied. You must use credentials for an IAM user or an IAM role +// to call AssumeRole. +// +// For cross-account access, imagine that you own multiple accounts and need +// to access resources in each account. You could create long-term credentials +// in each account to access those resources. However, managing all those credentials +// and remembering which one can access which account can be time consuming. +// Instead, you can create one set of long-term credentials in one account and +// then use temporary security credentials to access all the other accounts +// by assuming roles in those accounts. For more information about roles, see +// IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) +// in the IAM User Guide. +// +// For federation, you can, for example, grant single sign-on access to the +// AWS Management Console. If you already have an identity and authentication +// system in your corporate network, you don't have to recreate user identities +// in AWS in order to grant those user identities access to AWS. Instead, after +// a user has been authenticated, you call AssumeRole (and specify the role +// with the appropriate permissions) to get temporary security credentials for +// that user. With those temporary security credentials, you construct a sign-in +// URL that users can use to access the console. For more information, see Common +// Scenarios for Temporary Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html#sts-introduction) +// in the IAM User Guide. +// +// By default, the temporary security credentials created by AssumeRole last +// for one hour. However, you can use the optional DurationSeconds parameter +// to specify the duration of your session. You can provide a value from 900 +// seconds (15 minutes) up to the maximum session duration setting for the role. +// This setting can have a value from 1 hour to 12 hours. To learn how to view +// the maximum value for your role, see View the Maximum Session Duration Setting +// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// in the IAM User Guide. The maximum session duration limit applies when you +// use the AssumeRole* API operations or the assume-role* CLI operations but +// does not apply when you use those operations to create a console URL. For +// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// in the IAM User Guide. +// +// The temporary security credentials created by AssumeRole can be used to make +// API calls to any AWS service with the following exception: you cannot call +// the STS service's GetFederationToken or GetSessionToken APIs. +// +// Optionally, you can pass an IAM access policy to this operation. If you choose +// not to pass a policy, the temporary security credentials that are returned +// by the operation have the permissions that are defined in the access policy +// of the role that is being assumed. If you pass a policy to this operation, +// the temporary security credentials that are returned by the operation have +// the permissions that are allowed by both the access policy of the role that +// is being assumed, and the policy that you pass. This gives you a way to further +// restrict the permissions for the resulting temporary security credentials. +// You cannot use the passed policy to grant permissions that are in excess +// of those allowed by the access policy of the role that is being assumed. +// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, +// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// in the IAM User Guide. +// +// To assume a role, your AWS account must be trusted by the role. The trust +// relationship is defined in the role's trust policy when the role is created. +// That trust policy states which accounts are allowed to delegate access to +// this account's role. +// +// The user who wants to access the role must also have permissions delegated +// from the role's administrator. If the user is in a different account than +// the role, then the user's administrator must attach a policy that allows +// the user to call AssumeRole on the ARN of the role in the other account. +// If the user is in the same account as the role, then you can either attach +// a policy to the user (identical to the previous different account user), +// or you can add the user as a principal directly in the role's trust policy. +// In this case, the trust policy acts as the only resource-based policy in +// IAM, and users in the same account as the role do not need explicit permission +// to assume the role. For more information about trust policies and resource-based +// policies, see IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) +// in the IAM User Guide. +// +// Using MFA with AssumeRole +// +// You can optionally include multi-factor authentication (MFA) information +// when you call AssumeRole. This is useful for cross-account scenarios in which +// you want to make sure that the user who is assuming the role has been authenticated +// using an AWS MFA device. In that scenario, the trust policy of the role being +// assumed includes a condition that tests for MFA authentication; if the caller +// does not include valid MFA information, the request to assume the role is +// denied. The condition in a trust policy that tests for MFA authentication +// might look like the following example. +// +// "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}} +// +// For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html) +// in the IAM User Guide guide. +// +// To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode +// parameters. The SerialNumber value identifies the user's hardware or virtual +// MFA device. The TokenCode is the time-based one-time password (TOTP) that +// the MFA devices produces. +// +// // Example sending a request using the AssumeRoleRequest method. +// req := client.AssumeRoleRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole +func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) AssumeRoleRequest { + op := &aws.Operation{ + Name: opAssumeRole, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AssumeRoleInput{} + } + + output := &AssumeRoleOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return AssumeRoleRequest{Request: req, Input: input, Copy: c.AssumeRoleRequest} +} + +const opAssumeRoleWithSAML = "AssumeRoleWithSAML" + +// AssumeRoleWithSAMLRequest is a API request type for the AssumeRoleWithSAML API operation. +type AssumeRoleWithSAMLRequest struct { + *aws.Request + Input *AssumeRoleWithSAMLInput + Copy func(*AssumeRoleWithSAMLInput) AssumeRoleWithSAMLRequest +} + +// Send marshals and sends the AssumeRoleWithSAML API request. +func (r AssumeRoleWithSAMLRequest) Send() (*AssumeRoleWithSAMLOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AssumeRoleWithSAMLOutput), nil +} + +// AssumeRoleWithSAMLRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns a set of temporary security credentials for users who have been authenticated +// via a SAML authentication response. This operation provides a mechanism for +// tying an enterprise identity store or directory to role-based AWS access +// without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML +// with the other APIs that produce temporary credentials, see Requesting Temporary +// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. +// +// The temporary security credentials returned by this operation consist of +// an access key ID, a secret access key, and a security token. Applications +// can use these temporary security credentials to sign calls to AWS services. +// +// By default, the temporary security credentials created by AssumeRoleWithSAML +// last for one hour. However, you can use the optional DurationSeconds parameter +// to specify the duration of your session. Your role session lasts for the +// duration that you specify, or until the time specified in the SAML authentication +// response's SessionNotOnOrAfter value, whichever is shorter. You can provide +// a DurationSeconds value from 900 seconds (15 minutes) up to the maximum session +// duration setting for the role. This setting can have a value from 1 hour +// to 12 hours. To learn how to view the maximum value for your role, see View +// the Maximum Session Duration Setting for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// in the IAM User Guide. The maximum session duration limit applies when you +// use the AssumeRole* API operations or the assume-role* CLI operations but +// does not apply when you use those operations to create a console URL. For +// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// in the IAM User Guide. +// +// The temporary security credentials created by AssumeRoleWithSAML can be used +// to make API calls to any AWS service with the following exception: you cannot +// call the STS service's GetFederationToken or GetSessionToken APIs. +// +// Optionally, you can pass an IAM access policy to this operation. If you choose +// not to pass a policy, the temporary security credentials that are returned +// by the operation have the permissions that are defined in the access policy +// of the role that is being assumed. If you pass a policy to this operation, +// the temporary security credentials that are returned by the operation have +// the permissions that are allowed by the intersection of both the access policy +// of the role that is being assumed, and the policy that you pass. This means +// that both policies must grant the permission for the action to be allowed. +// This gives you a way to further restrict the permissions for the resulting +// temporary security credentials. You cannot use the passed policy to grant +// permissions that are in excess of those allowed by the access policy of the +// role that is being assumed. For more information, see Permissions for AssumeRole, +// AssumeRoleWithSAML, and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// in the IAM User Guide. +// +// Before your application can call AssumeRoleWithSAML, you must configure your +// SAML identity provider (IdP) to issue the claims required by AWS. Additionally, +// you must use AWS Identity and Access Management (IAM) to create a SAML provider +// entity in your AWS account that represents your identity provider, and create +// an IAM role that specifies this SAML provider in its trust policy. +// +// Calling AssumeRoleWithSAML does not require the use of AWS security credentials. +// The identity of the caller is validated by using keys in the metadata document +// that is uploaded for the SAML provider entity for your identity provider. +// +// Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail +// logs. The entry includes the value in the NameID element of the SAML assertion. +// We recommend that you use a NameIDType that is not associated with any personally +// identifiable information (PII). For example, you could instead use the Persistent +// Identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent). +// +// For more information, see the following resources: +// +// * About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) +// in the IAM User Guide. +// +// * Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html) +// in the IAM User Guide. +// +// * Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html) +// in the IAM User Guide. +// +// * Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html) +// in the IAM User Guide. +// +// // Example sending a request using the AssumeRoleWithSAMLRequest method. +// req := client.AssumeRoleWithSAMLRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML +func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) AssumeRoleWithSAMLRequest { + op := &aws.Operation{ + Name: opAssumeRoleWithSAML, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AssumeRoleWithSAMLInput{} + } + + output := &AssumeRoleWithSAMLOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return AssumeRoleWithSAMLRequest{Request: req, Input: input, Copy: c.AssumeRoleWithSAMLRequest} +} + +const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity" + +// AssumeRoleWithWebIdentityRequest is a API request type for the AssumeRoleWithWebIdentity API operation. +type AssumeRoleWithWebIdentityRequest struct { + *aws.Request + Input *AssumeRoleWithWebIdentityInput + Copy func(*AssumeRoleWithWebIdentityInput) AssumeRoleWithWebIdentityRequest +} + +// Send marshals and sends the AssumeRoleWithWebIdentity API request. +func (r AssumeRoleWithWebIdentityRequest) Send() (*AssumeRoleWithWebIdentityOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*AssumeRoleWithWebIdentityOutput), nil +} + +// AssumeRoleWithWebIdentityRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns a set of temporary security credentials for users who have been authenticated +// in a mobile or web application with a web identity provider, such as Amazon +// Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible +// identity provider. +// +// For mobile applications, we recommend that you use Amazon Cognito. You can +// use Amazon Cognito with the AWS SDK for iOS (http://aws.amazon.com/sdkforios/) +// and the AWS SDK for Android (http://aws.amazon.com/sdkforandroid/) to uniquely +// identify a user and supply the user with a consistent identity throughout +// the lifetime of an application. +// +// To learn more about Amazon Cognito, see Amazon Cognito Overview (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) +// in the AWS SDK for Android Developer Guide guide and Amazon Cognito Overview +// (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664) +// in the AWS SDK for iOS Developer Guide. +// +// Calling AssumeRoleWithWebIdentity does not require the use of AWS security +// credentials. Therefore, you can distribute an application (for example, on +// mobile devices) that requests temporary security credentials without including +// long-term AWS credentials in the application, and without deploying server-based +// proxy services that use long-term AWS credentials. Instead, the identity +// of the caller is validated by using a token from the web identity provider. +// For a comparison of AssumeRoleWithWebIdentity with the other APIs that produce +// temporary credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. +// +// The temporary security credentials returned by this API consist of an access +// key ID, a secret access key, and a security token. Applications can use these +// temporary security credentials to sign calls to AWS service APIs. +// +// By default, the temporary security credentials created by AssumeRoleWithWebIdentity +// last for one hour. However, you can use the optional DurationSeconds parameter +// to specify the duration of your session. You can provide a value from 900 +// seconds (15 minutes) up to the maximum session duration setting for the role. +// This setting can have a value from 1 hour to 12 hours. To learn how to view +// the maximum value for your role, see View the Maximum Session Duration Setting +// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// in the IAM User Guide. The maximum session duration limit applies when you +// use the AssumeRole* API operations or the assume-role* CLI operations but +// does not apply when you use those operations to create a console URL. For +// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// in the IAM User Guide. +// +// The temporary security credentials created by AssumeRoleWithWebIdentity can +// be used to make API calls to any AWS service with the following exception: +// you cannot call the STS service's GetFederationToken or GetSessionToken APIs. +// +// Optionally, you can pass an IAM access policy to this operation. If you choose +// not to pass a policy, the temporary security credentials that are returned +// by the operation have the permissions that are defined in the access policy +// of the role that is being assumed. If you pass a policy to this operation, +// the temporary security credentials that are returned by the operation have +// the permissions that are allowed by both the access policy of the role that +// is being assumed, and the policy that you pass. This gives you a way to further +// restrict the permissions for the resulting temporary security credentials. +// You cannot use the passed policy to grant permissions that are in excess +// of those allowed by the access policy of the role that is being assumed. +// For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, +// and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) +// in the IAM User Guide. +// +// Before your application can call AssumeRoleWithWebIdentity, you must have +// an identity token from a supported identity provider and create a role that +// the application can assume. The role that your application assumes must trust +// the identity provider that is associated with the identity token. In other +// words, the identity provider must be specified in the role's trust policy. +// +// Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail +// logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims) +// of the provided Web Identity Token. We recommend that you avoid using any +// personally identifiable information (PII) in this field. For example, you +// could instead use a GUID or a pairwise identifier, as suggested in the OIDC +// specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes). +// +// For more information about how to use web identity federation and the AssumeRoleWithWebIdentity +// API, see the following resources: +// +// * Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) +// and Federation Through a Web-based Identity Provider (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). +// +// +// * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html). +// This interactive website lets you walk through the process of authenticating +// via Login with Amazon, Facebook, or Google, getting temporary security +// credentials, and then using those credentials to make a request to AWS. +// +// +// * AWS SDK for iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android +// (http://aws.amazon.com/sdkforandroid/). These toolkits contain sample +// apps that show how to invoke the identity providers, and then how to use +// the information from these providers to get and use temporary security +// credentials. +// +// * Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications). +// This article discusses web identity federation and shows an example of +// how to use web identity federation to get access to content in Amazon +// S3. +// +// // Example sending a request using the AssumeRoleWithWebIdentityRequest method. +// req := client.AssumeRoleWithWebIdentityRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity +func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) AssumeRoleWithWebIdentityRequest { + op := &aws.Operation{ + Name: opAssumeRoleWithWebIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &AssumeRoleWithWebIdentityInput{} + } + + output := &AssumeRoleWithWebIdentityOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return AssumeRoleWithWebIdentityRequest{Request: req, Input: input, Copy: c.AssumeRoleWithWebIdentityRequest} +} + +const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage" + +// DecodeAuthorizationMessageRequest is a API request type for the DecodeAuthorizationMessage API operation. +type DecodeAuthorizationMessageRequest struct { + *aws.Request + Input *DecodeAuthorizationMessageInput + Copy func(*DecodeAuthorizationMessageInput) DecodeAuthorizationMessageRequest +} + +// Send marshals and sends the DecodeAuthorizationMessage API request. +func (r DecodeAuthorizationMessageRequest) Send() (*DecodeAuthorizationMessageOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*DecodeAuthorizationMessageOutput), nil +} + +// DecodeAuthorizationMessageRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Decodes additional information about the authorization status of a request +// from an encoded message returned in response to an AWS request. +// +// For example, if a user is not authorized to perform an action that he or +// she has requested, the request returns a Client.UnauthorizedOperation response +// (an HTTP 403 response). Some AWS actions additionally return an encoded message +// that can provide details about this authorization failure. +// +// Only certain AWS actions return an encoded authorization message. The documentation +// for an individual action indicates whether that action returns an encoded +// message in addition to returning an HTTP code. +// +// The message is encoded because the details of the authorization status can +// constitute privileged information that the user who requested the action +// should not see. To decode an authorization status message, a user must be +// granted permissions via an IAM policy to request the DecodeAuthorizationMessage +// (sts:DecodeAuthorizationMessage) action. +// +// The decoded message includes the following type of information: +// +// * Whether the request was denied due to an explicit deny or due to the +// absence of an explicit allow. For more information, see Determining Whether +// a Request is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow) +// in the IAM User Guide. +// +// * The principal who made the request. +// +// * The requested action. +// +// * The requested resource. +// +// * The values of condition keys in the context of the user's request. +// +// // Example sending a request using the DecodeAuthorizationMessageRequest method. +// req := client.DecodeAuthorizationMessageRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage +func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) DecodeAuthorizationMessageRequest { + op := &aws.Operation{ + Name: opDecodeAuthorizationMessage, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DecodeAuthorizationMessageInput{} + } + + output := &DecodeAuthorizationMessageOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return DecodeAuthorizationMessageRequest{Request: req, Input: input, Copy: c.DecodeAuthorizationMessageRequest} +} + +const opGetCallerIdentity = "GetCallerIdentity" + +// GetCallerIdentityRequest is a API request type for the GetCallerIdentity API operation. +type GetCallerIdentityRequest struct { + *aws.Request + Input *GetCallerIdentityInput + Copy func(*GetCallerIdentityInput) GetCallerIdentityRequest +} + +// Send marshals and sends the GetCallerIdentity API request. +func (r GetCallerIdentityRequest) Send() (*GetCallerIdentityOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetCallerIdentityOutput), nil +} + +// GetCallerIdentityRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns details about the IAM identity whose credentials are used to call +// the API. +// +// // Example sending a request using the GetCallerIdentityRequest method. +// req := client.GetCallerIdentityRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity +func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) GetCallerIdentityRequest { + op := &aws.Operation{ + Name: opGetCallerIdentity, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCallerIdentityInput{} + } + + output := &GetCallerIdentityOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetCallerIdentityRequest{Request: req, Input: input, Copy: c.GetCallerIdentityRequest} +} + +const opGetFederationToken = "GetFederationToken" + +// GetFederationTokenRequest is a API request type for the GetFederationToken API operation. +type GetFederationTokenRequest struct { + *aws.Request + Input *GetFederationTokenInput + Copy func(*GetFederationTokenInput) GetFederationTokenRequest +} + +// Send marshals and sends the GetFederationToken API request. +func (r GetFederationTokenRequest) Send() (*GetFederationTokenOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetFederationTokenOutput), nil +} + +// GetFederationTokenRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns a set of temporary security credentials (consisting of an access +// key ID, a secret access key, and a security token) for a federated user. +// A typical use is in a proxy application that gets temporary security credentials +// on behalf of distributed applications inside a corporate network. Because +// you must call the GetFederationToken action using the long-term security +// credentials of an IAM user, this call is appropriate in contexts where those +// credentials can be safely stored, usually in a server-based application. +// For a comparison of GetFederationToken with the other APIs that produce temporary +// credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. +// +// If you are creating a mobile-based or browser-based app that can authenticate +// users using a web identity provider like Login with Amazon, Facebook, Google, +// or an OpenID Connect-compatible identity provider, we recommend that you +// use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity. +// For more information, see Federation Through a Web-based Identity Provider +// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity). +// +// The GetFederationToken action must be called by using the long-term AWS security +// credentials of an IAM user. You can also call GetFederationToken using the +// security credentials of an AWS root account, but we do not recommended it. +// Instead, we recommend that you create an IAM user for the purpose of the +// proxy application and then attach a policy to the IAM user that limits federated +// users to only the actions and resources that they need access to. For more +// information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) +// in the IAM User Guide. +// +// The temporary security credentials that are obtained by using the long-term +// credentials of an IAM user are valid for the specified duration, from 900 +// seconds (15 minutes) up to a maximium of 129600 seconds (36 hours). The default +// is 43200 seconds (12 hours). Temporary credentials that are obtained by using +// AWS root account credentials have a maximum duration of 3600 seconds (1 hour). +// +// The temporary security credentials created by GetFederationToken can be used +// to make API calls to any AWS service with the following exceptions: +// +// * You cannot use these credentials to call any IAM APIs. +// +// * You cannot call any STS APIs except GetCallerIdentity. +// +// Permissions +// +// The permissions for the temporary security credentials returned by GetFederationToken +// are determined by a combination of the following: +// +// * The policy or policies that are attached to the IAM user whose credentials +// are used to call GetFederationToken. +// +// * The policy that is passed as a parameter in the call. +// +// The passed policy is attached to the temporary security credentials that +// result from the GetFederationToken API call--that is, to the federated user. +// When the federated user makes an AWS request, AWS evaluates the policy attached +// to the federated user in combination with the policy or policies attached +// to the IAM user whose credentials were used to call GetFederationToken. AWS +// allows the federated user's request only when both the federated user and +// the IAM user are explicitly allowed to perform the requested action. The +// passed policy cannot grant more permissions than those that are defined in +// the IAM user policy. +// +// A typical use case is that the permissions of the IAM user whose credentials +// are used to call GetFederationToken are designed to allow access to all the +// actions and resources that any federated user will need. Then, for individual +// users, you pass a policy to the operation that scopes down the permissions +// to a level that's appropriate to that individual user, using a policy that +// allows only a subset of permissions that are granted to the IAM user. +// +// If you do not pass a policy, the resulting temporary security credentials +// have no effective permissions. The only exception is when the temporary security +// credentials are used to access a resource that has a resource-based policy +// that specifically allows the federated user to access the resource. +// +// For more information about how permissions work, see Permissions for GetFederationToken +// (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). +// For information about using GetFederationToken to create temporary security +// credentials, see GetFederationToken—Federation Through a Custom Identity +// Broker (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken). +// +// // Example sending a request using the GetFederationTokenRequest method. +// req := client.GetFederationTokenRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken +func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) GetFederationTokenRequest { + op := &aws.Operation{ + Name: opGetFederationToken, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetFederationTokenInput{} + } + + output := &GetFederationTokenOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetFederationTokenRequest{Request: req, Input: input, Copy: c.GetFederationTokenRequest} +} + +const opGetSessionToken = "GetSessionToken" + +// GetSessionTokenRequest is a API request type for the GetSessionToken API operation. +type GetSessionTokenRequest struct { + *aws.Request + Input *GetSessionTokenInput + Copy func(*GetSessionTokenInput) GetSessionTokenRequest +} + +// Send marshals and sends the GetSessionToken API request. +func (r GetSessionTokenRequest) Send() (*GetSessionTokenOutput, error) { + err := r.Request.Send() + if err != nil { + return nil, err + } + + return r.Request.Data.(*GetSessionTokenOutput), nil +} + +// GetSessionTokenRequest returns a request value for making API operation for +// AWS Security Token Service. +// +// Returns a set of temporary credentials for an AWS account or IAM user. The +// credentials consist of an access key ID, a secret access key, and a security +// token. Typically, you use GetSessionToken if you want to use MFA to protect +// programmatic calls to specific AWS APIs like Amazon EC2 StopInstances. MFA-enabled +// IAM users would need to call GetSessionToken and submit an MFA code that +// is associated with their MFA device. Using the temporary security credentials +// that are returned from the call, IAM users can then make programmatic calls +// to APIs that require MFA authentication. If you do not supply a correct MFA +// code, then the API returns an access denied error. For a comparison of GetSessionToken +// with the other APIs that produce temporary credentials, see Requesting Temporary +// Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison) +// in the IAM User Guide. +// +// The GetSessionToken action must be called by using the long-term AWS security +// credentials of the AWS account or an IAM user. Credentials that are created +// by IAM users are valid for the duration that you specify, from 900 seconds +// (15 minutes) up to a maximum of 129600 seconds (36 hours), with a default +// of 43200 seconds (12 hours); credentials that are created by using account +// credentials can range from 900 seconds (15 minutes) up to a maximum of 3600 +// seconds (1 hour), with a default of 1 hour. +// +// The temporary security credentials created by GetSessionToken can be used +// to make API calls to any AWS service with the following exceptions: +// +// * You cannot call any IAM APIs unless MFA authentication information is +// included in the request. +// +// * You cannot call any STS API exceptAssumeRole or GetCallerIdentity. +// +// We recommend that you do not call GetSessionToken with root account credentials. +// Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) +// by creating one or more IAM users, giving them the necessary permissions, +// and using IAM users for everyday interaction with AWS. +// +// The permissions associated with the temporary security credentials returned +// by GetSessionToken are based on the permissions associated with account or +// IAM user whose credentials are used to call the action. If GetSessionToken +// is called using root account credentials, the temporary credentials have +// root account permissions. Similarly, if GetSessionToken is called using the +// credentials of an IAM user, the temporary credentials have the same permissions +// as the IAM user. +// +// For more information about using GetSessionToken to create temporary credentials, +// go to Temporary Credentials for Users in Untrusted Environments (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken) +// in the IAM User Guide. +// +// // Example sending a request using the GetSessionTokenRequest method. +// req := client.GetSessionTokenRequest(params) +// resp, err := req.Send() +// if err == nil { +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken +func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) GetSessionTokenRequest { + op := &aws.Operation{ + Name: opGetSessionToken, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetSessionTokenInput{} + } + + output := &GetSessionTokenOutput{} + req := c.newRequest(op, input, output) + output.responseMetadata = aws.Response{Request: req} + + return GetSessionTokenRequest{Request: req, Input: input, Copy: c.GetSessionTokenRequest} +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleRequest +type AssumeRoleInput struct { + _ struct{} `type:"structure"` + + // The duration, in seconds, of the role session. The value can range from 900 + // seconds (15 minutes) up to the maximum session duration setting for the role. + // This setting can have a value from 1 hour to 12 hours. If you specify a value + // higher than this setting, the operation fails. For example, if you specify + // a session duration of 12 hours, but your administrator set the maximum session + // duration to 6 hours, your operation fails. To learn how to view the maximum + // value for your role, see View the Maximum Session Duration Setting for a + // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request + // to the federation endpoint for a console sign-in token takes a SessionDuration + // parameter that specifies the maximum length of the console session. For more + // information, see Creating a URL that Enables Federated Users to Access the + // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // in the IAM User Guide. + DurationSeconds *int64 `min:"900" type:"integer"` + + // A unique identifier that is used by third parties when assuming roles in + // their customers' accounts. For each role that the third party can assume, + // they should instruct their customers to ensure the role's trust policy checks + // for the external ID that the third party generated. Each time the third party + // assumes the role, they should pass the customer's external ID. The external + // ID is useful in order to help third parties bind a role to the customer who + // created it. For more information about the external ID, see How to Use an + // External ID When Granting Access to Your AWS Resources to a Third Party (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html) + // in the IAM User Guide. + // + // The regex used to validated this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@:/- + ExternalId *string `min:"2" type:"string"` + + // An IAM policy in JSON format. + // + // This parameter is optional. If you pass a policy, the temporary security + // credentials that are returned by the operation have the permissions that + // are allowed by both (the intersection of) the access policy of the role that + // is being assumed, and the policy that you pass. This gives you a way to further + // restrict the permissions for the resulting temporary security credentials. + // You cannot use the passed policy to grant permissions that are in excess + // of those allowed by the access policy of the role that is being assumed. + // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML, + // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // in the IAM User Guide. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + Policy *string `min:"1" type:"string"` + + // The Amazon Resource Name (ARN) of the role to assume. + // + // RoleArn is a required field + RoleArn *string `min:"20" type:"string" required:"true"` + + // An identifier for the assumed role session. + // + // Use the role session name to uniquely identify a session when the same role + // is assumed by different principals or for different reasons. In cross-account + // scenarios, the role session name is visible to, and can be logged by the + // account that owns the role. The role session name is also used in the ARN + // of the assumed role principal. This means that subsequent cross-account API + // requests using the temporary security credentials will expose the role session + // name to the external account in their CloudTrail logs. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@- + // + // RoleSessionName is a required field + RoleSessionName *string `min:"2" type:"string" required:"true"` + + // The identification number of the MFA device that is associated with the user + // who is making the AssumeRole call. Specify this value if the trust policy + // of the role being assumed includes a condition that requires MFA authentication. + // The value is either the serial number for a hardware device (such as GAHT12345678) + // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@- + SerialNumber *string `min:"9" type:"string"` + + // The value provided by the MFA device, if the trust policy of the role being + // assumed requires MFA (that is, if the policy includes a condition that tests + // for MFA). If the role being assumed requires MFA and if the TokenCode value + // is missing or expired, the AssumeRole call returns an "access denied" error. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. + TokenCode *string `min:"6" type:"string"` +} + +// String returns the string representation +func (s AssumeRoleInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AssumeRoleInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(aws.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.ExternalId != nil && len(*s.ExternalId) < 2 { + invalidParams.Add(aws.NewErrParamMinLen("ExternalId", 2)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Policy", 1)) + } + + if s.RoleArn == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleArn", 20)) + } + + if s.RoleSessionName == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleSessionName")) + } + if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { + invalidParams.Add(aws.NewErrParamMinLen("RoleSessionName", 2)) + } + if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { + invalidParams.Add(aws.NewErrParamMinLen("SerialNumber", 9)) + } + if s.TokenCode != nil && len(*s.TokenCode) < 6 { + invalidParams.Add(aws.NewErrParamMinLen("TokenCode", 6)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the response to a successful AssumeRole request, including temporary +// AWS credentials that can be used to make AWS requests. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleResponse +type AssumeRoleOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers + // that you can use to refer to the resulting temporary security credentials. + // For example, you can reference these credentials as a principal in a resource-based + // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName + // that you specified when you called AssumeRole. + AssumedRoleUser *AssumedRoleUser `type:"structure"` + + // The temporary security credentials, which include an access key ID, a secret + // access key, and a security (or session) token. + // + // Note: The size of the security token that STS APIs return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. As + // of this writing, the typical size is less than 4096 bytes, but that can vary. + // Also, future updates to AWS might require larger sizes. + Credentials *Credentials `type:"structure"` + + // A percentage value that indicates the size of the policy in packed form. + // The service rejects any policy with a packed size greater than 100 percent, + // which means the policy exceeded the allowed space. + PackedPolicySize *int64 `type:"integer"` +} + +// String returns the string representation +func (s AssumeRoleOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AssumeRoleOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLRequest +type AssumeRoleWithSAMLInput struct { + _ struct{} `type:"structure"` + + // The duration, in seconds, of the role session. Your role session lasts for + // the duration that you specify for the DurationSeconds parameter, or until + // the time specified in the SAML authentication response's SessionNotOnOrAfter + // value, whichever is shorter. You can provide a DurationSeconds value from + // 900 seconds (15 minutes) up to the maximum session duration setting for the + // role. This setting can have a value from 1 hour to 12 hours. If you specify + // a value higher than this setting, the operation fails. For example, if you + // specify a session duration of 12 hours, but your administrator set the maximum + // session duration to 6 hours, your operation fails. To learn how to view the + // maximum value for your role, see View the Maximum Session Duration Setting + // for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request + // to the federation endpoint for a console sign-in token takes a SessionDuration + // parameter that specifies the maximum length of the console session. For more + // information, see Creating a URL that Enables Federated Users to Access the + // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // in the IAM User Guide. + DurationSeconds *int64 `min:"900" type:"integer"` + + // An IAM policy in JSON format. + // + // The policy parameter is optional. If you pass a policy, the temporary security + // credentials that are returned by the operation have the permissions that + // are allowed by both the access policy of the role that is being assumed, + // and the policy that you pass. This gives you a way to further restrict the + // permissions for the resulting temporary security credentials. You cannot + // use the passed policy to grant permissions that are in excess of those allowed + // by the access policy of the role that is being assumed. For more information, + // Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity + // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // in the IAM User Guide. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + Policy *string `min:"1" type:"string"` + + // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes + // the IdP. + // + // PrincipalArn is a required field + PrincipalArn *string `min:"20" type:"string" required:"true"` + + // The Amazon Resource Name (ARN) of the role that the caller is assuming. + // + // RoleArn is a required field + RoleArn *string `min:"20" type:"string" required:"true"` + + // The base-64 encoded SAML authentication response provided by the IdP. + // + // For more information, see Configuring a Relying Party and Adding Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) + // in the Using IAM guide. + // + // SAMLAssertion is a required field + SAMLAssertion *string `min:"4" type:"string" required:"true"` +} + +// String returns the string representation +func (s AssumeRoleWithSAMLInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleWithSAMLInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleWithSAMLInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(aws.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Policy", 1)) + } + + if s.PrincipalArn == nil { + invalidParams.Add(aws.NewErrParamRequired("PrincipalArn")) + } + if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("PrincipalArn", 20)) + } + + if s.RoleArn == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleArn", 20)) + } + + if s.SAMLAssertion == nil { + invalidParams.Add(aws.NewErrParamRequired("SAMLAssertion")) + } + if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { + invalidParams.Add(aws.NewErrParamMinLen("SAMLAssertion", 4)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the response to a successful AssumeRoleWithSAML request, including +// temporary AWS credentials that can be used to make AWS requests. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLResponse +type AssumeRoleWithSAMLOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The identifiers for the temporary security credentials that the operation + // returns. + AssumedRoleUser *AssumedRoleUser `type:"structure"` + + // The value of the Recipient attribute of the SubjectConfirmationData element + // of the SAML assertion. + Audience *string `type:"string"` + + // The temporary security credentials, which include an access key ID, a secret + // access key, and a security (or session) token. + // + // Note: The size of the security token that STS APIs return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. As + // of this writing, the typical size is less than 4096 bytes, but that can vary. + // Also, future updates to AWS might require larger sizes. + Credentials *Credentials `type:"structure"` + + // The value of the Issuer element of the SAML assertion. + Issuer *string `type:"string"` + + // A hash value based on the concatenation of the Issuer response value, the + // AWS account ID, and the friendly name (the last part of the ARN) of the SAML + // provider in IAM. The combination of NameQualifier and Subject can be used + // to uniquely identify a federated user. + // + // The following pseudocode shows how the hash value is calculated: + // + // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP" + // ) ) + NameQualifier *string `type:"string"` + + // A percentage value that indicates the size of the policy in packed form. + // The service rejects any policy with a packed size greater than 100 percent, + // which means the policy exceeded the allowed space. + PackedPolicySize *int64 `type:"integer"` + + // The value of the NameID element in the Subject element of the SAML assertion. + Subject *string `type:"string"` + + // The format of the name ID, as defined by the Format attribute in the NameID + // element of the SAML assertion. Typical examples of the format are transient + // or persistent. + // + // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format, + // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient + // is returned as transient. If the format includes any other prefix, the format + // is returned with no modifications. + SubjectType *string `type:"string"` +} + +// String returns the string representation +func (s AssumeRoleWithSAMLOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleWithSAMLOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AssumeRoleWithSAMLOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityRequest +type AssumeRoleWithWebIdentityInput struct { + _ struct{} `type:"structure"` + + // The duration, in seconds, of the role session. The value can range from 900 + // seconds (15 minutes) up to the maximum session duration setting for the role. + // This setting can have a value from 1 hour to 12 hours. If you specify a value + // higher than this setting, the operation fails. For example, if you specify + // a session duration of 12 hours, but your administrator set the maximum session + // duration to 6 hours, your operation fails. To learn how to view the maximum + // value for your role, see View the Maximum Session Duration Setting for a + // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // in the IAM User Guide. + // + // By default, the value is set to 3600 seconds. + // + // The DurationSeconds parameter is separate from the duration of a console + // session that you might request using the returned credentials. The request + // to the federation endpoint for a console sign-in token takes a SessionDuration + // parameter that specifies the maximum length of the console session. For more + // information, see Creating a URL that Enables Federated Users to Access the + // AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html) + // in the IAM User Guide. + DurationSeconds *int64 `min:"900" type:"integer"` + + // An IAM policy in JSON format. + // + // The policy parameter is optional. If you pass a policy, the temporary security + // credentials that are returned by the operation have the permissions that + // are allowed by both the access policy of the role that is being assumed, + // and the policy that you pass. This gives you a way to further restrict the + // permissions for the resulting temporary security credentials. You cannot + // use the passed policy to grant permissions that are in excess of those allowed + // by the access policy of the role that is being assumed. For more information, + // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html) + // in the IAM User Guide. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + Policy *string `min:"1" type:"string"` + + // The fully qualified host component of the domain name of the identity provider. + // + // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com + // and graph.facebook.com are the only supported identity providers for OAuth + // 2.0 access tokens. Do not include URL schemes and port numbers. + // + // Do not specify this value for OpenID Connect ID tokens. + ProviderId *string `min:"4" type:"string"` + + // The Amazon Resource Name (ARN) of the role that the caller is assuming. + // + // RoleArn is a required field + RoleArn *string `min:"20" type:"string" required:"true"` + + // An identifier for the assumed role session. Typically, you pass the name + // or identifier that is associated with the user who is using your application. + // That way, the temporary security credentials that your application will use + // are associated with that user. This session name is included as part of the + // ARN and assumed role ID in the AssumedRoleUser response element. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@- + // + // RoleSessionName is a required field + RoleSessionName *string `min:"2" type:"string" required:"true"` + + // The OAuth 2.0 access token or OpenID Connect ID token that is provided by + // the identity provider. Your application must get this token by authenticating + // the user who is using your application with a web identity provider before + // the application makes an AssumeRoleWithWebIdentity call. + // + // WebIdentityToken is a required field + WebIdentityToken *string `min:"4" type:"string" required:"true"` +} + +// String returns the string representation +func (s AssumeRoleWithWebIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleWithWebIdentityInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AssumeRoleWithWebIdentityInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(aws.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Policy", 1)) + } + if s.ProviderId != nil && len(*s.ProviderId) < 4 { + invalidParams.Add(aws.NewErrParamMinLen("ProviderId", 4)) + } + + if s.RoleArn == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleArn")) + } + if s.RoleArn != nil && len(*s.RoleArn) < 20 { + invalidParams.Add(aws.NewErrParamMinLen("RoleArn", 20)) + } + + if s.RoleSessionName == nil { + invalidParams.Add(aws.NewErrParamRequired("RoleSessionName")) + } + if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 { + invalidParams.Add(aws.NewErrParamMinLen("RoleSessionName", 2)) + } + + if s.WebIdentityToken == nil { + invalidParams.Add(aws.NewErrParamRequired("WebIdentityToken")) + } + if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { + invalidParams.Add(aws.NewErrParamMinLen("WebIdentityToken", 4)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the response to a successful AssumeRoleWithWebIdentity request, +// including temporary AWS credentials that can be used to make AWS requests. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityResponse +type AssumeRoleWithWebIdentityOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers + // that you can use to refer to the resulting temporary security credentials. + // For example, you can reference these credentials as a principal in a resource-based + // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName + // that you specified when you called AssumeRole. + AssumedRoleUser *AssumedRoleUser `type:"structure"` + + // The intended audience (also known as client ID) of the web identity token. + // This is traditionally the client identifier issued to the application that + // requested the web identity token. + Audience *string `type:"string"` + + // The temporary security credentials, which include an access key ID, a secret + // access key, and a security token. + // + // Note: The size of the security token that STS APIs return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. As + // of this writing, the typical size is less than 4096 bytes, but that can vary. + // Also, future updates to AWS might require larger sizes. + Credentials *Credentials `type:"structure"` + + // A percentage value that indicates the size of the policy in packed form. + // The service rejects any policy with a packed size greater than 100 percent, + // which means the policy exceeded the allowed space. + PackedPolicySize *int64 `type:"integer"` + + // The issuing authority of the web identity token presented. For OpenID Connect + // ID Tokens this contains the value of the iss field. For OAuth 2.0 access + // tokens, this contains the value of the ProviderId parameter that was passed + // in the AssumeRoleWithWebIdentity request. + Provider *string `type:"string"` + + // The unique user identifier that is returned by the identity provider. This + // identifier is associated with the WebIdentityToken that was submitted with + // the AssumeRoleWithWebIdentity call. The identifier is typically unique to + // the user and the application that acquired the WebIdentityToken (pairwise + // identifier). For OpenID Connect ID tokens, this field contains the value + // returned by the identity provider as the token's sub (Subject) claim. + SubjectFromWebIdentityToken *string `min:"6" type:"string"` +} + +// String returns the string representation +func (s AssumeRoleWithWebIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumeRoleWithWebIdentityOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s AssumeRoleWithWebIdentityOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// The identifiers for the temporary security credentials that the operation +// returns. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumedRoleUser +type AssumedRoleUser struct { + _ struct{} `type:"structure"` + + // The ARN of the temporary security credentials that are returned from the + // AssumeRole action. For more information about ARNs and how to use them in + // policies, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // in Using IAM. + // + // Arn is a required field + Arn *string `min:"20" type:"string" required:"true"` + + // A unique identifier that contains the role ID and the role session name of + // the role that is being assumed. The role ID is generated by AWS when the + // role is created. + // + // AssumedRoleId is a required field + AssumedRoleId *string `min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s AssumedRoleUser) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AssumedRoleUser) GoString() string { + return s.String() +} + +// AWS credentials for API authentication. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/Credentials +type Credentials struct { + _ struct{} `type:"structure"` + + // The access key ID that identifies the temporary security credentials. + // + // AccessKeyId is a required field + AccessKeyId *string `min:"16" type:"string" required:"true"` + + // The date on which the current credentials expire. + // + // Expiration is a required field + Expiration *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"` + + // The secret access key that can be used to sign requests. + // + // SecretAccessKey is a required field + SecretAccessKey *string `type:"string" required:"true"` + + // The token that users must pass to the service API to use the temporary credentials. + // + // SessionToken is a required field + SessionToken *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s Credentials) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Credentials) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageRequest +type DecodeAuthorizationMessageInput struct { + _ struct{} `type:"structure"` + + // The encoded message that was returned with the response. + // + // EncodedMessage is a required field + EncodedMessage *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DecodeAuthorizationMessageInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DecodeAuthorizationMessageInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DecodeAuthorizationMessageInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"} + + if s.EncodedMessage == nil { + invalidParams.Add(aws.NewErrParamRequired("EncodedMessage")) + } + if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("EncodedMessage", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// A document that contains additional information about the authorization status +// of a request from an encoded message that is returned in response to an AWS +// request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageResponse +type DecodeAuthorizationMessageOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // An XML document that contains the decoded message. + DecodedMessage *string `type:"string"` +} + +// String returns the string representation +func (s DecodeAuthorizationMessageOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DecodeAuthorizationMessageOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s DecodeAuthorizationMessageOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Identifiers for the federated user that is associated with the credentials. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/FederatedUser +type FederatedUser struct { + _ struct{} `type:"structure"` + + // The ARN that specifies the federated user that is associated with the credentials. + // For more information about ARNs and how to use them in policies, see IAM + // Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) + // in Using IAM. + // + // Arn is a required field + Arn *string `min:"20" type:"string" required:"true"` + + // The string that identifies the federated user associated with the credentials, + // similar to the unique ID of an IAM user. + // + // FederatedUserId is a required field + FederatedUserId *string `min:"2" type:"string" required:"true"` +} + +// String returns the string representation +func (s FederatedUser) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FederatedUser) GoString() string { + return s.String() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityRequest +type GetCallerIdentityInput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s GetCallerIdentityInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCallerIdentityInput) GoString() string { + return s.String() +} + +// Contains the response to a successful GetCallerIdentity request, including +// information about the entity making the request. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityResponse +type GetCallerIdentityOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The AWS account ID number of the account that owns or contains the calling + // entity. + Account *string `type:"string"` + + // The AWS ARN associated with the calling entity. + Arn *string `min:"20" type:"string"` + + // The unique identifier of the calling entity. The exact value depends on the + // type of entity making the call. The values returned are those listed in the + // aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) + // found on the Policy Variables reference page in the IAM User Guide. + UserId *string `type:"string"` +} + +// String returns the string representation +func (s GetCallerIdentityOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCallerIdentityOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetCallerIdentityOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenRequest +type GetFederationTokenInput struct { + _ struct{} `type:"structure"` + + // The duration, in seconds, that the session should last. Acceptable durations + // for federation sessions range from 900 seconds (15 minutes) to 129600 seconds + // (36 hours), with 43200 seconds (12 hours) as the default. Sessions obtained + // using AWS account (root) credentials are restricted to a maximum of 3600 + // seconds (one hour). If the specified duration is longer than one hour, the + // session obtained by using AWS account (root) credentials defaults to one + // hour. + DurationSeconds *int64 `min:"900" type:"integer"` + + // The name of the federated user. The name is used as an identifier for the + // temporary security credentials (such as Bob). For example, you can reference + // the federated user name in a resource-based policy, such as in an Amazon + // S3 bucket policy. + // + // The regex used to validate this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@- + // + // Name is a required field + Name *string `min:"2" type:"string" required:"true"` + + // An IAM policy in JSON format that is passed with the GetFederationToken call + // and evaluated along with the policy or policies that are attached to the + // IAM user whose credentials are used to call GetFederationToken. The passed + // policy is used to scope down the permissions that are available to the IAM + // user, by allowing only a subset of the permissions that are granted to the + // IAM user. The passed policy cannot grant more permissions than those granted + // to the IAM user. The final permissions for the federated user are the most + // restrictive set based on the intersection of the passed policy and the IAM + // user policy. + // + // If you do not pass a policy, the resulting temporary security credentials + // have no effective permissions. The only exception is when the temporary security + // credentials are used to access a resource that has a resource-based policy + // that specifically allows the federated user to access the resource. + // + // The format for this parameter, as described by its regex pattern, is a string + // of characters up to 2048 characters in length. The characters can be any + // ASCII character from the space character to the end of the valid character + // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A), + // and carriage return (\u000D) characters. + // + // The policy plain text must be 2048 bytes or shorter. However, an internal + // conversion compresses it into a packed binary format with a separate limit. + // The PackedPolicySize response element indicates by percentage how close to + // the upper size limit the policy is, with 100% equaling the maximum allowed + // size. + // + // For more information about how permissions work, see Permissions for GetFederationToken + // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html). + Policy *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s GetFederationTokenInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetFederationTokenInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetFederationTokenInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetFederationTokenInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(aws.NewErrParamMinValue("DurationSeconds", 900)) + } + + if s.Name == nil { + invalidParams.Add(aws.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 2 { + invalidParams.Add(aws.NewErrParamMinLen("Name", 2)) + } + if s.Policy != nil && len(*s.Policy) < 1 { + invalidParams.Add(aws.NewErrParamMinLen("Policy", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the response to a successful GetFederationToken request, including +// temporary AWS credentials that can be used to make AWS requests. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenResponse +type GetFederationTokenOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The temporary security credentials, which include an access key ID, a secret + // access key, and a security (or session) token. + // + // Note: The size of the security token that STS APIs return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. As + // of this writing, the typical size is less than 4096 bytes, but that can vary. + // Also, future updates to AWS might require larger sizes. + Credentials *Credentials `type:"structure"` + + // Identifiers for the federated user associated with the credentials (such + // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You + // can use the federated user's ARN in your resource-based policies, such as + // an Amazon S3 bucket policy. + FederatedUser *FederatedUser `type:"structure"` + + // A percentage value indicating the size of the policy in packed form. The + // service rejects policies for which the packed size is greater than 100 percent + // of the allowed value. + PackedPolicySize *int64 `type:"integer"` +} + +// String returns the string representation +func (s GetFederationTokenOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetFederationTokenOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetFederationTokenOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenRequest +type GetSessionTokenInput struct { + _ struct{} `type:"structure"` + + // The duration, in seconds, that the credentials should remain valid. Acceptable + // durations for IAM user sessions range from 900 seconds (15 minutes) to 129600 + // seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions + // for AWS account owners are restricted to a maximum of 3600 seconds (one hour). + // If the duration is longer than one hour, the session for AWS account owners + // defaults to one hour. + DurationSeconds *int64 `min:"900" type:"integer"` + + // The identification number of the MFA device that is associated with the IAM + // user who is making the GetSessionToken call. Specify this value if the IAM + // user has a policy that requires MFA authentication. The value is either the + // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource + // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user). + // You can find the device for an IAM user by going to the AWS Management Console + // and viewing the user's security credentials. + // + // The regex used to validated this parameter is a string of characters consisting + // of upper- and lower-case alphanumeric characters with no spaces. You can + // also include underscores or any of the following characters: =,.@:/- + SerialNumber *string `min:"9" type:"string"` + + // The value provided by the MFA device, if MFA is required. If any policy requires + // the IAM user to submit an MFA code, specify this value. If MFA authentication + // is required, and the user does not provide a code when requesting a set of + // temporary security credentials, the user will receive an "access denied" + // response when requesting resources that require MFA authentication. + // + // The format for this parameter, as described by its regex pattern, is a sequence + // of six numeric digits. + TokenCode *string `min:"6" type:"string"` +} + +// String returns the string representation +func (s GetSessionTokenInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetSessionTokenInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetSessionTokenInput) Validate() error { + invalidParams := aws.ErrInvalidParams{Context: "GetSessionTokenInput"} + if s.DurationSeconds != nil && *s.DurationSeconds < 900 { + invalidParams.Add(aws.NewErrParamMinValue("DurationSeconds", 900)) + } + if s.SerialNumber != nil && len(*s.SerialNumber) < 9 { + invalidParams.Add(aws.NewErrParamMinLen("SerialNumber", 9)) + } + if s.TokenCode != nil && len(*s.TokenCode) < 6 { + invalidParams.Add(aws.NewErrParamMinLen("TokenCode", 6)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// Contains the response to a successful GetSessionToken request, including +// temporary AWS credentials that can be used to make AWS requests. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenResponse +type GetSessionTokenOutput struct { + _ struct{} `type:"structure"` + + responseMetadata aws.Response + + // The temporary security credentials, which include an access key ID, a secret + // access key, and a security (or session) token. + // + // Note: The size of the security token that STS APIs return is not fixed. We + // strongly recommend that you make no assumptions about the maximum size. As + // of this writing, the typical size is less than 4096 bytes, but that can vary. + // Also, future updates to AWS might require larger sizes. + Credentials *Credentials `type:"structure"` +} + +// String returns the string representation +func (s GetSessionTokenOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetSessionTokenOutput) GoString() string { + return s.String() +} + +// SDKResponseMetdata return sthe response metadata for the API. +func (s GetSessionTokenOutput) SDKResponseMetadata() aws.Response { + return s.responseMetadata +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/customizations.go new file mode 100644 index 000000000000..488324c3a7e0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/customizations.go @@ -0,0 +1,12 @@ +package sts + +import request "github.com/aws/aws-sdk-go-v2/aws" + +func init() { + initRequest = func(c *STS, r *request.Request) { + switch r.Operation.Name { + case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: + r.Handlers.Sign.Clear() // these operations are unsigned + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go new file mode 100644 index 000000000000..a43fa80555c7 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/doc.go @@ -0,0 +1,72 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package sts provides the client and types for making API +// requests to AWS Security Token Service. +// +// The AWS Security Token Service (STS) is a web service that enables you to +// request temporary, limited-privilege credentials for AWS Identity and Access +// Management (IAM) users or for users that you authenticate (federated users). +// This guide provides descriptions of the STS API. For more detailed information +// about using this service, go to Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). +// +// As an alternative to using the API, you can use one of the AWS SDKs, which +// consist of libraries and sample code for various programming languages and +// platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient +// way to create programmatic access to STS. For example, the SDKs take care +// of cryptographically signing requests, managing errors, and retrying requests +// automatically. For information about the AWS SDKs, including how to download +// and install them, see the Tools for Amazon Web Services page (http://aws.amazon.com/tools/). +// +// For information about setting up signatures and authorization through the +// API, go to Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html) +// in the AWS General Reference. For general information about the Query API, +// go to Making Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) +// in Using IAM. For information about using security tokens with other AWS +// products, go to AWS Services That Work with IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) +// in the IAM User Guide. +// +// If you're new to AWS and need additional technical information about a specific +// AWS product, you can find the product's technical documentation at http://aws.amazon.com/documentation/ +// (http://aws.amazon.com/documentation/). +// +// Endpoints +// +// The AWS Security Token Service (STS) has a default endpoint of https://sts.amazonaws.com +// that maps to the US East (N. Virginia) region. Additional regions are available +// and are activated by default. For more information, see Activating and Deactivating +// AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) +// in the IAM User Guide. +// +// For information about STS endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sts_region) +// in the AWS General Reference. +// +// Recording API requests +// +// STS supports AWS CloudTrail, which is a service that records AWS calls for +// your AWS account and delivers log files to an Amazon S3 bucket. By using +// information collected by CloudTrail, you can determine what requests were +// successfully made to STS, who made the request, when it was made, and so +// on. To learn more about CloudTrail, including how to turn it on and find +// your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html). +// +// See https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15 for more information on this service. +// +// See sts package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/ +// +// Using the Client +// +// To AWS Security Token Service with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the AWS Security Token Service client STS for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/sts/#New +package sts diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/errors.go new file mode 100644 index 000000000000..e24884ef371a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/errors.go @@ -0,0 +1,73 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package sts + +const ( + + // ErrCodeExpiredTokenException for service response error code + // "ExpiredTokenException". + // + // The web identity token that was passed is expired or is not valid. Get a + // new identity token from the identity provider and then retry the request. + ErrCodeExpiredTokenException = "ExpiredTokenException" + + // ErrCodeIDPCommunicationErrorException for service response error code + // "IDPCommunicationError". + // + // The request could not be fulfilled because the non-AWS identity provider + // (IDP) that was asked to verify the incoming identity token could not be reached. + // This is often a transient error caused by network conditions. Retry the request + // a limited number of times so that you don't exceed the request rate. If the + // error persists, the non-AWS identity provider might be down or not responding. + ErrCodeIDPCommunicationErrorException = "IDPCommunicationError" + + // ErrCodeIDPRejectedClaimException for service response error code + // "IDPRejectedClaim". + // + // The identity provider (IdP) reported that authentication failed. This might + // be because the claim is invalid. + // + // If this error is returned for the AssumeRoleWithWebIdentity operation, it + // can also mean that the claim has expired or has been explicitly revoked. + ErrCodeIDPRejectedClaimException = "IDPRejectedClaim" + + // ErrCodeInvalidAuthorizationMessageException for service response error code + // "InvalidAuthorizationMessageException". + // + // The error returned if the message passed to DecodeAuthorizationMessage was + // invalid. This can happen if the token contains invalid characters, such as + // linebreaks. + ErrCodeInvalidAuthorizationMessageException = "InvalidAuthorizationMessageException" + + // ErrCodeInvalidIdentityTokenException for service response error code + // "InvalidIdentityToken". + // + // The web identity token that was passed could not be validated by AWS. Get + // a new identity token from the identity provider and then retry the request. + ErrCodeInvalidIdentityTokenException = "InvalidIdentityToken" + + // ErrCodeMalformedPolicyDocumentException for service response error code + // "MalformedPolicyDocument". + // + // The request was rejected because the policy document was malformed. The error + // message describes the specific error. + ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocument" + + // ErrCodePackedPolicyTooLargeException for service response error code + // "PackedPolicyTooLarge". + // + // The request was rejected because the policy document was too large. The error + // message describes how big the policy document is, in packed form, as a percentage + // of what the API allows. + ErrCodePackedPolicyTooLargeException = "PackedPolicyTooLarge" + + // ErrCodeRegionDisabledException for service response error code + // "RegionDisabledException". + // + // STS is not activated in the requested region for the account that is being + // asked to generate credentials. The account administrator must use the IAM + // console to activate STS in that region. For more information, see Activating + // and Deactivating AWS STS in an AWS Region (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) + // in the IAM User Guide. + ErrCodeRegionDisabledException = "RegionDisabledException" +) diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/service.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/service.go new file mode 100644 index 000000000000..79775f71f71a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/service.go @@ -0,0 +1,80 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package sts + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/private/protocol/query" +) + +// STS provides the API operation methods for making requests to +// AWS Security Token Service. See this package's package overview docs +// for details on the service. +// +// STS methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type STS struct { + *aws.Client +} + +// Used for custom client initialization logic +var initClient func(*STS) + +// Used for custom request initialization logic +var initRequest func(*STS, *aws.Request) + +// Service information constants +const ( + ServiceName = "sts" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the STS client with a config. +// +// Example: +// // Create a STS client from just a config. +// svc := sts.New(myConfig) +func New(config aws.Config) *STS { + var signingName string + signingRegion := config.Region + + svc := &STS{ + Client: aws.NewClient( + config, + aws.Metadata{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + APIVersion: "2011-06-15", + }, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(query.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc) + } + + return svc +} + +// newRequest creates a new request for a STS operation and runs any +// custom request initialization. +func (c *STS) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(c, req) + } + + return req +} diff --git a/vendor/github.com/awslabs/goformation/CONTRIBUTING.md b/vendor/github.com/awslabs/goformation/CONTRIBUTING.md new file mode 100644 index 000000000000..f5c85f6d96f8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# Contributing to GoFormation + +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/LICENSE b/vendor/github.com/awslabs/goformation/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/awslabs/goformation/NOTICE b/vendor/github.com/awslabs/goformation/NOTICE new file mode 100644 index 000000000000..595536ae359e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/NOTICE @@ -0,0 +1,2 @@ +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 new file mode 100644 index 000000000000..0c89fa99bd83 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/README.md @@ -0,0 +1,244 @@ +# 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. +- [Main features](#main-features) +- [Installation](#installation) +- [Usage](#usage) + - [Marshalling CloudFormation/SAM described with Go structs, into YAML/JSON](#marshalling-cloudformationsam-described-with-go-structs-into-yamljson) + - [Unmarshalling CloudFormation YAML/JSON into Go structs](#unmarshalling-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) +- [Versioning](#versioning) +- [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 + +As with other Go libraries, GoFormation can be installed with `go get`. + +``` +$ go get github.com/awslabs/goformation +``` + +## Usage + +### Marshalling CloudFormation/SAM described with Go structs, into YAML/JSON + +Below is an example of building a CloudFormation template programmatically, then outputting the resulting JSON + +```go +package main + +import ( + "fmt" + "strconv" + "time" + + "github.com/awslabs/goformation/cloudformation" +) + +func main() { + + // Create a new CloudFormation template + template := cloudformation.NewTemplate() + + // Create an Amazon SNS topic, with a unique name based off the current timestamp + template.Resources["MyTopic"] = &cloudformation.AWSSNSTopic{ + TopicName: "my-topic-" + strconv.FormatInt(time.Now().Unix(), 10), + } + + // Create a subscription, connected to our topic, that forwards notifications to an email address + template.Resources["MyTopicSubscription"] = &cloudformation.AWSSNSSubscription{ + TopicArn: cloudformation.Ref("MyTopic"), + Protocol: "email", + Endpoint: "some.email@example.com", + } + + // Let's see the JSON AWS CloudFormation template + j, err := template.JSON() + if err != nil { + fmt.Printf("Failed to generate JSON: %s\n", err) + } else { + fmt.Printf("%s\n", string(j)) + } + + // and also the YAML AWS CloudFormation template + y, err := template.YAML() + if err != nil { + fmt.Printf("Failed to generate YAML: %s\n", err) + } else { + fmt.Printf("%s\n", string(y)) + } + +} +``` + +Would output the following JSON template: + +```javascript +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Resources": { + "MyTopic": { + "Properties": { + "TopicName": "my-topic-1536878058" + }, + "Type": "AWS::SNS::Topic" + }, + "MyTopicSubscription": { + "Properties": { + "Endpoint": "some.email@example.com", + "Protocol": "email", + "TopicArn": { + "Ref": "MyTopic" + } + }, + "Type": "AWS::SNS::Subscription" + } + } +} +``` + +...and the following YAML template: + +```yaml +AWSTemplateFormatVersion: 2010-09-09 +Resources: + MyTopic: + Properties: + TopicName: my-topic-1536878058 + Type: AWS::SNS::Topic + MyTopicSubscription: + Properties: + Endpoint: some.email@example.com + Protocol: email + TopicArn: + Ref: MyTopic + Type: AWS::SNS::Subscription +``` + +When creating templates, you can use the following convenience functions to use [AWS CloudFormation Intrinsics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html): + + - `cloudformation.Ref(logicalName string)` + - `cloudformation.GetAtt(logicalName string, attribute string)` + - `cloudformation.ImportValue(name string)` + - `cloudformation.Base64(input string)` + - `cloudformation.CIDR(ipBlock, count, cidrBits string)` + - `cloudformation.FindInMap(mapName, topLevelKey, secondLevelKey string)` + - `cloudformation.GetAZs(region string)` + - `cloudformation.Join(delimiter string, values []string)` + - `cloudformation.Select(index string, list []string)` + - `cloudformation.Split(delimiter, source string)` + - `cloudformation.Sub(value string)` + - `And(conditions []string)` + - `Equals(value1, value2 string)` + - `If(value, ifEqual, ifNotEqual string)` + - `Not(conditions []string)` + - `Or(conditions []string)` + +### Unmarshalling 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 ( + "log" + + "github.com/awslabs/goformation" +) + +func main() { + + // Open a template from file (can be JSON or YAML) + template, err := goformation.Open("template.yaml") + if err != nil { + log.Fatalf("There was an error processing the template: %s", err) + } + + // You can extract all resources of a certain type + // Each AWS CloudFormation resource is a strongly typed struct + functions := template.GetAllAWSServerlessFunctionResources() + for name, function := range functions { + + // E.g. Found a AWS::Serverless::Function named GetHelloWorld (runtime: nodejs6.10) + log.Printf("Found a %s named %s (runtime: %s)\n", function.AWSCloudFormationType(), name, function.Runtime) + + } + + // You can also search for specific resources by their logicalId + search := "GetHelloWorld" + function, err := template.GetAWSServerlessFunctionWithName(search) + if err != nil { + log.Fatalf("Function not found") + } + + // E.g. Found a AWS::Serverless::Function named GetHelloWorld (runtime: nodejs6.10) + log.Printf("Found a %s named %s (runtime: %s)\n", function.AWSCloudFormationType(), search, function.Runtime) + +} +``` + +## 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`: + +``` +$ 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 +``` + +The GoFormation build pipeline automatically checks for any updated AWS CloudFormation resources on a daily basis, and creates a pull request against this repository if any are found. + +## Advanced + +### AWS CloudFormation Intrinsic Functions + +The following [AWS CloudFormation Intrinsic Functions](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) are supported in GoFormation: + +- [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) +- [x] [Fn::And](intrinsics/fnand.go) +- [x] [Fn::Equals](intrinsics/fnequals.go) +- [x] [Fn::If](intrinsics/fnif.go) +- [x] [Fn::Not](intrinsics/fnnot.go) +- [x] [Fn::Or](intrinsics/fnor.go) +- [ ] Fn::GetAtt +- [x] [Fn::GetAZs](intrinsics/fngetazs.go) +- [ ] Fn::ImportValue + +Any unsupported intrinsic functions will return `nil`. + +#### Resolving References (Ref) + +When converting a YAML/JSON template to go, 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). + +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.** + + +## Versioning + +This library is automatically versioned and tagged using [semantic-release](https://github.com/semantic-release/semantic-release). + +## Contributing + +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 000000000000..a1e31aab2668 --- /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-amazonmq-broker.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker.go new file mode 100644 index 000000000000..bfef256ea26b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker.go @@ -0,0 +1,181 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAmazonMQBroker AWS CloudFormation Resource (AWS::AmazonMQ::Broker) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html +type AWSAmazonMQBroker struct { + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // BrokerName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-brokername + BrokerName string `json:"BrokerName,omitempty"` + + // Configuration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-configuration + Configuration *AWSAmazonMQBroker_ConfigurationId `json:"Configuration,omitempty"` + + // DeploymentMode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-deploymentmode + DeploymentMode string `json:"DeploymentMode,omitempty"` + + // EngineType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-enginetype + EngineType string `json:"EngineType,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // HostInstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-hostinstancetype + HostInstanceType string `json:"HostInstanceType,omitempty"` + + // Logs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-logs + Logs *AWSAmazonMQBroker_LogList `json:"Logs,omitempty"` + + // MaintenanceWindowStartTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-maintenancewindowstarttime + MaintenanceWindowStartTime *AWSAmazonMQBroker_MaintenanceWindow `json:"MaintenanceWindowStartTime,omitempty"` + + // PubliclyAccessible AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-publiclyaccessible + PubliclyAccessible bool `json:"PubliclyAccessible,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // Users AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-broker.html#cfn-amazonmq-broker-users + Users []AWSAmazonMQBroker_User `json:"Users,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQBroker) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Broker" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQBroker) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAmazonMQBroker) MarshalJSON() ([]byte, error) { + type Properties AWSAmazonMQBroker + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAmazonMQBroker) UnmarshalJSON(b []byte) error { + type Properties AWSAmazonMQBroker + 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 = AWSAmazonMQBroker(*res.Properties) + } + + return nil +} + +// GetAllAWSAmazonMQBrokerResources retrieves all AWSAmazonMQBroker items from an AWS CloudFormation template +func (t *Template) GetAllAWSAmazonMQBrokerResources() map[string]AWSAmazonMQBroker { + results := map[string]AWSAmazonMQBroker{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAmazonMQBroker: + // 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::AmazonMQ::Broker" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAmazonMQBroker + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAmazonMQBrokerWithName retrieves all AWSAmazonMQBroker items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAmazonMQBrokerWithName(name string) (AWSAmazonMQBroker, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAmazonMQBroker: + // 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::AmazonMQ::Broker" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAmazonMQBroker + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAmazonMQBroker{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_configurationid.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_configurationid.go new file mode 100644 index 000000000000..a5f456f6d09f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_configurationid.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAmazonMQBroker_ConfigurationId AWS CloudFormation Resource (AWS::AmazonMQ::Broker.ConfigurationId) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html +type AWSAmazonMQBroker_ConfigurationId struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html#cfn-amazonmq-broker-configurationid-id + Id string `json:"Id,omitempty"` + + // Revision AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-configurationid.html#cfn-amazonmq-broker-configurationid-revision + Revision int `json:"Revision,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQBroker_ConfigurationId) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Broker.ConfigurationId" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQBroker_ConfigurationId) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_loglist.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_loglist.go new file mode 100644 index 000000000000..aa6222858c8c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_loglist.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAmazonMQBroker_LogList AWS CloudFormation Resource (AWS::AmazonMQ::Broker.LogList) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-loglist.html +type AWSAmazonMQBroker_LogList struct { + + // Audit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-loglist.html#cfn-amazonmq-broker-loglist-audit + Audit bool `json:"Audit,omitempty"` + + // General AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-loglist.html#cfn-amazonmq-broker-loglist-general + General bool `json:"General,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQBroker_LogList) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Broker.LogList" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQBroker_LogList) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_maintenancewindow.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_maintenancewindow.go new file mode 100644 index 000000000000..89ae7f47fa0d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_maintenancewindow.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSAmazonMQBroker_MaintenanceWindow AWS CloudFormation Resource (AWS::AmazonMQ::Broker.MaintenanceWindow) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html +type AWSAmazonMQBroker_MaintenanceWindow struct { + + // DayOfWeek AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-dayofweek + DayOfWeek string `json:"DayOfWeek,omitempty"` + + // TimeOfDay AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-timeofday + TimeOfDay string `json:"TimeOfDay,omitempty"` + + // TimeZone AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-maintenancewindow.html#cfn-amazonmq-broker-maintenancewindow-timezone + TimeZone string `json:"TimeZone,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQBroker_MaintenanceWindow) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Broker.MaintenanceWindow" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQBroker_MaintenanceWindow) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_user.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_user.go new file mode 100644 index 000000000000..15fe3a75a1d1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-broker_user.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSAmazonMQBroker_User AWS CloudFormation Resource (AWS::AmazonMQ::Broker.User) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html +type AWSAmazonMQBroker_User struct { + + // ConsoleAccess AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-consoleaccess + ConsoleAccess bool `json:"ConsoleAccess,omitempty"` + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-groups + Groups []string `json:"Groups,omitempty"` + + // Password AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-password + Password string `json:"Password,omitempty"` + + // Username AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-amazonmq-broker-user.html#cfn-amazonmq-broker-user-username + Username string `json:"Username,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQBroker_User) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Broker.User" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQBroker_User) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-configuration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-configuration.go new file mode 100644 index 000000000000..0b054e85af8a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-amazonmq-configuration.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAmazonMQConfiguration AWS CloudFormation Resource (AWS::AmazonMQ::Configuration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html +type AWSAmazonMQConfiguration struct { + + // Data AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-data + Data string `json:"Data,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-description + Description string `json:"Description,omitempty"` + + // EngineType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-enginetype + EngineType string `json:"EngineType,omitempty"` + + // EngineVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-engineversion + EngineVersion string `json:"EngineVersion,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-amazonmq-configuration.html#cfn-amazonmq-configuration-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAmazonMQConfiguration) AWSCloudFormationType() string { + return "AWS::AmazonMQ::Configuration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAmazonMQConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAmazonMQConfiguration) MarshalJSON() ([]byte, error) { + type Properties AWSAmazonMQConfiguration + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAmazonMQConfiguration) UnmarshalJSON(b []byte) error { + type Properties AWSAmazonMQConfiguration + 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 = AWSAmazonMQConfiguration(*res.Properties) + } + + return nil +} + +// GetAllAWSAmazonMQConfigurationResources retrieves all AWSAmazonMQConfiguration items from an AWS CloudFormation template +func (t *Template) GetAllAWSAmazonMQConfigurationResources() map[string]AWSAmazonMQConfiguration { + results := map[string]AWSAmazonMQConfiguration{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAmazonMQConfiguration: + // 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::AmazonMQ::Configuration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAmazonMQConfiguration + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAmazonMQConfigurationWithName retrieves all AWSAmazonMQConfiguration items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAmazonMQConfigurationWithName(name string) (AWSAmazonMQConfiguration, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAmazonMQConfiguration: + // 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::AmazonMQ::Configuration" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAmazonMQConfiguration + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAmazonMQConfiguration{}, errors.New("resource not found") +} 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 000000000000..d0f1185ec0ed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-account.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayAccount) AWSCloudFormationType() string { + return "AWS::ApiGateway::Account" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayAccount) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..723a8748ef7b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey.go @@ -0,0 +1,146 @@ +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 { + + // CustomerId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-customerid + CustomerId string `json:"CustomerId,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-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-apikey-enabled + Enabled bool `json:"Enabled,omitempty"` + + // GenerateDistinctId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-generatedistinctid + GenerateDistinctId bool `json:"GenerateDistinctId,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-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-apikey-stagekeys + StageKeys []AWSApiGatewayApiKey_StageKey `json:"StageKeys,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayApiKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::ApiKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayApiKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..90f12171d554 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-apikey_stagekey.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSApiGatewayApiKey_StageKey AWS CloudFormation Resource (AWS::ApiGateway::ApiKey.StageKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-apikey-stagekey.html +type AWSApiGatewayApiKey_StageKey struct { + + // RestApiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-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-apigateway-apikey-stagekey.html#cfn-apigateway-apikey-stagekey-stagename + StageName string `json:"StageName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayApiKey_StageKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::ApiKey.StageKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayApiKey_StageKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..17fca0a0f23a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-authorizer.go @@ -0,0 +1,166 @@ +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 { + + // AuthType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-authtype + AuthType string `json:"AuthType,omitempty"` + + // 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: true + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayAuthorizer) AWSCloudFormationType() string { + return "AWS::ApiGateway::Authorizer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayAuthorizer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c865d842756a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-basepathmapping.go @@ -0,0 +1,136 @@ +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: true + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayBasePathMapping) AWSCloudFormationType() string { + return "AWS::ApiGateway::BasePathMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayBasePathMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..104852973905 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-clientcertificate.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayClientCertificate) AWSCloudFormationType() string { + return "AWS::ApiGateway::ClientCertificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayClientCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1f64e4f5c822 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDeployment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..622d4b2143b0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_methodsetting.go @@ -0,0 +1,70 @@ +package cloudformation + +// AWSApiGatewayDeployment_MethodSetting AWS CloudFormation Resource (AWS::ApiGateway::Deployment.MethodSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-deployment-stagedescription-methodsetting.html#cfn-apigateway-deployment-stagedescription-methodsetting-throttlingratelimit + ThrottlingRateLimit float64 `json:"ThrottlingRateLimit,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment_MethodSetting) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment.MethodSetting" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDeployment_MethodSetting) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5874cd3bcf9e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-deployment_stagedescription.go @@ -0,0 +1,95 @@ +package cloudformation + +// AWSApiGatewayDeployment_StageDescription AWS CloudFormation Resource (AWS::ApiGateway::Deployment.StageDescription) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-deployment-stagedescription.html +type AWSApiGatewayDeployment_StageDescription struct { + + // CacheClusterEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-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-apigateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-description + Description string `json:"Description,omitempty"` + + // DocumentationVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-documentationversion + DocumentationVersion string `json:"DocumentationVersion,omitempty"` + + // LoggingLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-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-apigateway-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-apigateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-metricsenabled + MetricsEnabled bool `json:"MetricsEnabled,omitempty"` + + // ThrottlingBurstLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-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-apigateway-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-apigateway-deployment-stagedescription.html#cfn-apigateway-deployment-stagedescription-variables + Variables map[string]string `json:"Variables,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDeployment_StageDescription) AWSCloudFormationType() string { + return "AWS::ApiGateway::Deployment.StageDescription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDeployment_StageDescription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart.go new file mode 100644 index 000000000000..859ee8f0b533 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayDocumentationPart AWS CloudFormation Resource (AWS::ApiGateway::DocumentationPart) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationpart.html +type AWSApiGatewayDocumentationPart struct { + + // Location AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationpart.html#cfn-apigateway-documentationpart-location + Location *AWSApiGatewayDocumentationPart_Location `json:"Location,omitempty"` + + // Properties AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationpart.html#cfn-apigateway-documentationpart-properties + Properties string `json:"Properties,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationpart.html#cfn-apigateway-documentationpart-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDocumentationPart) AWSCloudFormationType() string { + return "AWS::ApiGateway::DocumentationPart" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDocumentationPart) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSApiGatewayDocumentationPart) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayDocumentationPart + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayDocumentationPart) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayDocumentationPart + 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 = AWSApiGatewayDocumentationPart(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayDocumentationPartResources retrieves all AWSApiGatewayDocumentationPart items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayDocumentationPartResources() map[string]AWSApiGatewayDocumentationPart { + results := map[string]AWSApiGatewayDocumentationPart{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayDocumentationPart: + // 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::DocumentationPart" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDocumentationPart + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayDocumentationPartWithName retrieves all AWSApiGatewayDocumentationPart items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayDocumentationPartWithName(name string) (AWSApiGatewayDocumentationPart, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayDocumentationPart: + // 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::DocumentationPart" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDocumentationPart + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayDocumentationPart{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart_location.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart_location.go new file mode 100644 index 000000000000..631a91b9073d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationpart_location.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSApiGatewayDocumentationPart_Location AWS CloudFormation Resource (AWS::ApiGateway::DocumentationPart.Location) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html +type AWSApiGatewayDocumentationPart_Location struct { + + // Method AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html#cfn-apigateway-documentationpart-location-method + Method string `json:"Method,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html#cfn-apigateway-documentationpart-location-name + Name string `json:"Name,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html#cfn-apigateway-documentationpart-location-path + Path string `json:"Path,omitempty"` + + // StatusCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html#cfn-apigateway-documentationpart-location-statuscode + StatusCode string `json:"StatusCode,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-documentationpart-location.html#cfn-apigateway-documentationpart-location-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDocumentationPart_Location) AWSCloudFormationType() string { + return "AWS::ApiGateway::DocumentationPart.Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDocumentationPart_Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationversion.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationversion.go new file mode 100644 index 000000000000..e4fcaac49154 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-documentationversion.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayDocumentationVersion AWS CloudFormation Resource (AWS::ApiGateway::DocumentationVersion) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationversion.html +type AWSApiGatewayDocumentationVersion struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationversion.html#cfn-apigateway-documentationversion-description + Description string `json:"Description,omitempty"` + + // DocumentationVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationversion.html#cfn-apigateway-documentationversion-documentationversion + DocumentationVersion string `json:"DocumentationVersion,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-documentationversion.html#cfn-apigateway-documentationversion-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDocumentationVersion) AWSCloudFormationType() string { + return "AWS::ApiGateway::DocumentationVersion" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDocumentationVersion) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSApiGatewayDocumentationVersion) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayDocumentationVersion + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayDocumentationVersion) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayDocumentationVersion + 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 = AWSApiGatewayDocumentationVersion(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayDocumentationVersionResources retrieves all AWSApiGatewayDocumentationVersion items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayDocumentationVersionResources() map[string]AWSApiGatewayDocumentationVersion { + results := map[string]AWSApiGatewayDocumentationVersion{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayDocumentationVersion: + // 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::DocumentationVersion" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDocumentationVersion + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayDocumentationVersionWithName retrieves all AWSApiGatewayDocumentationVersion items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayDocumentationVersionWithName(name string) (AWSApiGatewayDocumentationVersion, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayDocumentationVersion: + // 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::DocumentationVersion" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayDocumentationVersion + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayDocumentationVersion{}, errors.New("resource not found") +} 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 000000000000..233c8ebf3ff4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname.go @@ -0,0 +1,136 @@ +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: false + // 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"` + + // EndpointConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-endpointconfiguration + EndpointConfiguration *AWSApiGatewayDomainName_EndpointConfiguration `json:"EndpointConfiguration,omitempty"` + + // RegionalCertificateArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html#cfn-apigateway-domainname-regionalcertificatearn + RegionalCertificateArn string `json:"RegionalCertificateArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDomainName) AWSCloudFormationType() string { + return "AWS::ApiGateway::DomainName" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDomainName) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-domainname_endpointconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname_endpointconfiguration.go new file mode 100644 index 000000000000..f761191e9eef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-domainname_endpointconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSApiGatewayDomainName_EndpointConfiguration AWS CloudFormation Resource (AWS::ApiGateway::DomainName.EndpointConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-domainname-endpointconfiguration.html +type AWSApiGatewayDomainName_EndpointConfiguration struct { + + // Types AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-domainname-endpointconfiguration.html#cfn-apigateway-domainname-endpointconfiguration-types + Types []string `json:"Types,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayDomainName_EndpointConfiguration) AWSCloudFormationType() string { + return "AWS::ApiGateway::DomainName.EndpointConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayDomainName_EndpointConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-gatewayresponse.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-gatewayresponse.go new file mode 100644 index 000000000000..e81b970079be --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-gatewayresponse.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayGatewayResponse AWS CloudFormation Resource (AWS::ApiGateway::GatewayResponse) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html +type AWSApiGatewayGatewayResponse struct { + + // ResponseParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html#cfn-apigateway-gatewayresponse-responseparameters + ResponseParameters map[string]string `json:"ResponseParameters,omitempty"` + + // ResponseTemplates AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html#cfn-apigateway-gatewayresponse-responsetemplates + ResponseTemplates map[string]string `json:"ResponseTemplates,omitempty"` + + // ResponseType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html#cfn-apigateway-gatewayresponse-responsetype + ResponseType string `json:"ResponseType,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html#cfn-apigateway-gatewayresponse-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // StatusCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-gatewayresponse.html#cfn-apigateway-gatewayresponse-statuscode + StatusCode string `json:"StatusCode,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayGatewayResponse) AWSCloudFormationType() string { + return "AWS::ApiGateway::GatewayResponse" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayGatewayResponse) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSApiGatewayGatewayResponse) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayGatewayResponse + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayGatewayResponse) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayGatewayResponse + 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 = AWSApiGatewayGatewayResponse(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayGatewayResponseResources retrieves all AWSApiGatewayGatewayResponse items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayGatewayResponseResources() map[string]AWSApiGatewayGatewayResponse { + results := map[string]AWSApiGatewayGatewayResponse{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayGatewayResponse: + // 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::GatewayResponse" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayGatewayResponse + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayGatewayResponseWithName retrieves all AWSApiGatewayGatewayResponse items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayGatewayResponseWithName(name string) (AWSApiGatewayGatewayResponse, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayGatewayResponse: + // 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::GatewayResponse" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayGatewayResponse + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayGatewayResponse{}, 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 000000000000..7e9efea06b91 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method.go @@ -0,0 +1,176 @@ +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"` + + // OperationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-operationname + OperationName string `json:"OperationName,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"` + + // RequestValidatorId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-requestvalidatorid + RequestValidatorId string `json:"RequestValidatorId,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: true + // 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: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayMethod) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f5865fec3bfe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integration.go @@ -0,0 +1,75 @@ +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"` + + // ContentHandling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html#cfn-apigateway-method-integration-contenthandling + ContentHandling string `json:"ContentHandling,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_Integration) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.Integration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayMethod_Integration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d8fe00667eb7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_integrationresponse.go @@ -0,0 +1,45 @@ +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 { + + // ContentHandling AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration-integrationresponse.html#cfn-apigateway-method-integrationresponse-contenthandling + ContentHandling string `json:"ContentHandling,omitempty"` + + // 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: true + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_IntegrationResponse) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.IntegrationResponse" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayMethod_IntegrationResponse) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4851b0612b42 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-method_methodresponse.go @@ -0,0 +1,35 @@ +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: true + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayMethod_MethodResponse) AWSCloudFormationType() string { + return "AWS::ApiGateway::Method.MethodResponse" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayMethod_MethodResponse) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..975b195f8273 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-model.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayModel) AWSCloudFormationType() string { + return "AWS::ApiGateway::Model" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayModel) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-requestvalidator.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-requestvalidator.go new file mode 100644 index 000000000000..082cfba7a0c4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-requestvalidator.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayRequestValidator AWS CloudFormation Resource (AWS::ApiGateway::RequestValidator) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-requestvalidator.html +type AWSApiGatewayRequestValidator struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-requestvalidator.html#cfn-apigateway-requestvalidator-name + Name string `json:"Name,omitempty"` + + // RestApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-requestvalidator.html#cfn-apigateway-requestvalidator-restapiid + RestApiId string `json:"RestApiId,omitempty"` + + // ValidateRequestBody AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-requestvalidator.html#cfn-apigateway-requestvalidator-validaterequestbody + ValidateRequestBody bool `json:"ValidateRequestBody,omitempty"` + + // ValidateRequestParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-requestvalidator.html#cfn-apigateway-requestvalidator-validaterequestparameters + ValidateRequestParameters bool `json:"ValidateRequestParameters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRequestValidator) AWSCloudFormationType() string { + return "AWS::ApiGateway::RequestValidator" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayRequestValidator) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSApiGatewayRequestValidator) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayRequestValidator + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayRequestValidator) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayRequestValidator + 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 = AWSApiGatewayRequestValidator(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayRequestValidatorResources retrieves all AWSApiGatewayRequestValidator items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayRequestValidatorResources() map[string]AWSApiGatewayRequestValidator { + results := map[string]AWSApiGatewayRequestValidator{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayRequestValidator: + // 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::RequestValidator" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayRequestValidator + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayRequestValidatorWithName retrieves all AWSApiGatewayRequestValidator items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayRequestValidatorWithName(name string) (AWSApiGatewayRequestValidator, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayRequestValidator: + // 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::RequestValidator" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayRequestValidator + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayRequestValidator{}, 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 000000000000..215f553e7a9d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-resource.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayResource) AWSCloudFormationType() string { + return "AWS::ApiGateway::Resource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayResource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d028e006c49d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi.go @@ -0,0 +1,176 @@ +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 { + + // ApiKeySourceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-apikeysourcetype + ApiKeySourceType string `json:"ApiKeySourceType,omitempty"` + + // 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"` + + // EndpointConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-endpointconfiguration + EndpointConfiguration *AWSApiGatewayRestApi_EndpointConfiguration `json:"EndpointConfiguration,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"` + + // MinimumCompressionSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-minimumcompressionsize + MinimumCompressionSize int `json:"MinimumCompressionSize,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"` + + // Policy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-policy + Policy interface{} `json:"Policy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRestApi) AWSCloudFormationType() string { + return "AWS::ApiGateway::RestApi" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayRestApi) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_endpointconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_endpointconfiguration.go new file mode 100644 index 000000000000..eb504951c193 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_endpointconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSApiGatewayRestApi_EndpointConfiguration AWS CloudFormation Resource (AWS::ApiGateway::RestApi.EndpointConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html +type AWSApiGatewayRestApi_EndpointConfiguration struct { + + // Types AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html#cfn-apigateway-restapi-endpointconfiguration-types + Types []string `json:"Types,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRestApi_EndpointConfiguration) AWSCloudFormationType() string { + return "AWS::ApiGateway::RestApi.EndpointConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayRestApi_EndpointConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f411d18bb174 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-restapi_s3location.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSApiGatewayRestApi_S3Location AWS CloudFormation Resource (AWS::ApiGateway::RestApi.S3Location) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.html +type AWSApiGatewayRestApi_S3Location struct { + + // Bucket AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-s3location.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-apigateway-restapi-s3location.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-apigateway-restapi-s3location.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-apigateway-restapi-s3location.html#cfn-apigateway-restapi-s3location-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayRestApi_S3Location) AWSCloudFormationType() string { + return "AWS::ApiGateway::RestApi.S3Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayRestApi_S3Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b43cf6a0e914 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage.go @@ -0,0 +1,166 @@ +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"` + + // DocumentationVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html#cfn-apigateway-stage-documentationversion + DocumentationVersion string `json:"DocumentationVersion,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: true + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayStage) AWSCloudFormationType() string { + return "AWS::ApiGateway::Stage" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayStage) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f5afbb8edec0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-stage_methodsetting.go @@ -0,0 +1,70 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayStage_MethodSetting) AWSCloudFormationType() string { + return "AWS::ApiGateway::Stage.MethodSetting" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayStage_MethodSetting) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4e0f10024315 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayUsagePlan) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..b678d8330219 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_apistage.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_ApiStage) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.ApiStage" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayUsagePlan_ApiStage) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c54768977580 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_quotasettings.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_QuotaSettings) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.QuotaSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayUsagePlan_QuotaSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fa82243cffee --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplan_throttlesettings.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlan_ThrottleSettings) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlan.ThrottleSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayUsagePlan_ThrottleSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d6ee04599d59 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-usageplankey.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayUsagePlanKey) AWSCloudFormationType() string { + return "AWS::ApiGateway::UsagePlanKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayUsagePlanKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-apigateway-vpclink.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-vpclink.go new file mode 100644 index 000000000000..3a6f272c2f48 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-apigateway-vpclink.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSApiGatewayVpcLink AWS CloudFormation Resource (AWS::ApiGateway::VpcLink) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-vpclink.html +type AWSApiGatewayVpcLink struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-vpclink.html#cfn-apigateway-vpclink-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-vpclink.html#cfn-apigateway-vpclink-name + Name string `json:"Name,omitempty"` + + // TargetArns AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-vpclink.html#cfn-apigateway-vpclink-targetarns + TargetArns []string `json:"TargetArns,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApiGatewayVpcLink) AWSCloudFormationType() string { + return "AWS::ApiGateway::VpcLink" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApiGatewayVpcLink) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSApiGatewayVpcLink) MarshalJSON() ([]byte, error) { + type Properties AWSApiGatewayVpcLink + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSApiGatewayVpcLink) UnmarshalJSON(b []byte) error { + type Properties AWSApiGatewayVpcLink + 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 = AWSApiGatewayVpcLink(*res.Properties) + } + + return nil +} + +// GetAllAWSApiGatewayVpcLinkResources retrieves all AWSApiGatewayVpcLink items from an AWS CloudFormation template +func (t *Template) GetAllAWSApiGatewayVpcLinkResources() map[string]AWSApiGatewayVpcLink { + results := map[string]AWSApiGatewayVpcLink{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSApiGatewayVpcLink: + // 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::VpcLink" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayVpcLink + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSApiGatewayVpcLinkWithName retrieves all AWSApiGatewayVpcLink items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSApiGatewayVpcLinkWithName(name string) (AWSApiGatewayVpcLink, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSApiGatewayVpcLink: + // 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::VpcLink" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSApiGatewayVpcLink + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSApiGatewayVpcLink{}, 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 000000000000..92b9735b6577 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget.go @@ -0,0 +1,151 @@ +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"` + + // ScheduledActions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalabletarget.html#cfn-applicationautoscaling-scalabletarget-scheduledactions + ScheduledActions []AWSApplicationAutoScalingScalableTarget_ScheduledAction `json:"ScheduledActions,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalableTarget) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalableTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalableTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-scalabletarget_scalabletargetaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget_scalabletargetaction.go new file mode 100644 index 000000000000..94b147c1cdf4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget_scalabletargetaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSApplicationAutoScalingScalableTarget_ScalableTargetAction AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalableTarget.ScalableTargetAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scalabletargetaction.html +type AWSApplicationAutoScalingScalableTarget_ScalableTargetAction struct { + + // MaxCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scalabletargetaction.html#cfn-applicationautoscaling-scalabletarget-scalabletargetaction-maxcapacity + MaxCapacity int `json:"MaxCapacity,omitempty"` + + // MinCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scalabletargetaction.html#cfn-applicationautoscaling-scalabletarget-scalabletargetaction-mincapacity + MinCapacity int `json:"MinCapacity,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalableTarget_ScalableTargetAction) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalableTarget.ScalableTargetAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalableTarget_ScalableTargetAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget_scheduledaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget_scheduledaction.go new file mode 100644 index 000000000000..97b37d3bea82 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalabletarget_scheduledaction.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSApplicationAutoScalingScalableTarget_ScheduledAction AWS CloudFormation Resource (AWS::ApplicationAutoScaling::ScalableTarget.ScheduledAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html +type AWSApplicationAutoScalingScalableTarget_ScheduledAction struct { + + // EndTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html#cfn-applicationautoscaling-scalabletarget-scheduledaction-endtime + EndTime string `json:"EndTime,omitempty"` + + // ScalableTargetAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html#cfn-applicationautoscaling-scalabletarget-scheduledaction-scalabletargetaction + ScalableTargetAction *AWSApplicationAutoScalingScalableTarget_ScalableTargetAction `json:"ScalableTargetAction,omitempty"` + + // Schedule AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html#cfn-applicationautoscaling-scalabletarget-scheduledaction-schedule + Schedule string `json:"Schedule,omitempty"` + + // ScheduledActionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html#cfn-applicationautoscaling-scalabletarget-scheduledaction-scheduledactionname + ScheduledActionName string `json:"ScheduledActionName,omitempty"` + + // StartTime AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalabletarget-scheduledaction.html#cfn-applicationautoscaling-scalabletarget-scheduledaction-starttime + StartTime string `json:"StartTime,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalableTarget_ScheduledAction) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalableTarget.ScheduledAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalableTarget_ScheduledAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..845cdad65dcf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy.go @@ -0,0 +1,156 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4da7cbd3dfa4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_customizedmetricspecification.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.CustomizedMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_CustomizedMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..383c8e1f6e1a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_metricdimension.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_MetricDimension) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.MetricDimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_MetricDimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5f67c539b58e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_predefinedmetricspecification.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.PredefinedMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_PredefinedMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9b8ca6d72b93 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepadjustment.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.StepAdjustment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_StepAdjustment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d509c3e8bf45 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_stepscalingpolicyconfiguration.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.StepScalingPolicyConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_StepScalingPolicyConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0a72ef33235b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-applicationautoscaling-scalingpolicy_targettrackingscalingpolicyconfiguration.go @@ -0,0 +1,50 @@ +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"` + + // DisableScaleIn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration.html#cfn-applicationautoscaling-scalingpolicy-targettrackingscalingpolicyconfiguration-disablescalein + DisableScaleIn bool `json:"DisableScaleIn,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::ApplicationAutoScaling::ScalingPolicy.TargetTrackingScalingPolicyConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSApplicationAutoScalingScalingPolicy_TargetTrackingScalingPolicyConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-apikey.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-apikey.go new file mode 100644 index 000000000000..52acf0c984bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-apikey.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAppSyncApiKey AWS CloudFormation Resource (AWS::AppSync::ApiKey) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-apikey.html +type AWSAppSyncApiKey struct { + + // ApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-apikey.html#cfn-appsync-apikey-apiid + ApiId string `json:"ApiId,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-apikey.html#cfn-appsync-apikey-description + Description string `json:"Description,omitempty"` + + // Expires AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-apikey.html#cfn-appsync-apikey-expires + Expires float64 `json:"Expires,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncApiKey) AWSCloudFormationType() string { + return "AWS::AppSync::ApiKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncApiKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAppSyncApiKey) MarshalJSON() ([]byte, error) { + type Properties AWSAppSyncApiKey + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAppSyncApiKey) UnmarshalJSON(b []byte) error { + type Properties AWSAppSyncApiKey + 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 = AWSAppSyncApiKey(*res.Properties) + } + + return nil +} + +// GetAllAWSAppSyncApiKeyResources retrieves all AWSAppSyncApiKey items from an AWS CloudFormation template +func (t *Template) GetAllAWSAppSyncApiKeyResources() map[string]AWSAppSyncApiKey { + results := map[string]AWSAppSyncApiKey{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAppSyncApiKey: + // 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::AppSync::ApiKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncApiKey + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAppSyncApiKeyWithName retrieves all AWSAppSyncApiKey items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAppSyncApiKeyWithName(name string) (AWSAppSyncApiKey, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAppSyncApiKey: + // 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::AppSync::ApiKey" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncApiKey + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAppSyncApiKey{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource.go new file mode 100644 index 000000000000..6bb8e659c94d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource.go @@ -0,0 +1,161 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAppSyncDataSource AWS CloudFormation Resource (AWS::AppSync::DataSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html +type AWSAppSyncDataSource struct { + + // ApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-apiid + ApiId string `json:"ApiId,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-description + Description string `json:"Description,omitempty"` + + // DynamoDBConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-dynamodbconfig + DynamoDBConfig *AWSAppSyncDataSource_DynamoDBConfig `json:"DynamoDBConfig,omitempty"` + + // ElasticsearchConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-elasticsearchconfig + ElasticsearchConfig *AWSAppSyncDataSource_ElasticsearchConfig `json:"ElasticsearchConfig,omitempty"` + + // HttpConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-httpconfig + HttpConfig *AWSAppSyncDataSource_HttpConfig `json:"HttpConfig,omitempty"` + + // LambdaConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-lambdaconfig + LambdaConfig *AWSAppSyncDataSource_LambdaConfig `json:"LambdaConfig,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-name + Name string `json:"Name,omitempty"` + + // ServiceRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-servicerolearn + ServiceRoleArn string `json:"ServiceRoleArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-datasource.html#cfn-appsync-datasource-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncDataSource) AWSCloudFormationType() string { + return "AWS::AppSync::DataSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncDataSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAppSyncDataSource) MarshalJSON() ([]byte, error) { + type Properties AWSAppSyncDataSource + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAppSyncDataSource) UnmarshalJSON(b []byte) error { + type Properties AWSAppSyncDataSource + 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 = AWSAppSyncDataSource(*res.Properties) + } + + return nil +} + +// GetAllAWSAppSyncDataSourceResources retrieves all AWSAppSyncDataSource items from an AWS CloudFormation template +func (t *Template) GetAllAWSAppSyncDataSourceResources() map[string]AWSAppSyncDataSource { + results := map[string]AWSAppSyncDataSource{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAppSyncDataSource: + // 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::AppSync::DataSource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncDataSource + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAppSyncDataSourceWithName retrieves all AWSAppSyncDataSource items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAppSyncDataSourceWithName(name string) (AWSAppSyncDataSource, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAppSyncDataSource: + // 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::AppSync::DataSource" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncDataSource + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAppSyncDataSource{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_dynamodbconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_dynamodbconfig.go new file mode 100644 index 000000000000..c5c3a07c0ecd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_dynamodbconfig.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSAppSyncDataSource_DynamoDBConfig AWS CloudFormation Resource (AWS::AppSync::DataSource.DynamoDBConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-dynamodbconfig.html +type AWSAppSyncDataSource_DynamoDBConfig struct { + + // AwsRegion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-dynamodbconfig.html#cfn-appsync-datasource-dynamodbconfig-awsregion + AwsRegion string `json:"AwsRegion,omitempty"` + + // TableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-dynamodbconfig.html#cfn-appsync-datasource-dynamodbconfig-tablename + TableName string `json:"TableName,omitempty"` + + // UseCallerCredentials AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-dynamodbconfig.html#cfn-appsync-datasource-dynamodbconfig-usecallercredentials + UseCallerCredentials bool `json:"UseCallerCredentials,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncDataSource_DynamoDBConfig) AWSCloudFormationType() string { + return "AWS::AppSync::DataSource.DynamoDBConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncDataSource_DynamoDBConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_elasticsearchconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_elasticsearchconfig.go new file mode 100644 index 000000000000..3395aa8b51f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_elasticsearchconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAppSyncDataSource_ElasticsearchConfig AWS CloudFormation Resource (AWS::AppSync::DataSource.ElasticsearchConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-elasticsearchconfig.html +type AWSAppSyncDataSource_ElasticsearchConfig struct { + + // AwsRegion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-elasticsearchconfig.html#cfn-appsync-datasource-elasticsearchconfig-awsregion + AwsRegion string `json:"AwsRegion,omitempty"` + + // Endpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-elasticsearchconfig.html#cfn-appsync-datasource-elasticsearchconfig-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncDataSource_ElasticsearchConfig) AWSCloudFormationType() string { + return "AWS::AppSync::DataSource.ElasticsearchConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncDataSource_ElasticsearchConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_httpconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_httpconfig.go new file mode 100644 index 000000000000..0e1cf205eeb1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_httpconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSAppSyncDataSource_HttpConfig AWS CloudFormation Resource (AWS::AppSync::DataSource.HttpConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-httpconfig.html +type AWSAppSyncDataSource_HttpConfig struct { + + // Endpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-httpconfig.html#cfn-appsync-datasource-httpconfig-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncDataSource_HttpConfig) AWSCloudFormationType() string { + return "AWS::AppSync::DataSource.HttpConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncDataSource_HttpConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_lambdaconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_lambdaconfig.go new file mode 100644 index 000000000000..8d38036c212a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-datasource_lambdaconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSAppSyncDataSource_LambdaConfig AWS CloudFormation Resource (AWS::AppSync::DataSource.LambdaConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-lambdaconfig.html +type AWSAppSyncDataSource_LambdaConfig struct { + + // LambdaFunctionArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-datasource-lambdaconfig.html#cfn-appsync-datasource-lambdaconfig-lambdafunctionarn + LambdaFunctionArn string `json:"LambdaFunctionArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncDataSource_LambdaConfig) AWSCloudFormationType() string { + return "AWS::AppSync::DataSource.LambdaConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncDataSource_LambdaConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi.go new file mode 100644 index 000000000000..29706cf108d2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAppSyncGraphQLApi AWS CloudFormation Resource (AWS::AppSync::GraphQLApi) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html +type AWSAppSyncGraphQLApi struct { + + // AuthenticationType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-authenticationtype + AuthenticationType string `json:"AuthenticationType,omitempty"` + + // LogConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-logconfig + LogConfig *AWSAppSyncGraphQLApi_LogConfig `json:"LogConfig,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-name + Name string `json:"Name,omitempty"` + + // OpenIDConnectConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-openidconnectconfig + OpenIDConnectConfig *AWSAppSyncGraphQLApi_OpenIDConnectConfig `json:"OpenIDConnectConfig,omitempty"` + + // UserPoolConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-userpoolconfig + UserPoolConfig *AWSAppSyncGraphQLApi_UserPoolConfig `json:"UserPoolConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncGraphQLApi) AWSCloudFormationType() string { + return "AWS::AppSync::GraphQLApi" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncGraphQLApi) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAppSyncGraphQLApi) MarshalJSON() ([]byte, error) { + type Properties AWSAppSyncGraphQLApi + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAppSyncGraphQLApi) UnmarshalJSON(b []byte) error { + type Properties AWSAppSyncGraphQLApi + 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 = AWSAppSyncGraphQLApi(*res.Properties) + } + + return nil +} + +// GetAllAWSAppSyncGraphQLApiResources retrieves all AWSAppSyncGraphQLApi items from an AWS CloudFormation template +func (t *Template) GetAllAWSAppSyncGraphQLApiResources() map[string]AWSAppSyncGraphQLApi { + results := map[string]AWSAppSyncGraphQLApi{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAppSyncGraphQLApi: + // 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::AppSync::GraphQLApi" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncGraphQLApi + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAppSyncGraphQLApiWithName retrieves all AWSAppSyncGraphQLApi items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAppSyncGraphQLApiWithName(name string) (AWSAppSyncGraphQLApi, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAppSyncGraphQLApi: + // 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::AppSync::GraphQLApi" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncGraphQLApi + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAppSyncGraphQLApi{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_logconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_logconfig.go new file mode 100644 index 000000000000..cb11625a0498 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_logconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAppSyncGraphQLApi_LogConfig AWS CloudFormation Resource (AWS::AppSync::GraphQLApi.LogConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-logconfig.html +type AWSAppSyncGraphQLApi_LogConfig struct { + + // CloudWatchLogsRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-logconfig.html#cfn-appsync-graphqlapi-logconfig-cloudwatchlogsrolearn + CloudWatchLogsRoleArn string `json:"CloudWatchLogsRoleArn,omitempty"` + + // FieldLogLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-logconfig.html#cfn-appsync-graphqlapi-logconfig-fieldloglevel + FieldLogLevel string `json:"FieldLogLevel,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncGraphQLApi_LogConfig) AWSCloudFormationType() string { + return "AWS::AppSync::GraphQLApi.LogConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncGraphQLApi_LogConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_openidconnectconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_openidconnectconfig.go new file mode 100644 index 000000000000..1f9fe3c49350 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_openidconnectconfig.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSAppSyncGraphQLApi_OpenIDConnectConfig AWS CloudFormation Resource (AWS::AppSync::GraphQLApi.OpenIDConnectConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-openidconnectconfig.html +type AWSAppSyncGraphQLApi_OpenIDConnectConfig struct { + + // AuthTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-openidconnectconfig.html#cfn-appsync-graphqlapi-openidconnectconfig-authttl + AuthTTL float64 `json:"AuthTTL,omitempty"` + + // ClientId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-openidconnectconfig.html#cfn-appsync-graphqlapi-openidconnectconfig-clientid + ClientId string `json:"ClientId,omitempty"` + + // IatTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-openidconnectconfig.html#cfn-appsync-graphqlapi-openidconnectconfig-iatttl + IatTTL float64 `json:"IatTTL,omitempty"` + + // Issuer AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-openidconnectconfig.html#cfn-appsync-graphqlapi-openidconnectconfig-issuer + Issuer string `json:"Issuer,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncGraphQLApi_OpenIDConnectConfig) AWSCloudFormationType() string { + return "AWS::AppSync::GraphQLApi.OpenIDConnectConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncGraphQLApi_OpenIDConnectConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_userpoolconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_userpoolconfig.go new file mode 100644 index 000000000000..5b3d27f5c82c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlapi_userpoolconfig.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSAppSyncGraphQLApi_UserPoolConfig AWS CloudFormation Resource (AWS::AppSync::GraphQLApi.UserPoolConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-userpoolconfig.html +type AWSAppSyncGraphQLApi_UserPoolConfig struct { + + // AppIdClientRegex AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-userpoolconfig.html#cfn-appsync-graphqlapi-userpoolconfig-appidclientregex + AppIdClientRegex string `json:"AppIdClientRegex,omitempty"` + + // AwsRegion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-userpoolconfig.html#cfn-appsync-graphqlapi-userpoolconfig-awsregion + AwsRegion string `json:"AwsRegion,omitempty"` + + // DefaultAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-userpoolconfig.html#cfn-appsync-graphqlapi-userpoolconfig-defaultaction + DefaultAction string `json:"DefaultAction,omitempty"` + + // UserPoolId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appsync-graphqlapi-userpoolconfig.html#cfn-appsync-graphqlapi-userpoolconfig-userpoolid + UserPoolId string `json:"UserPoolId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncGraphQLApi_UserPoolConfig) AWSCloudFormationType() string { + return "AWS::AppSync::GraphQLApi.UserPoolConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncGraphQLApi_UserPoolConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlschema.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlschema.go new file mode 100644 index 000000000000..3cce3551eb03 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-graphqlschema.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAppSyncGraphQLSchema AWS CloudFormation Resource (AWS::AppSync::GraphQLSchema) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlschema.html +type AWSAppSyncGraphQLSchema struct { + + // ApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlschema.html#cfn-appsync-graphqlschema-apiid + ApiId string `json:"ApiId,omitempty"` + + // Definition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlschema.html#cfn-appsync-graphqlschema-definition + Definition string `json:"Definition,omitempty"` + + // DefinitionS3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlschema.html#cfn-appsync-graphqlschema-definitions3location + DefinitionS3Location string `json:"DefinitionS3Location,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncGraphQLSchema) AWSCloudFormationType() string { + return "AWS::AppSync::GraphQLSchema" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncGraphQLSchema) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAppSyncGraphQLSchema) MarshalJSON() ([]byte, error) { + type Properties AWSAppSyncGraphQLSchema + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAppSyncGraphQLSchema) UnmarshalJSON(b []byte) error { + type Properties AWSAppSyncGraphQLSchema + 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 = AWSAppSyncGraphQLSchema(*res.Properties) + } + + return nil +} + +// GetAllAWSAppSyncGraphQLSchemaResources retrieves all AWSAppSyncGraphQLSchema items from an AWS CloudFormation template +func (t *Template) GetAllAWSAppSyncGraphQLSchemaResources() map[string]AWSAppSyncGraphQLSchema { + results := map[string]AWSAppSyncGraphQLSchema{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAppSyncGraphQLSchema: + // 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::AppSync::GraphQLSchema" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncGraphQLSchema + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAppSyncGraphQLSchemaWithName retrieves all AWSAppSyncGraphQLSchema items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAppSyncGraphQLSchemaWithName(name string) (AWSAppSyncGraphQLSchema, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAppSyncGraphQLSchema: + // 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::AppSync::GraphQLSchema" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncGraphQLSchema + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAppSyncGraphQLSchema{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-resolver.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-resolver.go new file mode 100644 index 000000000000..d4c1beb7c440 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-appsync-resolver.go @@ -0,0 +1,156 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAppSyncResolver AWS CloudFormation Resource (AWS::AppSync::Resolver) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html +type AWSAppSyncResolver struct { + + // ApiId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-apiid + ApiId string `json:"ApiId,omitempty"` + + // DataSourceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-datasourcename + DataSourceName string `json:"DataSourceName,omitempty"` + + // FieldName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-fieldname + FieldName string `json:"FieldName,omitempty"` + + // RequestMappingTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-requestmappingtemplate + RequestMappingTemplate string `json:"RequestMappingTemplate,omitempty"` + + // RequestMappingTemplateS3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-requestmappingtemplates3location + RequestMappingTemplateS3Location string `json:"RequestMappingTemplateS3Location,omitempty"` + + // ResponseMappingTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-responsemappingtemplate + ResponseMappingTemplate string `json:"ResponseMappingTemplate,omitempty"` + + // ResponseMappingTemplateS3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-responsemappingtemplates3location + ResponseMappingTemplateS3Location string `json:"ResponseMappingTemplateS3Location,omitempty"` + + // TypeName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-resolver.html#cfn-appsync-resolver-typename + TypeName string `json:"TypeName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAppSyncResolver) AWSCloudFormationType() string { + return "AWS::AppSync::Resolver" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAppSyncResolver) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAppSyncResolver) MarshalJSON() ([]byte, error) { + type Properties AWSAppSyncResolver + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAppSyncResolver) UnmarshalJSON(b []byte) error { + type Properties AWSAppSyncResolver + 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 = AWSAppSyncResolver(*res.Properties) + } + + return nil +} + +// GetAllAWSAppSyncResolverResources retrieves all AWSAppSyncResolver items from an AWS CloudFormation template +func (t *Template) GetAllAWSAppSyncResolverResources() map[string]AWSAppSyncResolver { + results := map[string]AWSAppSyncResolver{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAppSyncResolver: + // 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::AppSync::Resolver" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncResolver + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAppSyncResolverWithName retrieves all AWSAppSyncResolver items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAppSyncResolverWithName(name string) (AWSAppSyncResolver, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAppSyncResolver: + // 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::AppSync::Resolver" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAppSyncResolver + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAppSyncResolver{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-athena-namedquery.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-athena-namedquery.go new file mode 100644 index 000000000000..b5f5626439f8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-athena-namedquery.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAthenaNamedQuery AWS CloudFormation Resource (AWS::Athena::NamedQuery) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html +type AWSAthenaNamedQuery struct { + + // Database AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html#cfn-athena-namedquery-database + Database string `json:"Database,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html#cfn-athena-namedquery-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html#cfn-athena-namedquery-name + Name string `json:"Name,omitempty"` + + // QueryString AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-athena-namedquery.html#cfn-athena-namedquery-querystring + QueryString string `json:"QueryString,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAthenaNamedQuery) AWSCloudFormationType() string { + return "AWS::Athena::NamedQuery" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAthenaNamedQuery) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAthenaNamedQuery) MarshalJSON() ([]byte, error) { + type Properties AWSAthenaNamedQuery + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAthenaNamedQuery) UnmarshalJSON(b []byte) error { + type Properties AWSAthenaNamedQuery + 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 = AWSAthenaNamedQuery(*res.Properties) + } + + return nil +} + +// GetAllAWSAthenaNamedQueryResources retrieves all AWSAthenaNamedQuery items from an AWS CloudFormation template +func (t *Template) GetAllAWSAthenaNamedQueryResources() map[string]AWSAthenaNamedQuery { + results := map[string]AWSAthenaNamedQuery{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAthenaNamedQuery: + // 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::Athena::NamedQuery" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAthenaNamedQuery + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAthenaNamedQueryWithName retrieves all AWSAthenaNamedQuery items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAthenaNamedQueryWithName(name string) (AWSAthenaNamedQuery, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAthenaNamedQuery: + // 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::Athena::NamedQuery" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAthenaNamedQuery + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAthenaNamedQuery{}, errors.New("resource not found") +} 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 000000000000..b07bb7050f06 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup.go @@ -0,0 +1,243 @@ +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 { + + // AutoScalingGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-autoscaling-autoscalinggroup-autoscalinggroupname + AutoScalingGroupName string `json:"AutoScalingGroupName,omitempty"` + + // 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"` + + // LaunchTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-launchtemplate + LaunchTemplate *AWSAutoScalingAutoScalingGroup_LaunchTemplateSpecification `json:"LaunchTemplate,omitempty"` + + // LifecycleHookSpecificationList AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecificationlist + LifecycleHookSpecificationList []AWSAutoScalingAutoScalingGroup_LifecycleHookSpecification `json:"LifecycleHookSpecificationList,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"` + + // ServiceLinkedRoleARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-autoscaling-autoscalinggroup-servicelinkedrolearn + ServiceLinkedRoleARN string `json:"ServiceLinkedRoleARN,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"` + + // _updatePolicy represents a CloudFormation UpdatePolicy + _updatePolicy *UpdatePolicy + + // _creationPolicy represents a CloudFormation CreationPolicy + _creationPolicy *CreationPolicy + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// SetUpdatePolicy applies an AWS CloudFormation UpdatePolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html +func (r *AWSAutoScalingAutoScalingGroup) SetUpdatePolicy(policy *UpdatePolicy) { + r._updatePolicy = policy +} + +// SetCreationPolicy applies an AWS CloudFormation CreationPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html +func (r *AWSAutoScalingAutoScalingGroup) SetCreationPolicy(policy *CreationPolicy) { + r._creationPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + UpdatePolicy *UpdatePolicy `json:"UpdatePolicy,omitempty"` + CreationPolicy *CreationPolicy `json:"CreationPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + UpdatePolicy: r._updatePolicy, + CreationPolicy: r._creationPolicy, + }) +} + +// 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_launchtemplatespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_launchtemplatespecification.go new file mode 100644 index 000000000000..ee275a7ba2ea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_launchtemplatespecification.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSAutoScalingAutoScalingGroup_LaunchTemplateSpecification AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup.LaunchTemplateSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplatespecification.html +type AWSAutoScalingAutoScalingGroup_LaunchTemplateSpecification struct { + + // LaunchTemplateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplatespecification.html#cfn-autoscaling-autoscalinggroup-launchtemplatespecification-launchtemplateid + LaunchTemplateId string `json:"LaunchTemplateId,omitempty"` + + // LaunchTemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplatespecification.html#cfn-autoscaling-autoscalinggroup-launchtemplatespecification-launchtemplatename + LaunchTemplateName string `json:"LaunchTemplateName,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplatespecification.html#cfn-autoscaling-autoscalinggroup-launchtemplatespecification-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_LaunchTemplateSpecification) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.LaunchTemplateSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup_LaunchTemplateSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_lifecyclehookspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_lifecyclehookspecification.go new file mode 100644 index 000000000000..af8e71b2436b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_lifecyclehookspecification.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSAutoScalingAutoScalingGroup_LifecycleHookSpecification AWS CloudFormation Resource (AWS::AutoScaling::AutoScalingGroup.LifecycleHookSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html +type AWSAutoScalingAutoScalingGroup_LifecycleHookSpecification struct { + + // DefaultResult AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-defaultresult + DefaultResult string `json:"DefaultResult,omitempty"` + + // HeartbeatTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-heartbeattimeout + HeartbeatTimeout int `json:"HeartbeatTimeout,omitempty"` + + // LifecycleHookName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-lifecyclehookname + LifecycleHookName string `json:"LifecycleHookName,omitempty"` + + // LifecycleTransition AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-lifecycletransition + LifecycleTransition string `json:"LifecycleTransition,omitempty"` + + // NotificationMetadata AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-notificationmetadata + NotificationMetadata string `json:"NotificationMetadata,omitempty"` + + // NotificationTargetARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-notificationtargetarn + NotificationTargetARN string `json:"NotificationTargetARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-lifecyclehookspecification.html#cfn-autoscaling-autoscalinggroup-lifecyclehookspecification-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_LifecycleHookSpecification) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.LifecycleHookSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup_LifecycleHookSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0060f1148af1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_metricscollection.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_MetricsCollection) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.MetricsCollection" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup_MetricsCollection) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7c3379cf2571 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_notificationconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_NotificationConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.NotificationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup_NotificationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6092519a72c2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-autoscalinggroup_tagproperty.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingAutoScalingGroup_TagProperty) AWSCloudFormationType() string { + return "AWS::AutoScaling::AutoScalingGroup.TagProperty" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingAutoScalingGroup_TagProperty) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..02cfac500460 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration.go @@ -0,0 +1,206 @@ +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"` + + // LaunchConfigurationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html#cfn-autoscaling-launchconfig-launchconfigurationname + LaunchConfigurationName string `json:"LaunchConfigurationName,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingLaunchConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5cd7d5f8cd7d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevice.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration_BlockDevice) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration.BlockDevice" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingLaunchConfiguration_BlockDevice) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..77d1a7aee9db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-launchconfiguration_blockdevicemapping.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLaunchConfiguration_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::AutoScaling::LaunchConfiguration.BlockDeviceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingLaunchConfiguration_BlockDeviceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e35e813a9a84 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-lifecyclehook.go @@ -0,0 +1,156 @@ +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"` + + // LifecycleHookName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#cfn-autoscaling-lifecyclehook-lifecyclehookname + LifecycleHookName string `json:"LifecycleHookName,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingLifecycleHook) AWSCloudFormationType() string { + return "AWS::AutoScaling::LifecycleHook" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingLifecycleHook) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f546053aee38 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy.go @@ -0,0 +1,166 @@ +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: false + // 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"` + + // TargetTrackingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration + TargetTrackingConfiguration *AWSAutoScalingScalingPolicy_TargetTrackingConfiguration `json:"TargetTrackingConfiguration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_customizedmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_customizedmetricspecification.go new file mode 100644 index 000000000000..d43f685abac0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_customizedmetricspecification.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSAutoScalingScalingPolicy_CustomizedMetricSpecification AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy.CustomizedMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html +type AWSAutoScalingScalingPolicy_CustomizedMetricSpecification struct { + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-dimensions + Dimensions []AWSAutoScalingScalingPolicy_MetricDimension `json:"Dimensions,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-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-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-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-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-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-autoscaling-scalingpolicy-customizedmetricspecification.html#cfn-autoscaling-scalingpolicy-customizedmetricspecification-unit + Unit string `json:"Unit,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_CustomizedMetricSpecification) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.CustomizedMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy_CustomizedMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_metricdimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_metricdimension.go new file mode 100644 index 000000000000..9e9e5be66f33 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_metricdimension.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingScalingPolicy_MetricDimension AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy.MetricDimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html +type AWSAutoScalingScalingPolicy_MetricDimension struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdimension.html#cfn-autoscaling-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-autoscaling-scalingpolicy-metricdimension.html#cfn-autoscaling-scalingpolicy-metricdimension-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_MetricDimension) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.MetricDimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy_MetricDimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_predefinedmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_predefinedmetricspecification.go new file mode 100644 index 000000000000..27317930b550 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_predefinedmetricspecification.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingScalingPolicy_PredefinedMetricSpecification AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy.PredefinedMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predefinedmetricspecification.html +type AWSAutoScalingScalingPolicy_PredefinedMetricSpecification struct { + + // PredefinedMetricType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-autoscaling-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-autoscaling-scalingpolicy-predefinedmetricspecification.html#cfn-autoscaling-scalingpolicy-predefinedmetricspecification-resourcelabel + ResourceLabel string `json:"ResourceLabel,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_PredefinedMetricSpecification) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.PredefinedMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy_PredefinedMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a60a7737de2e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_stepadjustment.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_StepAdjustment) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.StepAdjustment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy_StepAdjustment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_targettrackingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_targettrackingconfiguration.go new file mode 100644 index 000000000000..031834b763eb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scalingpolicy_targettrackingconfiguration.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSAutoScalingScalingPolicy_TargetTrackingConfiguration AWS CloudFormation Resource (AWS::AutoScaling::ScalingPolicy.TargetTrackingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html +type AWSAutoScalingScalingPolicy_TargetTrackingConfiguration struct { + + // CustomizedMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-customizedmetricspecification + CustomizedMetricSpecification *AWSAutoScalingScalingPolicy_CustomizedMetricSpecification `json:"CustomizedMetricSpecification,omitempty"` + + // DisableScaleIn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-disablescalein + DisableScaleIn bool `json:"DisableScaleIn,omitempty"` + + // PredefinedMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-predefinedmetricspecification + PredefinedMetricSpecification *AWSAutoScalingScalingPolicy_PredefinedMetricSpecification `json:"PredefinedMetricSpecification,omitempty"` + + // TargetValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration-targetvalue + TargetValue float64 `json:"TargetValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScalingPolicy_TargetTrackingConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScalingPolicy.TargetTrackingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScalingPolicy_TargetTrackingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..31b8e1ea6625 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscaling-scheduledaction.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingScheduledAction) AWSCloudFormationType() string { + return "AWS::AutoScaling::ScheduledAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingScheduledAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-autoscalingplans-scalingplan.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan.go new file mode 100644 index 000000000000..bd6cc3453e42 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSAutoScalingPlansScalingPlan AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscalingplans-scalingplan.html +type AWSAutoScalingPlansScalingPlan struct { + + // ApplicationSource AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscalingplans-scalingplan.html#cfn-autoscalingplans-scalingplan-applicationsource + ApplicationSource *AWSAutoScalingPlansScalingPlan_ApplicationSource `json:"ApplicationSource,omitempty"` + + // ScalingInstructions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscalingplans-scalingplan.html#cfn-autoscalingplans-scalingplan-scalinginstructions + ScalingInstructions []AWSAutoScalingPlansScalingPlan_ScalingInstruction `json:"ScalingInstructions,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSAutoScalingPlansScalingPlan) MarshalJSON() ([]byte, error) { + type Properties AWSAutoScalingPlansScalingPlan + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSAutoScalingPlansScalingPlan) UnmarshalJSON(b []byte) error { + type Properties AWSAutoScalingPlansScalingPlan + 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 = AWSAutoScalingPlansScalingPlan(*res.Properties) + } + + return nil +} + +// GetAllAWSAutoScalingPlansScalingPlanResources retrieves all AWSAutoScalingPlansScalingPlan items from an AWS CloudFormation template +func (t *Template) GetAllAWSAutoScalingPlansScalingPlanResources() map[string]AWSAutoScalingPlansScalingPlan { + results := map[string]AWSAutoScalingPlansScalingPlan{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSAutoScalingPlansScalingPlan: + // 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::AutoScalingPlans::ScalingPlan" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingPlansScalingPlan + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSAutoScalingPlansScalingPlanWithName retrieves all AWSAutoScalingPlansScalingPlan items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSAutoScalingPlansScalingPlanWithName(name string) (AWSAutoScalingPlansScalingPlan, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSAutoScalingPlansScalingPlan: + // 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::AutoScalingPlans::ScalingPlan" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSAutoScalingPlansScalingPlan + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSAutoScalingPlansScalingPlan{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_applicationsource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_applicationsource.go new file mode 100644 index 000000000000..3ff4b7fb3a75 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_applicationsource.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_ApplicationSource AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.ApplicationSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-applicationsource.html +type AWSAutoScalingPlansScalingPlan_ApplicationSource struct { + + // CloudFormationStackARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-applicationsource.html#cfn-autoscalingplans-scalingplan-applicationsource-cloudformationstackarn + CloudFormationStackARN string `json:"CloudFormationStackARN,omitempty"` + + // TagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-applicationsource.html#cfn-autoscalingplans-scalingplan-applicationsource-tagfilters + TagFilters []AWSAutoScalingPlansScalingPlan_TagFilter `json:"TagFilters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_ApplicationSource) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.ApplicationSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_ApplicationSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_customizedscalingmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_customizedscalingmetricspecification.go new file mode 100644 index 000000000000..be67ff84ccf3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_customizedscalingmetricspecification.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_CustomizedScalingMetricSpecification AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.CustomizedScalingMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html +type AWSAutoScalingPlansScalingPlan_CustomizedScalingMetricSpecification struct { + + // Dimensions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-customizedscalingmetricspecification-dimensions + Dimensions []AWSAutoScalingPlansScalingPlan_MetricDimension `json:"Dimensions,omitempty"` + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-customizedscalingmetricspecification-metricname + MetricName string `json:"MetricName,omitempty"` + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-customizedscalingmetricspecification-namespace + Namespace string `json:"Namespace,omitempty"` + + // Statistic AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-customizedscalingmetricspecification-statistic + Statistic string `json:"Statistic,omitempty"` + + // Unit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-customizedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-customizedscalingmetricspecification-unit + Unit string `json:"Unit,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_CustomizedScalingMetricSpecification) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.CustomizedScalingMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_CustomizedScalingMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_metricdimension.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_metricdimension.go new file mode 100644 index 000000000000..eff50b86a266 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_metricdimension.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_MetricDimension AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.MetricDimension) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-metricdimension.html +type AWSAutoScalingPlansScalingPlan_MetricDimension struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-metricdimension.html#cfn-autoscalingplans-scalingplan-metricdimension-name + Name string `json:"Name,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-metricdimension.html#cfn-autoscalingplans-scalingplan-metricdimension-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_MetricDimension) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.MetricDimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_MetricDimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_predefinedscalingmetricspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_predefinedscalingmetricspecification.go new file mode 100644 index 000000000000..35abc92c54dd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_predefinedscalingmetricspecification.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_PredefinedScalingMetricSpecification AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.PredefinedScalingMetricSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-predefinedscalingmetricspecification.html +type AWSAutoScalingPlansScalingPlan_PredefinedScalingMetricSpecification struct { + + // PredefinedScalingMetricType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-predefinedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-predefinedscalingmetricspecification-predefinedscalingmetrictype + PredefinedScalingMetricType string `json:"PredefinedScalingMetricType,omitempty"` + + // ResourceLabel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-predefinedscalingmetricspecification.html#cfn-autoscalingplans-scalingplan-predefinedscalingmetricspecification-resourcelabel + ResourceLabel string `json:"ResourceLabel,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_PredefinedScalingMetricSpecification) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.PredefinedScalingMetricSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_PredefinedScalingMetricSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_scalinginstruction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_scalinginstruction.go new file mode 100644 index 000000000000..6bde8aae9a4d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_scalinginstruction.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_ScalingInstruction AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.ScalingInstruction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html +type AWSAutoScalingPlansScalingPlan_ScalingInstruction struct { + + // MaxCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-maxcapacity + MaxCapacity int `json:"MaxCapacity,omitempty"` + + // MinCapacity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-mincapacity + MinCapacity int `json:"MinCapacity,omitempty"` + + // ResourceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // ScalableDimension AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-scalabledimension + ScalableDimension string `json:"ScalableDimension,omitempty"` + + // ServiceNamespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-servicenamespace + ServiceNamespace string `json:"ServiceNamespace,omitempty"` + + // TargetTrackingConfigurations AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-scalinginstruction.html#cfn-autoscalingplans-scalingplan-scalinginstruction-targettrackingconfigurations + TargetTrackingConfigurations []AWSAutoScalingPlansScalingPlan_TargetTrackingConfiguration `json:"TargetTrackingConfigurations,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.ScalingInstruction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_tagfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_tagfilter.go new file mode 100644 index 000000000000..6d88895886db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_tagfilter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_TagFilter AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.TagFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-tagfilter.html +type AWSAutoScalingPlansScalingPlan_TagFilter struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-tagfilter.html#cfn-autoscalingplans-scalingplan-tagfilter-key + Key string `json:"Key,omitempty"` + + // Values AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-tagfilter.html#cfn-autoscalingplans-scalingplan-tagfilter-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_TagFilter) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.TagFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_TagFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_targettrackingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_targettrackingconfiguration.go new file mode 100644 index 000000000000..e9ba3087875b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-autoscalingplans-scalingplan_targettrackingconfiguration.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSAutoScalingPlansScalingPlan_TargetTrackingConfiguration AWS CloudFormation Resource (AWS::AutoScalingPlans::ScalingPlan.TargetTrackingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html +type AWSAutoScalingPlansScalingPlan_TargetTrackingConfiguration struct { + + // CustomizedScalingMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-customizedscalingmetricspecification + CustomizedScalingMetricSpecification *AWSAutoScalingPlansScalingPlan_CustomizedScalingMetricSpecification `json:"CustomizedScalingMetricSpecification,omitempty"` + + // DisableScaleIn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-disablescalein + DisableScaleIn bool `json:"DisableScaleIn,omitempty"` + + // EstimatedInstanceWarmup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-estimatedinstancewarmup + EstimatedInstanceWarmup int `json:"EstimatedInstanceWarmup,omitempty"` + + // PredefinedScalingMetricSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-predefinedscalingmetricspecification + PredefinedScalingMetricSpecification *AWSAutoScalingPlansScalingPlan_PredefinedScalingMetricSpecification `json:"PredefinedScalingMetricSpecification,omitempty"` + + // ScaleInCooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-scaleincooldown + ScaleInCooldown int `json:"ScaleInCooldown,omitempty"` + + // ScaleOutCooldown AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-scaleoutcooldown + ScaleOutCooldown int `json:"ScaleOutCooldown,omitempty"` + + // TargetValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscalingplans-scalingplan-targettrackingconfiguration.html#cfn-autoscalingplans-scalingplan-targettrackingconfiguration-targetvalue + TargetValue float64 `json:"TargetValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSAutoScalingPlansScalingPlan_TargetTrackingConfiguration) AWSCloudFormationType() string { + return "AWS::AutoScalingPlans::ScalingPlan.TargetTrackingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSAutoScalingPlansScalingPlan_TargetTrackingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..79c62d9156ac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment.go @@ -0,0 +1,141 @@ +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: false + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchComputeEnvironment) AWSCloudFormationType() string { + return "AWS::Batch::ComputeEnvironment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchComputeEnvironment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..60aecf5624be --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-computeenvironment_computeresources.go @@ -0,0 +1,85 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchComputeEnvironment_ComputeResources) AWSCloudFormationType() string { + return "AWS::Batch::ComputeEnvironment.ComputeResources" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchComputeEnvironment_ComputeResources) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8d4782f34d20 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition.go @@ -0,0 +1,146 @@ +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"` + + // Timeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-timeout + Timeout *AWSBatchJobDefinition_Timeout `json:"Timeout,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..455183e4b623 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_containerproperties.go @@ -0,0 +1,80 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_ContainerProperties) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.ContainerProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_ContainerProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b303dd6844c6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_environment.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Environment) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Environment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_Environment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..86d722bea173 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_mountpoints.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_MountPoints) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.MountPoints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_MountPoints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5b136b01f0cc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_retrystrategy.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_RetryStrategy) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.RetryStrategy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_RetryStrategy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_timeout.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_timeout.go new file mode 100644 index 000000000000..3f76dafa23da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_timeout.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSBatchJobDefinition_Timeout AWS CloudFormation Resource (AWS::Batch::JobDefinition.Timeout) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-timeout.html +type AWSBatchJobDefinition_Timeout struct { + + // AttemptDurationSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-timeout.html#cfn-batch-jobdefinition-timeout-attemptdurationseconds + AttemptDurationSeconds int `json:"AttemptDurationSeconds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Timeout) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Timeout" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_Timeout) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..300595b5cb7f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_ulimit.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Ulimit) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Ulimit" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_Ulimit) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..18386dd993bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumes.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_Volumes) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.Volumes" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_Volumes) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2059ea5a1aa5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobdefinition_volumeshost.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobDefinition_VolumesHost) AWSCloudFormationType() string { + return "AWS::Batch::JobDefinition.VolumesHost" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobDefinition_VolumesHost) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..62b5e63ace17 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobQueue) AWSCloudFormationType() string { + return "AWS::Batch::JobQueue" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobQueue) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..83c084170490 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-batch-jobqueue_computeenvironmentorder.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBatchJobQueue_ComputeEnvironmentOrder) AWSCloudFormationType() string { + return "AWS::Batch::JobQueue.ComputeEnvironmentOrder" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBatchJobQueue_ComputeEnvironmentOrder) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget.go new file mode 100644 index 000000000000..b44b1a695952 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSBudgetsBudget AWS CloudFormation Resource (AWS::Budgets::Budget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-budgets-budget.html +type AWSBudgetsBudget struct { + + // Budget AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-budgets-budget.html#cfn-budgets-budget-budget + Budget *AWSBudgetsBudget_BudgetData `json:"Budget,omitempty"` + + // NotificationsWithSubscribers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-budgets-budget.html#cfn-budgets-budget-notificationswithsubscribers + NotificationsWithSubscribers []AWSBudgetsBudget_NotificationWithSubscribers `json:"NotificationsWithSubscribers,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget) AWSCloudFormationType() string { + return "AWS::Budgets::Budget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSBudgetsBudget) MarshalJSON() ([]byte, error) { + type Properties AWSBudgetsBudget + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSBudgetsBudget) UnmarshalJSON(b []byte) error { + type Properties AWSBudgetsBudget + 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 = AWSBudgetsBudget(*res.Properties) + } + + return nil +} + +// GetAllAWSBudgetsBudgetResources retrieves all AWSBudgetsBudget items from an AWS CloudFormation template +func (t *Template) GetAllAWSBudgetsBudgetResources() map[string]AWSBudgetsBudget { + results := map[string]AWSBudgetsBudget{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSBudgetsBudget: + // 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::Budgets::Budget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBudgetsBudget + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSBudgetsBudgetWithName retrieves all AWSBudgetsBudget items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSBudgetsBudgetWithName(name string) (AWSBudgetsBudget, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSBudgetsBudget: + // 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::Budgets::Budget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSBudgetsBudget + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSBudgetsBudget{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_budgetdata.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_budgetdata.go new file mode 100644 index 000000000000..372a68e38d24 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_budgetdata.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSBudgetsBudget_BudgetData AWS CloudFormation Resource (AWS::Budgets::Budget.BudgetData) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html +type AWSBudgetsBudget_BudgetData struct { + + // BudgetLimit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-budgetlimit + BudgetLimit *AWSBudgetsBudget_Spend `json:"BudgetLimit,omitempty"` + + // BudgetName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-budgetname + BudgetName string `json:"BudgetName,omitempty"` + + // BudgetType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-budgettype + BudgetType string `json:"BudgetType,omitempty"` + + // CostFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-costfilters + CostFilters interface{} `json:"CostFilters,omitempty"` + + // CostTypes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-costtypes + CostTypes *AWSBudgetsBudget_CostTypes `json:"CostTypes,omitempty"` + + // TimePeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-timeperiod + TimePeriod *AWSBudgetsBudget_TimePeriod `json:"TimePeriod,omitempty"` + + // TimeUnit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-budgetdata.html#cfn-budgets-budget-budgetdata-timeunit + TimeUnit string `json:"TimeUnit,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_BudgetData) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.BudgetData" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_BudgetData) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_costtypes.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_costtypes.go new file mode 100644 index 000000000000..6bb396b873b6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_costtypes.go @@ -0,0 +1,75 @@ +package cloudformation + +// AWSBudgetsBudget_CostTypes AWS CloudFormation Resource (AWS::Budgets::Budget.CostTypes) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html +type AWSBudgetsBudget_CostTypes struct { + + // IncludeCredit AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includecredit + IncludeCredit bool `json:"IncludeCredit,omitempty"` + + // IncludeDiscount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includediscount + IncludeDiscount bool `json:"IncludeDiscount,omitempty"` + + // IncludeOtherSubscription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includeothersubscription + IncludeOtherSubscription bool `json:"IncludeOtherSubscription,omitempty"` + + // IncludeRecurring AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includerecurring + IncludeRecurring bool `json:"IncludeRecurring,omitempty"` + + // IncludeRefund AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includerefund + IncludeRefund bool `json:"IncludeRefund,omitempty"` + + // IncludeSubscription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includesubscription + IncludeSubscription bool `json:"IncludeSubscription,omitempty"` + + // IncludeSupport AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includesupport + IncludeSupport bool `json:"IncludeSupport,omitempty"` + + // IncludeTax AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includetax + IncludeTax bool `json:"IncludeTax,omitempty"` + + // IncludeUpfront AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-includeupfront + IncludeUpfront bool `json:"IncludeUpfront,omitempty"` + + // UseAmortized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-useamortized + UseAmortized bool `json:"UseAmortized,omitempty"` + + // UseBlended AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-costtypes.html#cfn-budgets-budget-costtypes-useblended + UseBlended bool `json:"UseBlended,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_CostTypes) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.CostTypes" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_CostTypes) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notification.go new file mode 100644 index 000000000000..7f6ddb777a25 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notification.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSBudgetsBudget_Notification AWS CloudFormation Resource (AWS::Budgets::Budget.Notification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notification.html +type AWSBudgetsBudget_Notification struct { + + // ComparisonOperator AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notification.html#cfn-budgets-budget-notification-comparisonoperator + ComparisonOperator string `json:"ComparisonOperator,omitempty"` + + // NotificationType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notification.html#cfn-budgets-budget-notification-notificationtype + NotificationType string `json:"NotificationType,omitempty"` + + // Threshold AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notification.html#cfn-budgets-budget-notification-threshold + Threshold float64 `json:"Threshold,omitempty"` + + // ThresholdType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notification.html#cfn-budgets-budget-notification-thresholdtype + ThresholdType string `json:"ThresholdType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_Notification) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.Notification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_Notification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notificationwithsubscribers.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notificationwithsubscribers.go new file mode 100644 index 000000000000..7f619fee8c5e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_notificationwithsubscribers.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSBudgetsBudget_NotificationWithSubscribers AWS CloudFormation Resource (AWS::Budgets::Budget.NotificationWithSubscribers) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notificationwithsubscribers.html +type AWSBudgetsBudget_NotificationWithSubscribers struct { + + // Notification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notificationwithsubscribers.html#cfn-budgets-budget-notificationwithsubscribers-notification + Notification *AWSBudgetsBudget_Notification `json:"Notification,omitempty"` + + // Subscribers AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-notificationwithsubscribers.html#cfn-budgets-budget-notificationwithsubscribers-subscribers + Subscribers []AWSBudgetsBudget_Subscriber `json:"Subscribers,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_NotificationWithSubscribers) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.NotificationWithSubscribers" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_NotificationWithSubscribers) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_spend.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_spend.go new file mode 100644 index 000000000000..7ff1fa25d9af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_spend.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSBudgetsBudget_Spend AWS CloudFormation Resource (AWS::Budgets::Budget.Spend) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-spend.html +type AWSBudgetsBudget_Spend struct { + + // Amount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-spend.html#cfn-budgets-budget-spend-amount + Amount float64 `json:"Amount,omitempty"` + + // Unit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-spend.html#cfn-budgets-budget-spend-unit + Unit string `json:"Unit,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_Spend) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.Spend" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_Spend) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_subscriber.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_subscriber.go new file mode 100644 index 000000000000..99e487745a8a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_subscriber.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSBudgetsBudget_Subscriber AWS CloudFormation Resource (AWS::Budgets::Budget.Subscriber) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-subscriber.html +type AWSBudgetsBudget_Subscriber struct { + + // Address AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-subscriber.html#cfn-budgets-budget-subscriber-address + Address string `json:"Address,omitempty"` + + // SubscriptionType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-subscriber.html#cfn-budgets-budget-subscriber-subscriptiontype + SubscriptionType string `json:"SubscriptionType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_Subscriber) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.Subscriber" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_Subscriber) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_timeperiod.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_timeperiod.go new file mode 100644 index 000000000000..114e901d0931 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-budgets-budget_timeperiod.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSBudgetsBudget_TimePeriod AWS CloudFormation Resource (AWS::Budgets::Budget.TimePeriod) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-timeperiod.html +type AWSBudgetsBudget_TimePeriod struct { + + // End AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-timeperiod.html#cfn-budgets-budget-timeperiod-end + End string `json:"End,omitempty"` + + // Start AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-budgets-budget-timeperiod.html#cfn-budgets-budget-timeperiod-start + Start string `json:"Start,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSBudgetsBudget_TimePeriod) AWSCloudFormationType() string { + return "AWS::Budgets::Budget.TimePeriod" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSBudgetsBudget_TimePeriod) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..cfbe7795b227 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate.go @@ -0,0 +1,141 @@ +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"` + + // ValidationMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-certificatemanager-certificate.html#cfn-certificatemanager-certificate-validationmethod + ValidationMethod string `json:"ValidationMethod,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCertificateManagerCertificate) AWSCloudFormationType() string { + return "AWS::CertificateManager::Certificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCertificateManagerCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..235e1ff40e11 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-certificatemanager-certificate_domainvalidationoption.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCertificateManagerCertificate_DomainValidationOption) AWSCloudFormationType() string { + return "AWS::CertificateManager::Certificate.DomainValidationOption" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCertificateManagerCertificate_DomainValidationOption) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2.go new file mode 100644 index 000000000000..ddd09b63192b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2.go @@ -0,0 +1,151 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloud9EnvironmentEC2 AWS CloudFormation Resource (AWS::Cloud9::EnvironmentEC2) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html +type AWSCloud9EnvironmentEC2 struct { + + // AutomaticStopTimeMinutes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-automaticstoptimeminutes + AutomaticStopTimeMinutes int `json:"AutomaticStopTimeMinutes,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-description + Description string `json:"Description,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-name + Name string `json:"Name,omitempty"` + + // OwnerArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-ownerarn + OwnerArn string `json:"OwnerArn,omitempty"` + + // Repositories AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-repositories + Repositories []AWSCloud9EnvironmentEC2_Repository `json:"Repositories,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloud9-environmentec2.html#cfn-cloud9-environmentec2-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloud9EnvironmentEC2) AWSCloudFormationType() string { + return "AWS::Cloud9::EnvironmentEC2" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloud9EnvironmentEC2) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSCloud9EnvironmentEC2) MarshalJSON() ([]byte, error) { + type Properties AWSCloud9EnvironmentEC2 + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloud9EnvironmentEC2) UnmarshalJSON(b []byte) error { + type Properties AWSCloud9EnvironmentEC2 + 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 = AWSCloud9EnvironmentEC2(*res.Properties) + } + + return nil +} + +// GetAllAWSCloud9EnvironmentEC2Resources retrieves all AWSCloud9EnvironmentEC2 items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloud9EnvironmentEC2Resources() map[string]AWSCloud9EnvironmentEC2 { + results := map[string]AWSCloud9EnvironmentEC2{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloud9EnvironmentEC2: + // 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::Cloud9::EnvironmentEC2" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloud9EnvironmentEC2 + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloud9EnvironmentEC2WithName retrieves all AWSCloud9EnvironmentEC2 items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloud9EnvironmentEC2WithName(name string) (AWSCloud9EnvironmentEC2, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloud9EnvironmentEC2: + // 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::Cloud9::EnvironmentEC2" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloud9EnvironmentEC2 + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloud9EnvironmentEC2{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2_repository.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2_repository.go new file mode 100644 index 000000000000..fd0565eb2e43 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloud9-environmentec2_repository.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloud9EnvironmentEC2_Repository AWS CloudFormation Resource (AWS::Cloud9::EnvironmentEC2.Repository) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloud9-environmentec2-repository.html +type AWSCloud9EnvironmentEC2_Repository struct { + + // PathComponent AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloud9-environmentec2-repository.html#cfn-cloud9-environmentec2-repository-pathcomponent + PathComponent string `json:"PathComponent,omitempty"` + + // RepositoryUrl AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloud9-environmentec2-repository.html#cfn-cloud9-environmentec2-repository-repositoryurl + RepositoryUrl string `json:"RepositoryUrl,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloud9EnvironmentEC2_Repository) AWSCloudFormationType() string { + return "AWS::Cloud9::EnvironmentEC2.Repository" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloud9EnvironmentEC2_Repository) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3b0c57435ff1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-customresource.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationCustomResource) AWSCloudFormationType() string { + return "AWS::CloudFormation::CustomResource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFormationCustomResource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..41c09c85ad4c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-stack.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationStack) AWSCloudFormationType() string { + return "AWS::CloudFormation::Stack" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFormationStack) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6a8978d06ddb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitcondition.go @@ -0,0 +1,144 @@ +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"` + + // _creationPolicy represents a CloudFormation CreationPolicy + _creationPolicy *CreationPolicy + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationWaitCondition) AWSCloudFormationType() string { + return "AWS::CloudFormation::WaitCondition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFormationWaitCondition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// SetCreationPolicy applies an AWS CloudFormation CreationPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html +func (r *AWSCloudFormationWaitCondition) SetCreationPolicy(policy *CreationPolicy) { + r._creationPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + + CreationPolicy *CreationPolicy `json:"CreationPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + + CreationPolicy: r._creationPolicy, + }) +} + +// 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 000000000000..c7cf37946fd9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudformation-waitconditionhandle.go @@ -0,0 +1,116 @@ +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 { + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFormationWaitConditionHandle) AWSCloudFormationType() string { + return "AWS::CloudFormation::WaitConditionHandle" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFormationWaitConditionHandle) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-cloudfrontoriginaccessidentity.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity.go new file mode 100644 index 000000000000..71cacc0f40a6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFrontCloudFrontOriginAccessIdentity AWS CloudFormation Resource (AWS::CloudFront::CloudFrontOriginAccessIdentity) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-cloudfrontoriginaccessidentity.html +type AWSCloudFrontCloudFrontOriginAccessIdentity struct { + + // CloudFrontOriginAccessIdentityConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-cloudfrontoriginaccessidentity.html#cfn-cloudfront-cloudfrontoriginaccessidentity-cloudfrontoriginaccessidentityconfig + CloudFrontOriginAccessIdentityConfig *AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig `json:"CloudFrontOriginAccessIdentityConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontCloudFrontOriginAccessIdentity) AWSCloudFormationType() string { + return "AWS::CloudFront::CloudFrontOriginAccessIdentity" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontCloudFrontOriginAccessIdentity) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSCloudFrontCloudFrontOriginAccessIdentity) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFrontCloudFrontOriginAccessIdentity + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFrontCloudFrontOriginAccessIdentity) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFrontCloudFrontOriginAccessIdentity + 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 = AWSCloudFrontCloudFrontOriginAccessIdentity(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFrontCloudFrontOriginAccessIdentityResources retrieves all AWSCloudFrontCloudFrontOriginAccessIdentity items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFrontCloudFrontOriginAccessIdentityResources() map[string]AWSCloudFrontCloudFrontOriginAccessIdentity { + results := map[string]AWSCloudFrontCloudFrontOriginAccessIdentity{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFrontCloudFrontOriginAccessIdentity: + // 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::CloudFrontOriginAccessIdentity" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontCloudFrontOriginAccessIdentity + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFrontCloudFrontOriginAccessIdentityWithName retrieves all AWSCloudFrontCloudFrontOriginAccessIdentity items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFrontCloudFrontOriginAccessIdentityWithName(name string) (AWSCloudFrontCloudFrontOriginAccessIdentity, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFrontCloudFrontOriginAccessIdentity: + // 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::CloudFrontOriginAccessIdentity" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontCloudFrontOriginAccessIdentity + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFrontCloudFrontOriginAccessIdentity{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity_cloudfrontoriginaccessidentityconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity_cloudfrontoriginaccessidentityconfig.go new file mode 100644 index 000000000000..2a6bf9dca3a5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-cloudfrontoriginaccessidentity_cloudfrontoriginaccessidentityconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig AWS CloudFormation Resource (AWS::CloudFront::CloudFrontOriginAccessIdentity.CloudFrontOriginAccessIdentityConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cloudfrontoriginaccessidentity-cloudfrontoriginaccessidentityconfig.html +type AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig struct { + + // Comment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-cloudfrontoriginaccessidentity-cloudfrontoriginaccessidentityconfig.html#cfn-cloudfront-cloudfrontoriginaccessidentity-cloudfrontoriginaccessidentityconfig-comment + Comment string `json:"Comment,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::CloudFrontOriginAccessIdentity.CloudFrontOriginAccessIdentityConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a917172d3f5a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFrontDistribution AWS CloudFormation Resource (AWS::CloudFront::Distribution) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html +type AWSCloudFrontDistribution struct { + + // DistributionConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-distributionconfig + DistributionConfig *AWSCloudFrontDistribution_DistributionConfig `json:"DistributionConfig,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html#cfn-cloudfront-distribution-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5e295a754a73 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cachebehavior.go @@ -0,0 +1,90 @@ +package cloudformation + +// AWSCloudFrontDistribution_CacheBehavior AWS CloudFormation Resource (AWS::CloudFront::Distribution.CacheBehavior) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html +type AWSCloudFrontDistribution_CacheBehavior struct { + + // AllowedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-defaultttl + DefaultTTL float64 `json:"DefaultTTL,omitempty"` + + // FieldLevelEncryptionId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-fieldlevelencryptionid + FieldLevelEncryptionId string `json:"FieldLevelEncryptionId,omitempty"` + + // ForwardedValues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-forwardedvalues + ForwardedValues *AWSCloudFrontDistribution_ForwardedValues `json:"ForwardedValues,omitempty"` + + // LambdaFunctionAssociations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-lambdafunctionassociations + LambdaFunctionAssociations []AWSCloudFrontDistribution_LambdaFunctionAssociation `json:"LambdaFunctionAssociations,omitempty"` + + // MaxTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-maxttl + MaxTTL float64 `json:"MaxTTL,omitempty"` + + // MinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-minttl + MinTTL float64 `json:"MinTTL,omitempty"` + + // PathPattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-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-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-viewerprotocolpolicy + ViewerProtocolPolicy string `json:"ViewerProtocolPolicy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CacheBehavior) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CacheBehavior" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_CacheBehavior) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1959ae1f9e13 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_cookies.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontDistribution_Cookies AWS CloudFormation Resource (AWS::CloudFront::Distribution.Cookies) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cookies.html +type AWSCloudFrontDistribution_Cookies struct { + + // Forward AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cookies.html#cfn-cloudfront-distribution-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-distribution-cookies.html#cfn-cloudfront-distribution-cookies-whitelistednames + WhitelistedNames []string `json:"WhitelistedNames,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Cookies) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Cookies" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_Cookies) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3cdc41a03a8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customerrorresponse.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSCloudFrontDistribution_CustomErrorResponse AWS CloudFormation Resource (AWS::CloudFront::Distribution.CustomErrorResponse) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html +type AWSCloudFrontDistribution_CustomErrorResponse struct { + + // ErrorCachingMinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-errorcachingminttl + ErrorCachingMinTTL float64 `json:"ErrorCachingMinTTL,omitempty"` + + // ErrorCode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customerrorresponse.html#cfn-cloudfront-distribution-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-distribution-customerrorresponse.html#cfn-cloudfront-distribution-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-distribution-customerrorresponse.html#cfn-cloudfront-distribution-customerrorresponse-responsepagepath + ResponsePagePath string `json:"ResponsePagePath,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CustomErrorResponse) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CustomErrorResponse" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_CustomErrorResponse) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e3f1a224adf2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_customoriginconfig.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSCloudFrontDistribution_CustomOriginConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.CustomOriginConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html +type AWSCloudFrontDistribution_CustomOriginConfig struct { + + // HTTPPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-httpport + HTTPPort int `json:"HTTPPort,omitempty"` + + // HTTPSPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-httpsport + HTTPSPort int `json:"HTTPSPort,omitempty"` + + // OriginKeepaliveTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originkeepalivetimeout + OriginKeepaliveTimeout int `json:"OriginKeepaliveTimeout,omitempty"` + + // OriginProtocolPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originprotocolpolicy + OriginProtocolPolicy string `json:"OriginProtocolPolicy,omitempty"` + + // OriginReadTimeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originreadtimeout + OriginReadTimeout int `json:"OriginReadTimeout,omitempty"` + + // OriginSSLProtocols AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-customoriginconfig.html#cfn-cloudfront-distribution-customoriginconfig-originsslprotocols + OriginSSLProtocols []string `json:"OriginSSLProtocols,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_CustomOriginConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.CustomOriginConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_CustomOriginConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4f75e062119f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_defaultcachebehavior.go @@ -0,0 +1,85 @@ +package cloudformation + +// AWSCloudFrontDistribution_DefaultCacheBehavior AWS CloudFormation Resource (AWS::CloudFront::Distribution.DefaultCacheBehavior) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html +type AWSCloudFrontDistribution_DefaultCacheBehavior struct { + + // AllowedMethods AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-defaultttl + DefaultTTL float64 `json:"DefaultTTL,omitempty"` + + // FieldLevelEncryptionId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-fieldlevelencryptionid + FieldLevelEncryptionId string `json:"FieldLevelEncryptionId,omitempty"` + + // ForwardedValues AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-forwardedvalues + ForwardedValues *AWSCloudFrontDistribution_ForwardedValues `json:"ForwardedValues,omitempty"` + + // LambdaFunctionAssociations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-lambdafunctionassociations + LambdaFunctionAssociations []AWSCloudFrontDistribution_LambdaFunctionAssociation `json:"LambdaFunctionAssociations,omitempty"` + + // MaxTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-maxttl + MaxTTL float64 `json:"MaxTTL,omitempty"` + + // MinTTL AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-minttl + MinTTL float64 `json:"MinTTL,omitempty"` + + // SmoothStreaming AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-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-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-viewerprotocolpolicy + ViewerProtocolPolicy string `json:"ViewerProtocolPolicy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_DefaultCacheBehavior) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.DefaultCacheBehavior" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_DefaultCacheBehavior) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ffeb42a4bdc4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_distributionconfig.go @@ -0,0 +1,95 @@ +package cloudformation + +// AWSCloudFrontDistribution_DistributionConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.DistributionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html +type AWSCloudFrontDistribution_DistributionConfig struct { + + // Aliases AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-customerrorresponses + CustomErrorResponses []AWSCloudFrontDistribution_CustomErrorResponse `json:"CustomErrorResponses,omitempty"` + + // DefaultCacheBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-httpversion + HttpVersion string `json:"HttpVersion,omitempty"` + + // IPV6Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-ipv6enabled + IPV6Enabled bool `json:"IPV6Enabled,omitempty"` + + // Logging AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-logging + Logging *AWSCloudFrontDistribution_Logging `json:"Logging,omitempty"` + + // Origins AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-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-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-webaclid + WebACLId string `json:"WebACLId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_DistributionConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.DistributionConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_DistributionConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..301892cdb96e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_forwardedvalues.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSCloudFrontDistribution_ForwardedValues AWS CloudFormation Resource (AWS::CloudFront::Distribution.ForwardedValues) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html +type AWSCloudFrontDistribution_ForwardedValues struct { + + // Cookies AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-forwardedvalues.html#cfn-cloudfront-distribution-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-distribution-forwardedvalues.html#cfn-cloudfront-distribution-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-distribution-forwardedvalues.html#cfn-cloudfront-distribution-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-distribution-forwardedvalues.html#cfn-cloudfront-distribution-forwardedvalues-querystringcachekeys + QueryStringCacheKeys []string `json:"QueryStringCacheKeys,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_ForwardedValues) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.ForwardedValues" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_ForwardedValues) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5bfbd5dac798 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_georestriction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontDistribution_GeoRestriction AWS CloudFormation Resource (AWS::CloudFront::Distribution.GeoRestriction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-georestriction.html +type AWSCloudFrontDistribution_GeoRestriction struct { + + // Locations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-georestriction.html#cfn-cloudfront-distribution-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-distribution-georestriction.html#cfn-cloudfront-distribution-georestriction-restrictiontype + RestrictionType string `json:"RestrictionType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_GeoRestriction) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.GeoRestriction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_GeoRestriction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_lambdafunctionassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_lambdafunctionassociation.go new file mode 100644 index 000000000000..8ff913533cbe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_lambdafunctionassociation.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontDistribution_LambdaFunctionAssociation AWS CloudFormation Resource (AWS::CloudFront::Distribution.LambdaFunctionAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html +type AWSCloudFrontDistribution_LambdaFunctionAssociation struct { + + // EventType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html#cfn-cloudfront-distribution-lambdafunctionassociation-eventtype + EventType string `json:"EventType,omitempty"` + + // LambdaFunctionARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-lambdafunctionassociation.html#cfn-cloudfront-distribution-lambdafunctionassociation-lambdafunctionarn + LambdaFunctionARN string `json:"LambdaFunctionARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_LambdaFunctionAssociation) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.LambdaFunctionAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_LambdaFunctionAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacycustomorigin.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacycustomorigin.go new file mode 100644 index 000000000000..1e0d47b0b351 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacycustomorigin.go @@ -0,0 +1,36 @@ +package cloudformation + +// AWSCloudFrontDistribution_LegacyCustomOrigin AWS CloudFormation Resource (AWS::CloudFront::Distribution.LegacyCustomOrigin) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html +type AWSCloudFrontDistribution_LegacyCustomOrigin struct { + + // DNSName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-dnsname + DNSName string `json:"DNSName,omitempty"` + + // HTTPPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-httpport + HTTPPort int `json:"HTTPPort,omitempty"` + + // HTTPSPort AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-httpsport + HTTPSPort int `json:"HTTPSPort,omitempty"` + + // OriginProtocolPolicy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-originprotocolpolicy + OriginProtocolPolicy string `json:"OriginProtocolPolicy,omitempty"` + + // OriginSSLProtocols AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacycustomorigin.html#cfn-cloudfront-distribution-legacycustomorigin-originsslprotocols + OriginSSLProtocols []string `json:"OriginSSLProtocols,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_LegacyCustomOrigin) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.LegacyCustomOrigin" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacys3origin.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacys3origin.go new file mode 100644 index 000000000000..0e28c27d36c8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_legacys3origin.go @@ -0,0 +1,21 @@ +package cloudformation + +// AWSCloudFrontDistribution_LegacyS3Origin AWS CloudFormation Resource (AWS::CloudFront::Distribution.LegacyS3Origin) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html +type AWSCloudFrontDistribution_LegacyS3Origin struct { + + // DNSName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html#cfn-cloudfront-distribution-legacys3origin-dnsname + DNSName string `json:"DNSName,omitempty"` + + // OriginAccessIdentity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-legacys3origin.html#cfn-cloudfront-distribution-legacys3origin-originaccessidentity + OriginAccessIdentity string `json:"OriginAccessIdentity,omitempty"` +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_LegacyS3Origin) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.LegacyS3Origin" +} 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 000000000000..f92cadee97a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_logging.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSCloudFrontDistribution_Logging AWS CloudFormation Resource (AWS::CloudFront::Distribution.Logging) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html +type AWSCloudFrontDistribution_Logging struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-logging.html#cfn-cloudfront-distribution-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-distribution-logging.html#cfn-cloudfront-distribution-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-distribution-logging.html#cfn-cloudfront-distribution-logging-prefix + Prefix string `json:"Prefix,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Logging) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Logging" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_Logging) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5d06ad565450 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origin.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSCloudFrontDistribution_Origin AWS CloudFormation Resource (AWS::CloudFront::Distribution.Origin) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html +type AWSCloudFrontDistribution_Origin struct { + + // CustomOriginConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-origin-customoriginconfig + CustomOriginConfig *AWSCloudFrontDistribution_CustomOriginConfig `json:"CustomOriginConfig,omitempty"` + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origin.html#cfn-cloudfront-distribution-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-distribution-origin.html#cfn-cloudfront-distribution-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-distribution-origin.html#cfn-cloudfront-distribution-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-distribution-origin.html#cfn-cloudfront-distribution-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-distribution-origin.html#cfn-cloudfront-distribution-origin-s3originconfig + S3OriginConfig *AWSCloudFrontDistribution_S3OriginConfig `json:"S3OriginConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Origin) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Origin" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_Origin) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..30bbc85c9c8c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_origincustomheader.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontDistribution_OriginCustomHeader AWS CloudFormation Resource (AWS::CloudFront::Distribution.OriginCustomHeader) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origincustomheader.html +type AWSCloudFrontDistribution_OriginCustomHeader struct { + + // HeaderName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origincustomheader.html#cfn-cloudfront-distribution-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-distribution-origincustomheader.html#cfn-cloudfront-distribution-origincustomheader-headervalue + HeaderValue string `json:"HeaderValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_OriginCustomHeader) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.OriginCustomHeader" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_OriginCustomHeader) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c764f7172eac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_restrictions.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCloudFrontDistribution_Restrictions AWS CloudFormation Resource (AWS::CloudFront::Distribution.Restrictions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-restrictions.html +type AWSCloudFrontDistribution_Restrictions struct { + + // GeoRestriction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-restrictions.html#cfn-cloudfront-distribution-restrictions-georestriction + GeoRestriction *AWSCloudFrontDistribution_GeoRestriction `json:"GeoRestriction,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_Restrictions) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.Restrictions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_Restrictions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3ef4a4048909 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_s3originconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCloudFrontDistribution_S3OriginConfig AWS CloudFormation Resource (AWS::CloudFront::Distribution.S3OriginConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-s3originconfig.html +type AWSCloudFrontDistribution_S3OriginConfig struct { + + // OriginAccessIdentity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-s3originconfig.html#cfn-cloudfront-distribution-s3originconfig-originaccessidentity + OriginAccessIdentity string `json:"OriginAccessIdentity,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_S3OriginConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.S3OriginConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_S3OriginConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c6f1cd314aea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-distribution_viewercertificate.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSCloudFrontDistribution_ViewerCertificate AWS CloudFormation Resource (AWS::CloudFront::Distribution.ViewerCertificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html +type AWSCloudFrontDistribution_ViewerCertificate struct { + + // AcmCertificateArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-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-distribution-viewercertificate.html#cfn-cloudfront-distribution-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-distribution-viewercertificate.html#cfn-cloudfront-distribution-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-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-minimumprotocolversion + MinimumProtocolVersion string `json:"MinimumProtocolVersion,omitempty"` + + // SslSupportMethod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-viewercertificate.html#cfn-cloudfront-distribution-viewercertificate-sslsupportmethod + SslSupportMethod string `json:"SslSupportMethod,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontDistribution_ViewerCertificate) AWSCloudFormationType() string { + return "AWS::CloudFront::Distribution.ViewerCertificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontDistribution_ViewerCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution.go new file mode 100644 index 000000000000..42db7fab0076 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudFrontStreamingDistribution AWS CloudFormation Resource (AWS::CloudFront::StreamingDistribution) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-streamingdistribution.html +type AWSCloudFrontStreamingDistribution struct { + + // StreamingDistributionConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-streamingdistribution.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig + StreamingDistributionConfig *AWSCloudFrontStreamingDistribution_StreamingDistributionConfig `json:"StreamingDistributionConfig,omitempty"` + + // Tags AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-streamingdistribution.html#cfn-cloudfront-streamingdistribution-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontStreamingDistribution) AWSCloudFormationType() string { + return "AWS::CloudFront::StreamingDistribution" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontStreamingDistribution) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSCloudFrontStreamingDistribution) MarshalJSON() ([]byte, error) { + type Properties AWSCloudFrontStreamingDistribution + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCloudFrontStreamingDistribution) UnmarshalJSON(b []byte) error { + type Properties AWSCloudFrontStreamingDistribution + 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 = AWSCloudFrontStreamingDistribution(*res.Properties) + } + + return nil +} + +// GetAllAWSCloudFrontStreamingDistributionResources retrieves all AWSCloudFrontStreamingDistribution items from an AWS CloudFormation template +func (t *Template) GetAllAWSCloudFrontStreamingDistributionResources() map[string]AWSCloudFrontStreamingDistribution { + results := map[string]AWSCloudFrontStreamingDistribution{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCloudFrontStreamingDistribution: + // 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::StreamingDistribution" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontStreamingDistribution + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCloudFrontStreamingDistributionWithName retrieves all AWSCloudFrontStreamingDistribution items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCloudFrontStreamingDistributionWithName(name string) (AWSCloudFrontStreamingDistribution, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCloudFrontStreamingDistribution: + // 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::StreamingDistribution" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCloudFrontStreamingDistribution + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCloudFrontStreamingDistribution{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_logging.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_logging.go new file mode 100644 index 000000000000..99cf4d7a5845 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_logging.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSCloudFrontStreamingDistribution_Logging AWS CloudFormation Resource (AWS::CloudFront::StreamingDistribution.Logging) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-logging.html +type AWSCloudFrontStreamingDistribution_Logging struct { + + // Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-logging.html#cfn-cloudfront-streamingdistribution-logging-bucket + Bucket string `json:"Bucket,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-logging.html#cfn-cloudfront-streamingdistribution-logging-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-logging.html#cfn-cloudfront-streamingdistribution-logging-prefix + Prefix string `json:"Prefix,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontStreamingDistribution_Logging) AWSCloudFormationType() string { + return "AWS::CloudFront::StreamingDistribution.Logging" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontStreamingDistribution_Logging) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_s3origin.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_s3origin.go new file mode 100644 index 000000000000..0f27e8a38ed1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_s3origin.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontStreamingDistribution_S3Origin AWS CloudFormation Resource (AWS::CloudFront::StreamingDistribution.S3Origin) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-s3origin.html +type AWSCloudFrontStreamingDistribution_S3Origin struct { + + // DomainName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-s3origin.html#cfn-cloudfront-streamingdistribution-s3origin-domainname + DomainName string `json:"DomainName,omitempty"` + + // OriginAccessIdentity AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-s3origin.html#cfn-cloudfront-streamingdistribution-s3origin-originaccessidentity + OriginAccessIdentity string `json:"OriginAccessIdentity,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontStreamingDistribution_S3Origin) AWSCloudFormationType() string { + return "AWS::CloudFront::StreamingDistribution.S3Origin" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontStreamingDistribution_S3Origin) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_streamingdistributionconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_streamingdistributionconfig.go new file mode 100644 index 000000000000..471c7f70a52b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_streamingdistributionconfig.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSCloudFrontStreamingDistribution_StreamingDistributionConfig AWS CloudFormation Resource (AWS::CloudFront::StreamingDistribution.StreamingDistributionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html +type AWSCloudFrontStreamingDistribution_StreamingDistributionConfig struct { + + // Aliases AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-aliases + Aliases []string `json:"Aliases,omitempty"` + + // Comment AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-comment + Comment string `json:"Comment,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Logging AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-logging + Logging *AWSCloudFrontStreamingDistribution_Logging `json:"Logging,omitempty"` + + // PriceClass AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-priceclass + PriceClass string `json:"PriceClass,omitempty"` + + // S3Origin AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-s3origin + S3Origin *AWSCloudFrontStreamingDistribution_S3Origin `json:"S3Origin,omitempty"` + + // TrustedSigners AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-streamingdistributionconfig.html#cfn-cloudfront-streamingdistribution-streamingdistributionconfig-trustedsigners + TrustedSigners *AWSCloudFrontStreamingDistribution_TrustedSigners `json:"TrustedSigners,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontStreamingDistribution_StreamingDistributionConfig) AWSCloudFormationType() string { + return "AWS::CloudFront::StreamingDistribution.StreamingDistributionConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontStreamingDistribution_StreamingDistributionConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_trustedsigners.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_trustedsigners.go new file mode 100644 index 000000000000..eee7a77addea --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudfront-streamingdistribution_trustedsigners.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudFrontStreamingDistribution_TrustedSigners AWS CloudFormation Resource (AWS::CloudFront::StreamingDistribution.TrustedSigners) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-trustedsigners.html +type AWSCloudFrontStreamingDistribution_TrustedSigners struct { + + // AwsAccountNumbers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-trustedsigners.html#cfn-cloudfront-streamingdistribution-trustedsigners-awsaccountnumbers + AwsAccountNumbers []string `json:"AwsAccountNumbers,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-streamingdistribution-trustedsigners.html#cfn-cloudfront-streamingdistribution-trustedsigners-enabled + Enabled bool `json:"Enabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudFrontStreamingDistribution_TrustedSigners) AWSCloudFormationType() string { + return "AWS::CloudFront::StreamingDistribution.TrustedSigners" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudFrontStreamingDistribution_TrustedSigners) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..269f6f50fe57 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail.go @@ -0,0 +1,181 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCloudTrailTrail AWS CloudFormation Resource (AWS::CloudTrail::Trail) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html +type AWSCloudTrailTrail struct { + + // CloudWatchLogsLogGroupArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-cloudwatchlogsloggrouparn + CloudWatchLogsLogGroupArn string `json:"CloudWatchLogsLogGroupArn,omitempty"` + + // CloudWatchLogsRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-cloudwatchlogsrolearn + CloudWatchLogsRoleArn string `json:"CloudWatchLogsRoleArn,omitempty"` + + // EnableLogFileValidation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-enablelogfilevalidation + EnableLogFileValidation bool `json:"EnableLogFileValidation,omitempty"` + + // EventSelectors AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-eventselectors + EventSelectors []AWSCloudTrailTrail_EventSelector `json:"EventSelectors,omitempty"` + + // IncludeGlobalServiceEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-includeglobalserviceevents + IncludeGlobalServiceEvents bool `json:"IncludeGlobalServiceEvents,omitempty"` + + // IsLogging AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-islogging + IsLogging bool `json:"IsLogging,omitempty"` + + // IsMultiRegionTrail AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-ismultiregiontrail + IsMultiRegionTrail bool `json:"IsMultiRegionTrail,omitempty"` + + // KMSKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-kmskeyid + KMSKeyId string `json:"KMSKeyId,omitempty"` + + // S3BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-s3bucketname + S3BucketName string `json:"S3BucketName,omitempty"` + + // S3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-s3keyprefix + S3KeyPrefix string `json:"S3KeyPrefix,omitempty"` + + // SnsTopicName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-snstopicname + SnsTopicName string `json:"SnsTopicName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-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-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-trailname + TrailName string `json:"TrailName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudTrailTrail) AWSCloudFormationType() string { + return "AWS::CloudTrail::Trail" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudTrailTrail) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-cloudtrail-trail_dataresource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail_dataresource.go new file mode 100644 index 000000000000..c3c727689879 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail_dataresource.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCloudTrailTrail_DataResource AWS CloudFormation Resource (AWS::CloudTrail::Trail.DataResource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-dataresource.html +type AWSCloudTrailTrail_DataResource struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-dataresource.html#cfn-cloudtrail-trail-dataresource-type + Type string `json:"Type,omitempty"` + + // Values AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-dataresource.html#cfn-cloudtrail-trail-dataresource-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudTrailTrail_DataResource) AWSCloudFormationType() string { + return "AWS::CloudTrail::Trail.DataResource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudTrailTrail_DataResource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail_eventselector.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail_eventselector.go new file mode 100644 index 000000000000..3af2dfbec57f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudtrail-trail_eventselector.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSCloudTrailTrail_EventSelector AWS CloudFormation Resource (AWS::CloudTrail::Trail.EventSelector) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-eventselector.html +type AWSCloudTrailTrail_EventSelector struct { + + // DataResources AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-eventselector.html#cfn-cloudtrail-trail-eventselector-dataresources + DataResources []AWSCloudTrailTrail_DataResource `json:"DataResources,omitempty"` + + // IncludeManagementEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-eventselector.html#cfn-cloudtrail-trail-eventselector-includemanagementevents + IncludeManagementEvents bool `json:"IncludeManagementEvents,omitempty"` + + // ReadWriteType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudtrail-trail-eventselector.html#cfn-cloudtrail-trail-eventselector-readwritetype + ReadWriteType string `json:"ReadWriteType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudTrailTrail_EventSelector) AWSCloudFormationType() string { + return "AWS::CloudTrail::Trail.EventSelector" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudTrailTrail_EventSelector) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..404e6c179fa6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm.go @@ -0,0 +1,206 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchAlarm) AWSCloudFormationType() string { + return "AWS::CloudWatch::Alarm" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudWatchAlarm) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..71a7ce5fdbe6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-alarm_dimension.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchAlarm_Dimension) AWSCloudFormationType() string { + return "AWS::CloudWatch::Alarm.Dimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudWatchAlarm_Dimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9a12a9b0e56d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cloudwatch-dashboard.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCloudWatchDashboard) AWSCloudFormationType() string { + return "AWS::CloudWatch::Dashboard" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCloudWatchDashboard) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..aee40492e67a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project.go @@ -0,0 +1,181 @@ +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"` + + // BadgeEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-badgeenabled + BadgeEnabled bool `json:"BadgeEnabled,omitempty"` + + // Cache AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-cache + Cache *AWSCodeBuildProject_ProjectCache `json:"Cache,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"` + + // Triggers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-triggers + Triggers *AWSCodeBuildProject_ProjectTriggers `json:"Triggers,omitempty"` + + // VpcConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-vpcconfig + VpcConfig *AWSCodeBuildProject_VpcConfig `json:"VpcConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..e3f119b81544 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_artifacts.go @@ -0,0 +1,60 @@ +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 { + + // EncryptionDisabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-encryptiondisabled + EncryptionDisabled bool `json:"EncryptionDisabled,omitempty"` + + // 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"` + + // OverrideArtifactName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-artifacts.html#cfn-codebuild-project-artifacts-overrideartifactname + OverrideArtifactName bool `json:"OverrideArtifactName,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Artifacts) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Artifacts" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_Artifacts) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f68395809f19 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environment.go @@ -0,0 +1,50 @@ +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 { + + // Certificate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environment.html#cfn-codebuild-project-environment-certificate + Certificate string `json:"Certificate,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Environment) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Environment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_Environment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3262ea66b9d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_environmentvariable.go @@ -0,0 +1,35 @@ +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"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environmentvariable.html#cfn-codebuild-project-environmentvariable-type + Type string `json:"Type,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_EnvironmentVariable) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.EnvironmentVariable" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_EnvironmentVariable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projectcache.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projectcache.go new file mode 100644 index 000000000000..6f16e1248c79 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projectcache.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodeBuildProject_ProjectCache AWS CloudFormation Resource (AWS::CodeBuild::Project.ProjectCache) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projectcache.html +type AWSCodeBuildProject_ProjectCache struct { + + // Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projectcache.html#cfn-codebuild-project-projectcache-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-projectcache.html#cfn-codebuild-project-projectcache-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_ProjectCache) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.ProjectCache" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_ProjectCache) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projecttriggers.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projecttriggers.go new file mode 100644 index 000000000000..a761e68b622d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_projecttriggers.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCodeBuildProject_ProjectTriggers AWS CloudFormation Resource (AWS::CodeBuild::Project.ProjectTriggers) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projecttriggers.html +type AWSCodeBuildProject_ProjectTriggers struct { + + // Webhook AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projecttriggers.html#cfn-codebuild-project-projecttriggers-webhook + Webhook bool `json:"Webhook,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_ProjectTriggers) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.ProjectTriggers" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_ProjectTriggers) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7d34fb87e2cf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_source.go @@ -0,0 +1,55 @@ +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"` + + // GitCloneDepth AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-gitclonedepth + GitCloneDepth int `json:"GitCloneDepth,omitempty"` + + // InsecureSsl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-insecuressl + InsecureSsl bool `json:"InsecureSsl,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"` + + // ReportBuildStatus AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-reportbuildstatus + ReportBuildStatus bool `json:"ReportBuildStatus,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_Source) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.Source" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_Source) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fc186f2d5db0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_sourceauth.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_SourceAuth) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.SourceAuth" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_SourceAuth) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_vpcconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_vpcconfig.go new file mode 100644 index 000000000000..faf0d45643aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codebuild-project_vpcconfig.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSCodeBuildProject_VpcConfig AWS CloudFormation Resource (AWS::CodeBuild::Project.VpcConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-vpcconfig.html +type AWSCodeBuildProject_VpcConfig struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-vpcconfig.html#cfn-codebuild-project-vpcconfig-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-vpcconfig.html#cfn-codebuild-project-vpcconfig-subnets + Subnets []string `json:"Subnets,omitempty"` + + // VpcId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-vpcconfig.html#cfn-codebuild-project-vpcconfig-vpcid + VpcId string `json:"VpcId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeBuildProject_VpcConfig) AWSCloudFormationType() string { + return "AWS::CodeBuild::Project.VpcConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeBuildProject_VpcConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9ca452c85aeb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeCommitRepository) AWSCloudFormationType() string { + return "AWS::CodeCommit::Repository" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeCommitRepository) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d868d9387f4d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codecommit-repository_repositorytrigger.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeCommitRepository_RepositoryTrigger) AWSCloudFormationType() string { + return "AWS::CodeCommit::Repository.RepositoryTrigger" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeCommitRepository_RepositoryTrigger) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b11623d5d863 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-application.go @@ -0,0 +1,126 @@ +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"` + + // ComputePlatform AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-application.html#cfn-codedeploy-application-computeplatform + ComputePlatform string `json:"ComputePlatform,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployApplication) AWSCloudFormationType() string { + return "AWS::CodeDeploy::Application" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployApplication) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..bc4238083f0c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentConfig) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..859fb99fa689 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentconfig_minimumhealthyhosts.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentConfig_MinimumHealthyHosts) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentConfig.MinimumHealthyHosts" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentConfig_MinimumHealthyHosts) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c59a4ff25de8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup.go @@ -0,0 +1,181 @@ +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"` + + // AutoRollbackConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-autorollbackconfiguration + AutoRollbackConfiguration *AWSCodeDeployDeploymentGroup_AutoRollbackConfiguration `json:"AutoRollbackConfiguration,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"` + + // DeploymentStyle AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-deploymentstyle + DeploymentStyle *AWSCodeDeployDeploymentGroup_DeploymentStyle `json:"DeploymentStyle,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"` + + // LoadBalancerInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codedeploy-deploymentgroup.html#cfn-codedeploy-deploymentgroup-loadbalancerinfo + LoadBalancerInfo *AWSCodeDeployDeploymentGroup_LoadBalancerInfo `json:"LoadBalancerInfo,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..586706a4b622 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarm.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_Alarm) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.Alarm" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_Alarm) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7b370ff31037 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_alarmconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_AlarmConfiguration) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.AlarmConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_AlarmConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_autorollbackconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_autorollbackconfiguration.go new file mode 100644 index 000000000000..24d3cc3111b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_autorollbackconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_AutoRollbackConfiguration AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.AutoRollbackConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-autorollbackconfiguration.html +type AWSCodeDeployDeploymentGroup_AutoRollbackConfiguration struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-autorollbackconfiguration.html#cfn-codedeploy-deploymentgroup-autorollbackconfiguration-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Events AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-autorollbackconfiguration.html#cfn-codedeploy-deploymentgroup-autorollbackconfiguration-events + Events []string `json:"Events,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_AutoRollbackConfiguration) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.AutoRollbackConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_AutoRollbackConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9a1a9bf481e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deployment.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_Deployment) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.Deployment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_Deployment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deploymentstyle.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deploymentstyle.go new file mode 100644 index 000000000000..9fa64589fb60 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_deploymentstyle.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_DeploymentStyle AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.DeploymentStyle) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deploymentstyle.html +type AWSCodeDeployDeploymentGroup_DeploymentStyle struct { + + // DeploymentOption AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deploymentstyle.html#cfn-codedeploy-deploymentgroup-deploymentstyle-deploymentoption + DeploymentOption string `json:"DeploymentOption,omitempty"` + + // DeploymentType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-deploymentstyle.html#cfn-codedeploy-deploymentgroup-deploymentstyle-deploymenttype + DeploymentType string `json:"DeploymentType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_DeploymentStyle) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.DeploymentStyle" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_DeploymentStyle) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3f0a838adcb4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_ec2tagfilter.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_EC2TagFilter) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.EC2TagFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_EC2TagFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_elbinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_elbinfo.go new file mode 100644 index 000000000000..8ccd6c3163a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_elbinfo.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_ELBInfo AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.ELBInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-elbinfo.html +type AWSCodeDeployDeploymentGroup_ELBInfo struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-elbinfo.html#cfn-codedeploy-deploymentgroup-elbinfo-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_ELBInfo) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.ELBInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_ELBInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0909e11ff54b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_githublocation.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_GitHubLocation) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.GitHubLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_GitHubLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_loadbalancerinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_loadbalancerinfo.go new file mode 100644 index 000000000000..aee79c1fffac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_loadbalancerinfo.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_LoadBalancerInfo AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.LoadBalancerInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-loadbalancerinfo.html +type AWSCodeDeployDeploymentGroup_LoadBalancerInfo struct { + + // ElbInfoList AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-loadbalancerinfo.html#cfn-codedeploy-deploymentgroup-loadbalancerinfo-elbinfolist + ElbInfoList []AWSCodeDeployDeploymentGroup_ELBInfo `json:"ElbInfoList,omitempty"` + + // TargetGroupInfoList AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-loadbalancerinfo.html#cfn-codedeploy-deploymentgroup-loadbalancerinfo-targetgroupinfolist + TargetGroupInfoList []AWSCodeDeployDeploymentGroup_TargetGroupInfo `json:"TargetGroupInfoList,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_LoadBalancerInfo) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.LoadBalancerInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_LoadBalancerInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..41310bf5ccff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_revisionlocation.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_RevisionLocation) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.RevisionLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_RevisionLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..96c8b03ed1a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_s3location.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_S3Location) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.S3Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_S3Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5a86ca23ad29 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_tagfilter.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_TagFilter) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.TagFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_TagFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_targetgroupinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_targetgroupinfo.go new file mode 100644 index 000000000000..c1f36cd8e4c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_targetgroupinfo.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSCodeDeployDeploymentGroup_TargetGroupInfo AWS CloudFormation Resource (AWS::CodeDeploy::DeploymentGroup.TargetGroupInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-targetgroupinfo.html +type AWSCodeDeployDeploymentGroup_TargetGroupInfo struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codedeploy-deploymentgroup-targetgroupinfo.html#cfn-codedeploy-deploymentgroup-targetgroupinfo-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_TargetGroupInfo) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.TargetGroupInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_TargetGroupInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..42a62ae1a945 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codedeploy-deploymentgroup_triggerconfig.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodeDeployDeploymentGroup_TriggerConfig) AWSCloudFormationType() string { + return "AWS::CodeDeploy::DeploymentGroup.TriggerConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodeDeployDeploymentGroup_TriggerConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..922714a3f92c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineCustomActionType) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..b0e36d1a452c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_artifactdetails.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_ArtifactDetails) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.ArtifactDetails" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineCustomActionType_ArtifactDetails) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..adcd210d8ec6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_configurationproperties.go @@ -0,0 +1,55 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_ConfigurationProperties) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.ConfigurationProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineCustomActionType_ConfigurationProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5c264e0d61e1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-customactiontype_settings.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineCustomActionType_Settings) AWSCloudFormationType() string { + return "AWS::CodePipeline::CustomActionType.Settings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineCustomActionType_Settings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9538d22c6c4a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d2de0ab7faad --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiondeclaration.go @@ -0,0 +1,55 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ActionDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ActionDeclaration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_ActionDeclaration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..846485f7629e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_actiontypeid.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ActionTypeId) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ActionTypeId" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_ActionTypeId) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..07eec811785f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_artifactstore.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_ArtifactStore) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.ArtifactStore" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_ArtifactStore) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8aeb57861103 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_blockerdeclaration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_BlockerDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.BlockerDeclaration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_BlockerDeclaration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9c815fae2dff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_encryptionkey.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_EncryptionKey) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.EncryptionKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_EncryptionKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..02dc06e98b36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_inputartifact.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_InputArtifact) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.InputArtifact" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_InputArtifact) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5a1a4d66f6db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_outputartifact.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_OutputArtifact) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.OutputArtifact" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_OutputArtifact) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..88641e612189 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagedeclaration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_StageDeclaration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.StageDeclaration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_StageDeclaration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d12256c68d9a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-pipeline_stagetransition.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelinePipeline_StageTransition) AWSCloudFormationType() string { + return "AWS::CodePipeline::Pipeline.StageTransition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelinePipeline_StageTransition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook.go new file mode 100644 index 000000000000..7c97824f9210 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook.go @@ -0,0 +1,156 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSCodePipelineWebhook AWS CloudFormation Resource (AWS::CodePipeline::Webhook) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html +type AWSCodePipelineWebhook struct { + + // Authentication AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-authentication + Authentication string `json:"Authentication,omitempty"` + + // AuthenticationConfiguration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-authenticationconfiguration + AuthenticationConfiguration *AWSCodePipelineWebhook_WebhookAuthConfiguration `json:"AuthenticationConfiguration,omitempty"` + + // Filters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-filters + Filters []AWSCodePipelineWebhook_WebhookFilterRule `json:"Filters,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-name + Name string `json:"Name,omitempty"` + + // RegisterWithThirdParty AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-registerwiththirdparty + RegisterWithThirdParty bool `json:"RegisterWithThirdParty,omitempty"` + + // TargetAction AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-targetaction + TargetAction string `json:"TargetAction,omitempty"` + + // TargetPipeline AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-targetpipeline + TargetPipeline string `json:"TargetPipeline,omitempty"` + + // TargetPipelineVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-webhook.html#cfn-codepipeline-webhook-targetpipelineversion + TargetPipelineVersion int `json:"TargetPipelineVersion,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineWebhook) AWSCloudFormationType() string { + return "AWS::CodePipeline::Webhook" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineWebhook) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSCodePipelineWebhook) MarshalJSON() ([]byte, error) { + type Properties AWSCodePipelineWebhook + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSCodePipelineWebhook) UnmarshalJSON(b []byte) error { + type Properties AWSCodePipelineWebhook + 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 = AWSCodePipelineWebhook(*res.Properties) + } + + return nil +} + +// GetAllAWSCodePipelineWebhookResources retrieves all AWSCodePipelineWebhook items from an AWS CloudFormation template +func (t *Template) GetAllAWSCodePipelineWebhookResources() map[string]AWSCodePipelineWebhook { + results := map[string]AWSCodePipelineWebhook{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSCodePipelineWebhook: + // 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::Webhook" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelineWebhook + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSCodePipelineWebhookWithName retrieves all AWSCodePipelineWebhook items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSCodePipelineWebhookWithName(name string) (AWSCodePipelineWebhook, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSCodePipelineWebhook: + // 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::Webhook" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSCodePipelineWebhook + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSCodePipelineWebhook{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookauthconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookauthconfiguration.go new file mode 100644 index 000000000000..0f97377e224e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookauthconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodePipelineWebhook_WebhookAuthConfiguration AWS CloudFormation Resource (AWS::CodePipeline::Webhook.WebhookAuthConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookauthconfiguration.html +type AWSCodePipelineWebhook_WebhookAuthConfiguration struct { + + // AllowedIPRange AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookauthconfiguration.html#cfn-codepipeline-webhook-webhookauthconfiguration-allowediprange + AllowedIPRange string `json:"AllowedIPRange,omitempty"` + + // SecretToken AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookauthconfiguration.html#cfn-codepipeline-webhook-webhookauthconfiguration-secrettoken + SecretToken string `json:"SecretToken,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineWebhook_WebhookAuthConfiguration) AWSCloudFormationType() string { + return "AWS::CodePipeline::Webhook.WebhookAuthConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineWebhook_WebhookAuthConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookfilterrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookfilterrule.go new file mode 100644 index 000000000000..7193948602c2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-codepipeline-webhook_webhookfilterrule.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSCodePipelineWebhook_WebhookFilterRule AWS CloudFormation Resource (AWS::CodePipeline::Webhook.WebhookFilterRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookfilterrule.html +type AWSCodePipelineWebhook_WebhookFilterRule struct { + + // JsonPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookfilterrule.html#cfn-codepipeline-webhook-webhookfilterrule-jsonpath + JsonPath string `json:"JsonPath,omitempty"` + + // MatchEquals AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-webhook-webhookfilterrule.html#cfn-codepipeline-webhook-webhookfilterrule-matchequals + MatchEquals string `json:"MatchEquals,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCodePipelineWebhook_WebhookFilterRule) AWSCloudFormationType() string { + return "AWS::CodePipeline::Webhook.WebhookFilterRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCodePipelineWebhook_WebhookFilterRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d312dc8248a6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool.go @@ -0,0 +1,166 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPool) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f23d5d57a637 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitoidentityprovider.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_CognitoIdentityProvider) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.CognitoIdentityProvider" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPool_CognitoIdentityProvider) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..534119cc62a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_cognitostreams.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_CognitoStreams) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.CognitoStreams" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPool_CognitoStreams) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b122c10da566 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypool_pushsync.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPool_PushSync) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPool.PushSync" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPool_PushSync) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6b916f59c786 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPoolRoleAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..99df5527df1f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_mappingrule.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_MappingRule) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.MappingRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPoolRoleAttachment_MappingRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ef11cbb18861 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rolemapping.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_RoleMapping) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.RoleMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPoolRoleAttachment_RoleMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ec1b13b5ddb3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-identitypoolroleattachment_rulesconfigurationtype.go @@ -0,0 +1,25 @@ +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 { + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-identitypoolroleattachment-rulesconfigurationtype.html#cfn-cognito-identitypoolroleattachment-rulesconfigurationtype-rules + Rules []AWSCognitoIdentityPoolRoleAttachment_MappingRule `json:"Rules,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType) AWSCloudFormationType() string { + return "AWS::Cognito::IdentityPoolRoleAttachment.RulesConfigurationType" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoIdentityPoolRoleAttachment_RulesConfigurationType) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f19287c7c561 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool.go @@ -0,0 +1,201 @@ +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"` + + // UsernameAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-usernameattributes + UsernameAttributes []string `json:"UsernameAttributes,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4a628fad25f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_admincreateuserconfig.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_AdminCreateUserConfig) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.AdminCreateUserConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_AdminCreateUserConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f821a83af725 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_deviceconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_DeviceConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.DeviceConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_DeviceConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1866a804dd04 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_emailconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_EmailConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.EmailConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_EmailConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1f02c1baf7ab --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_invitemessagetemplate.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_InviteMessageTemplate) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.InviteMessageTemplate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_InviteMessageTemplate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f36278b65731 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_lambdaconfig.go @@ -0,0 +1,60 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_LambdaConfig) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.LambdaConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_LambdaConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..833d0f71dd5f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_numberattributeconstraints.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_NumberAttributeConstraints) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.NumberAttributeConstraints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_NumberAttributeConstraints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..df5193ae45da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_passwordpolicy.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_PasswordPolicy) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.PasswordPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_PasswordPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..77bb222b09cc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_policies.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_Policies) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.Policies" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_Policies) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fee5b9b41ec7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_schemaattribute.go @@ -0,0 +1,55 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_SchemaAttribute) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.SchemaAttribute" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_SchemaAttribute) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f92969eb5c3d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_smsconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_SmsConfiguration) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.SmsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_SmsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b0c7d3a06bcc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpool_stringattributeconstraints.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPool_StringAttributeConstraints) AWSCloudFormationType() string { + return "AWS::Cognito::UserPool.StringAttributeConstraints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPool_StringAttributeConstraints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4ee98b2f5093 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolclient.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolClient) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolClient" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPoolClient) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..a3d29611e17f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolgroup.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolGroup) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPoolGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2803da186cff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUser) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUser" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPoolUser) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7ada45c7cc61 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpooluser_attributetype.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUser_AttributeType) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUser.AttributeType" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPoolUser_AttributeType) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0d19a6caedbf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-cognito-userpoolusertogroupattachment.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSCognitoUserPoolUserToGroupAttachment) AWSCloudFormationType() string { + return "AWS::Cognito::UserPoolUserToGroupAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSCognitoUserPoolUserToGroupAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-aggregationauthorization.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-aggregationauthorization.go new file mode 100644 index 000000000000..943293abaa0d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-aggregationauthorization.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSConfigAggregationAuthorization AWS CloudFormation Resource (AWS::Config::AggregationAuthorization) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-aggregationauthorization.html +type AWSConfigAggregationAuthorization struct { + + // AuthorizedAccountId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-aggregationauthorization.html#cfn-config-aggregationauthorization-authorizedaccountid + AuthorizedAccountId string `json:"AuthorizedAccountId,omitempty"` + + // AuthorizedAwsRegion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-aggregationauthorization.html#cfn-config-aggregationauthorization-authorizedawsregion + AuthorizedAwsRegion string `json:"AuthorizedAwsRegion,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigAggregationAuthorization) AWSCloudFormationType() string { + return "AWS::Config::AggregationAuthorization" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigAggregationAuthorization) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSConfigAggregationAuthorization) MarshalJSON() ([]byte, error) { + type Properties AWSConfigAggregationAuthorization + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSConfigAggregationAuthorization) UnmarshalJSON(b []byte) error { + type Properties AWSConfigAggregationAuthorization + 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 = AWSConfigAggregationAuthorization(*res.Properties) + } + + return nil +} + +// GetAllAWSConfigAggregationAuthorizationResources retrieves all AWSConfigAggregationAuthorization items from an AWS CloudFormation template +func (t *Template) GetAllAWSConfigAggregationAuthorizationResources() map[string]AWSConfigAggregationAuthorization { + results := map[string]AWSConfigAggregationAuthorization{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSConfigAggregationAuthorization: + // 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::AggregationAuthorization" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigAggregationAuthorization + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSConfigAggregationAuthorizationWithName retrieves all AWSConfigAggregationAuthorization items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSConfigAggregationAuthorizationWithName(name string) (AWSConfigAggregationAuthorization, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSConfigAggregationAuthorization: + // 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::AggregationAuthorization" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigAggregationAuthorization + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSConfigAggregationAuthorization{}, 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 000000000000..a74985650f52 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d1523221816f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_scope.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_Scope) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.Scope" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigRule_Scope) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..71bea096189c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_source.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_Source) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.Source" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigRule_Source) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..731450ef630a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configrule_sourcedetail.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigRule_SourceDetail) AWSCloudFormationType() string { + return "AWS::Config::ConfigRule.SourceDetail" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigRule_SourceDetail) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator.go new file mode 100644 index 000000000000..15dfb86b04c1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSConfigConfigurationAggregator AWS CloudFormation Resource (AWS::Config::ConfigurationAggregator) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationaggregator.html +type AWSConfigConfigurationAggregator struct { + + // AccountAggregationSources AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationaggregator.html#cfn-config-configurationaggregator-accountaggregationsources + AccountAggregationSources []AWSConfigConfigurationAggregator_AccountAggregationSource `json:"AccountAggregationSources,omitempty"` + + // ConfigurationAggregatorName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationaggregator.html#cfn-config-configurationaggregator-configurationaggregatorname + ConfigurationAggregatorName string `json:"ConfigurationAggregatorName,omitempty"` + + // OrganizationAggregationSource AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configurationaggregator.html#cfn-config-configurationaggregator-organizationaggregationsource + OrganizationAggregationSource *AWSConfigConfigurationAggregator_OrganizationAggregationSource `json:"OrganizationAggregationSource,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationAggregator) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationAggregator" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigurationAggregator) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSConfigConfigurationAggregator) MarshalJSON() ([]byte, error) { + type Properties AWSConfigConfigurationAggregator + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSConfigConfigurationAggregator) UnmarshalJSON(b []byte) error { + type Properties AWSConfigConfigurationAggregator + 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 = AWSConfigConfigurationAggregator(*res.Properties) + } + + return nil +} + +// GetAllAWSConfigConfigurationAggregatorResources retrieves all AWSConfigConfigurationAggregator items from an AWS CloudFormation template +func (t *Template) GetAllAWSConfigConfigurationAggregatorResources() map[string]AWSConfigConfigurationAggregator { + results := map[string]AWSConfigConfigurationAggregator{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSConfigConfigurationAggregator: + // 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::ConfigurationAggregator" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigurationAggregator + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSConfigConfigurationAggregatorWithName retrieves all AWSConfigConfigurationAggregator items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSConfigConfigurationAggregatorWithName(name string) (AWSConfigConfigurationAggregator, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSConfigConfigurationAggregator: + // 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::ConfigurationAggregator" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSConfigConfigurationAggregator + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSConfigConfigurationAggregator{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_accountaggregationsource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_accountaggregationsource.go new file mode 100644 index 000000000000..984ab49f9d8e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_accountaggregationsource.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSConfigConfigurationAggregator_AccountAggregationSource AWS CloudFormation Resource (AWS::Config::ConfigurationAggregator.AccountAggregationSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-accountaggregationsource.html +type AWSConfigConfigurationAggregator_AccountAggregationSource struct { + + // AccountIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-accountaggregationsource.html#cfn-config-configurationaggregator-accountaggregationsource-accountids + AccountIds []string `json:"AccountIds,omitempty"` + + // AllAwsRegions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-accountaggregationsource.html#cfn-config-configurationaggregator-accountaggregationsource-allawsregions + AllAwsRegions bool `json:"AllAwsRegions,omitempty"` + + // AwsRegions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-accountaggregationsource.html#cfn-config-configurationaggregator-accountaggregationsource-awsregions + AwsRegions []string `json:"AwsRegions,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationAggregator_AccountAggregationSource) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationAggregator.AccountAggregationSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigurationAggregator_AccountAggregationSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_organizationaggregationsource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_organizationaggregationsource.go new file mode 100644 index 000000000000..de386e71451f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationaggregator_organizationaggregationsource.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSConfigConfigurationAggregator_OrganizationAggregationSource AWS CloudFormation Resource (AWS::Config::ConfigurationAggregator.OrganizationAggregationSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-organizationaggregationsource.html +type AWSConfigConfigurationAggregator_OrganizationAggregationSource struct { + + // AllAwsRegions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-organizationaggregationsource.html#cfn-config-configurationaggregator-organizationaggregationsource-allawsregions + AllAwsRegions bool `json:"AllAwsRegions,omitempty"` + + // AwsRegions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-organizationaggregationsource.html#cfn-config-configurationaggregator-organizationaggregationsource-awsregions + AwsRegions []string `json:"AwsRegions,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-config-configurationaggregator-organizationaggregationsource.html#cfn-config-configurationaggregator-organizationaggregationsource-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationAggregator_OrganizationAggregationSource) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationAggregator.OrganizationAggregationSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigurationAggregator_OrganizationAggregationSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fc07702eff6e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationRecorder) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationRecorder" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigurationRecorder) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c476fdfc78a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-configurationrecorder_recordinggroup.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigConfigurationRecorder_RecordingGroup) AWSCloudFormationType() string { + return "AWS::Config::ConfigurationRecorder.RecordingGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigConfigurationRecorder_RecordingGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..71ae1ef5edf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigDeliveryChannel) AWSCloudFormationType() string { + return "AWS::Config::DeliveryChannel" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigDeliveryChannel) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..97494d9153f8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-config-deliverychannel_configsnapshotdeliveryproperties.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties) AWSCloudFormationType() string { + return "AWS::Config::DeliveryChannel.ConfigSnapshotDeliveryProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSConfigDeliveryChannel_ConfigSnapshotDeliveryProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9f0c56c613f9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..ee8227ee47ee --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_field.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_Field) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.Field" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_Field) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..983d2fcf4f98 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterattribute.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterAttribute) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterAttribute" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_ParameterAttribute) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..09371daa1e94 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parameterobject.go @@ -0,0 +1,30 @@ +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-parameterobjects-id + Id string `json:"Id,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterObject) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterObject" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_ParameterObject) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4b4c463a3435 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_parametervalue.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_ParameterValue) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.ParameterValue" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_ParameterValue) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bad84ca37e52 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelineobject.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_PipelineObject) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.PipelineObject" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_PipelineObject) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b7b2aa587425 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-datapipeline-pipeline_pipelinetag.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDataPipelinePipeline_PipelineTag) AWSCloudFormationType() string { + return "AWS::DataPipeline::Pipeline.PipelineTag" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDataPipelinePipeline_PipelineTag) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster.go new file mode 100644 index 000000000000..6566127f2e68 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster.go @@ -0,0 +1,181 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDAXCluster AWS CloudFormation Resource (AWS::DAX::Cluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html +type AWSDAXCluster struct { + + // AvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-availabilityzones + AvailabilityZones []string `json:"AvailabilityZones,omitempty"` + + // ClusterName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-clustername + ClusterName string `json:"ClusterName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-description + Description string `json:"Description,omitempty"` + + // IAMRoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-iamrolearn + IAMRoleARN string `json:"IAMRoleARN,omitempty"` + + // NodeType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-nodetype + NodeType string `json:"NodeType,omitempty"` + + // NotificationTopicARN AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-notificationtopicarn + NotificationTopicARN string `json:"NotificationTopicARN,omitempty"` + + // ParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-parametergroupname + ParameterGroupName string `json:"ParameterGroupName,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // ReplicationFactor AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-replicationfactor + ReplicationFactor int `json:"ReplicationFactor,omitempty"` + + // SSESpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-ssespecification + SSESpecification *AWSDAXCluster_SSESpecification `json:"SSESpecification,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-subnetgroupname + SubnetGroupName string `json:"SubnetGroupName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-cluster.html#cfn-dax-cluster-tags + Tags interface{} `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDAXCluster) AWSCloudFormationType() string { + return "AWS::DAX::Cluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDAXCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSDAXCluster) MarshalJSON() ([]byte, error) { + type Properties AWSDAXCluster + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDAXCluster) UnmarshalJSON(b []byte) error { + type Properties AWSDAXCluster + 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 = AWSDAXCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSDAXClusterResources retrieves all AWSDAXCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSDAXClusterResources() map[string]AWSDAXCluster { + results := map[string]AWSDAXCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDAXCluster: + // 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::DAX::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDAXClusterWithName retrieves all AWSDAXCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDAXClusterWithName(name string) (AWSDAXCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDAXCluster: + // 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::DAX::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDAXCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster_ssespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster_ssespecification.go new file mode 100644 index 000000000000..1b779f63492d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-cluster_ssespecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSDAXCluster_SSESpecification AWS CloudFormation Resource (AWS::DAX::Cluster.SSESpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dax-cluster-ssespecification.html +type AWSDAXCluster_SSESpecification struct { + + // SSEEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dax-cluster-ssespecification.html#cfn-dax-cluster-ssespecification-sseenabled + SSEEnabled bool `json:"SSEEnabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDAXCluster_SSESpecification) AWSCloudFormationType() string { + return "AWS::DAX::Cluster.SSESpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDAXCluster_SSESpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-parametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-parametergroup.go new file mode 100644 index 000000000000..c302ee76ce73 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-parametergroup.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDAXParameterGroup AWS CloudFormation Resource (AWS::DAX::ParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-parametergroup.html +type AWSDAXParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-parametergroup.html#cfn-dax-parametergroup-description + Description string `json:"Description,omitempty"` + + // ParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-parametergroup.html#cfn-dax-parametergroup-parametergroupname + ParameterGroupName string `json:"ParameterGroupName,omitempty"` + + // ParameterNameValues AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-parametergroup.html#cfn-dax-parametergroup-parameternamevalues + ParameterNameValues interface{} `json:"ParameterNameValues,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDAXParameterGroup) AWSCloudFormationType() string { + return "AWS::DAX::ParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDAXParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSDAXParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSDAXParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDAXParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSDAXParameterGroup + 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 = AWSDAXParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSDAXParameterGroupResources retrieves all AWSDAXParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSDAXParameterGroupResources() map[string]AWSDAXParameterGroup { + results := map[string]AWSDAXParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDAXParameterGroup: + // 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::DAX::ParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDAXParameterGroupWithName retrieves all AWSDAXParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDAXParameterGroupWithName(name string) (AWSDAXParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDAXParameterGroup: + // 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::DAX::ParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDAXParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-subnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-subnetgroup.go new file mode 100644 index 000000000000..8ee9d678b174 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dax-subnetgroup.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSDAXSubnetGroup AWS CloudFormation Resource (AWS::DAX::SubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html +type AWSDAXSubnetGroup struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-description + Description string `json:"Description,omitempty"` + + // SubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-subnetgroupname + SubnetGroupName string `json:"SubnetGroupName,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dax-subnetgroup.html#cfn-dax-subnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDAXSubnetGroup) AWSCloudFormationType() string { + return "AWS::DAX::SubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDAXSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSDAXSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSDAXSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSDAXSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSDAXSubnetGroup + 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 = AWSDAXSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSDAXSubnetGroupResources retrieves all AWSDAXSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSDAXSubnetGroupResources() map[string]AWSDAXSubnetGroup { + results := map[string]AWSDAXSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSDAXSubnetGroup: + // 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::DAX::SubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSDAXSubnetGroupWithName retrieves all AWSDAXSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSDAXSubnetGroupWithName(name string) (AWSDAXSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSDAXSubnetGroup: + // 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::DAX::SubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSDAXSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSDAXSubnetGroup{}, errors.New("resource not found") +} 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 000000000000..c8740b448739 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad.go @@ -0,0 +1,151 @@ +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"` + + // Edition AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-directoryservice-microsoftad.html#cfn-directoryservice-microsoftad-edition + Edition string `json:"Edition,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceMicrosoftAD) AWSCloudFormationType() string { + return "AWS::DirectoryService::MicrosoftAD" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDirectoryServiceMicrosoftAD) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f5acce2a930b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-microsoftad_vpcsettings.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceMicrosoftAD_VpcSettings) AWSCloudFormationType() string { + return "AWS::DirectoryService::MicrosoftAD.VpcSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDirectoryServiceMicrosoftAD_VpcSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7c23e8b22798 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead.go @@ -0,0 +1,156 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceSimpleAD) AWSCloudFormationType() string { + return "AWS::DirectoryService::SimpleAD" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDirectoryServiceSimpleAD) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..b0f152fdc219 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-directoryservice-simplead_vpcsettings.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDirectoryServiceSimpleAD_VpcSettings) AWSCloudFormationType() string { + return "AWS::DirectoryService::SimpleAD.VpcSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDirectoryServiceSimpleAD_VpcSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e78a390cea84 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-certificate.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSCertificate) AWSCloudFormationType() string { + return "AWS::DMS::Certificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f9a096c9fb91 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint.go @@ -0,0 +1,196 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSEndpoint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..10b70f04e4f5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_dynamodbsettings.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_DynamoDbSettings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.DynamoDbSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSEndpoint_DynamoDbSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fa45206e2379 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_mongodbsettings.go @@ -0,0 +1,75 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_MongoDbSettings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.MongoDbSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSEndpoint_MongoDbSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c7095414e50e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-endpoint_s3settings.go @@ -0,0 +1,55 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEndpoint_S3Settings) AWSCloudFormationType() string { + return "AWS::DMS::Endpoint.S3Settings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSEndpoint_S3Settings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..45e43c0fd7e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-eventsubscription.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSEventSubscription) AWSCloudFormationType() string { + return "AWS::DMS::EventSubscription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSEventSubscription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6b304412d332 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationinstance.go @@ -0,0 +1,186 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationInstance) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationInstance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSReplicationInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6fc3f13a8536 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationsubnetgroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationSubnetGroup) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationSubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSReplicationSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..79d1039cc64f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dms-replicationtask.go @@ -0,0 +1,161 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDMSReplicationTask) AWSCloudFormationType() string { + return "AWS::DMS::ReplicationTask" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDMSReplicationTask) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..8dcfa1173237 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table.go @@ -0,0 +1,171 @@ +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: false + // 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"` + + // PointInTimeRecoverySpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-pointintimerecoveryspecification + PointInTimeRecoverySpecification *AWSDynamoDBTable_PointInTimeRecoverySpecification `json:"PointInTimeRecoverySpecification,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"` + + // SSESpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-ssespecification + SSESpecification *AWSDynamoDBTable_SSESpecification `json:"SSESpecification,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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-tags + Tags []Tag `json:"Tags,omitempty"` + + // TimeToLiveSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#cfn-dynamodb-table-timetolivespecification + TimeToLiveSpecification *AWSDynamoDBTable_TimeToLiveSpecification `json:"TimeToLiveSpecification,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f9ea352251af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_attributedefinition.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_AttributeDefinition) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.AttributeDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_AttributeDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c39cd94d0b82 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_globalsecondaryindex.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_GlobalSecondaryIndex) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.GlobalSecondaryIndex" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_GlobalSecondaryIndex) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..42c34534b07c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_keyschema.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_KeySchema) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.KeySchema" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_KeySchema) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c18f7a695768 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_localsecondaryindex.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_LocalSecondaryIndex) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.LocalSecondaryIndex" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_LocalSecondaryIndex) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_pointintimerecoveryspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_pointintimerecoveryspecification.go new file mode 100644 index 000000000000..674bd3ad30e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_pointintimerecoveryspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSDynamoDBTable_PointInTimeRecoverySpecification AWS CloudFormation Resource (AWS::DynamoDB::Table.PointInTimeRecoverySpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-pointintimerecoveryspecification.html +type AWSDynamoDBTable_PointInTimeRecoverySpecification struct { + + // PointInTimeRecoveryEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-pointintimerecoveryspecification.html#cfn-dynamodb-table-pointintimerecoveryspecification-pointintimerecoveryenabled + PointInTimeRecoveryEnabled bool `json:"PointInTimeRecoveryEnabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_PointInTimeRecoverySpecification) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.PointInTimeRecoverySpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_PointInTimeRecoverySpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f5a72cab2d82 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_projection.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_Projection) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.Projection" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_Projection) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fee40f026877 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_provisionedthroughput.go @@ -0,0 +1,30 @@ +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 int64 `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 int64 `json:"WriteCapacityUnits,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_ProvisionedThroughput) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.ProvisionedThroughput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_ProvisionedThroughput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_ssespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_ssespecification.go new file mode 100644 index 000000000000..966171b68a92 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_ssespecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSDynamoDBTable_SSESpecification AWS CloudFormation Resource (AWS::DynamoDB::Table.SSESpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-ssespecification.html +type AWSDynamoDBTable_SSESpecification struct { + + // SSEEnabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-ssespecification.html#cfn-dynamodb-table-ssespecification-sseenabled + SSEEnabled bool `json:"SSEEnabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_SSESpecification) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.SSESpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_SSESpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d1651c81a953 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_streamspecification.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_StreamSpecification) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.StreamSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_StreamSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_timetolivespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_timetolivespecification.go new file mode 100644 index 000000000000..08174f468cb8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-dynamodb-table_timetolivespecification.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSDynamoDBTable_TimeToLiveSpecification AWS CloudFormation Resource (AWS::DynamoDB::Table.TimeToLiveSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-timetolivespecification.html +type AWSDynamoDBTable_TimeToLiveSpecification struct { + + // AttributeName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-timetolivespecification.html#cfn-dynamodb-timetolivespecification-attributename + AttributeName string `json:"AttributeName,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-timetolivespecification.html#cfn-dynamodb-timetolivespecification-enabled + Enabled bool `json:"Enabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSDynamoDBTable_TimeToLiveSpecification) AWSCloudFormationType() string { + return "AWS::DynamoDB::Table.TimeToLiveSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSDynamoDBTable_TimeToLiveSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2d770d6547ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-customergateway.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2CustomerGateway) AWSCloudFormationType() string { + return "AWS::EC2::CustomerGateway" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2CustomerGateway) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..e901514fde5e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-dhcpoptions.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2DHCPOptions) AWSCloudFormationType() string { + return "AWS::EC2::DHCPOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2DHCPOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6859096efea4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-egressonlyinternetgateway.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EgressOnlyInternetGateway) AWSCloudFormationType() string { + return "AWS::EC2::EgressOnlyInternetGateway" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2EgressOnlyInternetGateway) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5af3d5836aef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eip.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EIP) AWSCloudFormationType() string { + return "AWS::EC2::EIP" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2EIP) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c4e729fa2531 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-eipassociation.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2EIPAssociation) AWSCloudFormationType() string { + return "AWS::EC2::EIPAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2EIPAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..8117d5c47cee --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-flowlog.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2FlowLog) AWSCloudFormationType() string { + return "AWS::EC2::FlowLog" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2FlowLog) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9780961d69bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-host.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Host) AWSCloudFormationType() string { + return "AWS::EC2::Host" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Host) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..0b377a43648a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance.go @@ -0,0 +1,289 @@ +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"` + + // CreditSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-creditspecification + CreditSpecification *AWSEC2Instance_CreditSpecification `json:"CreditSpecification,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"` + + // ElasticGpuSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticgpuspecifications + ElasticGpuSpecifications []AWSEC2Instance_ElasticGpuSpecification `json:"ElasticGpuSpecifications,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: false + // 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"` + + // LaunchTemplate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-launchtemplate + LaunchTemplate *AWSEC2Instance_LaunchTemplateSpecification `json:"LaunchTemplate,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"` + + // _creationPolicy represents a CloudFormation CreationPolicy + _creationPolicy *CreationPolicy + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance) AWSCloudFormationType() string { + return "AWS::EC2::Instance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// SetCreationPolicy applies an AWS CloudFormation CreationPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html +func (r *AWSEC2Instance) SetCreationPolicy(policy *CreationPolicy) { + r._creationPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + + CreationPolicy *CreationPolicy `json:"CreationPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + + CreationPolicy: r._creationPolicy, + }) +} + +// 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 000000000000..106638a69d29 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_associationparameter.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_AssociationParameter) AWSCloudFormationType() string { + return "AWS::EC2::Instance.AssociationParameter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_AssociationParameter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c5e5a799c384 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_blockdevicemapping.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::EC2::Instance.BlockDeviceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_BlockDeviceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_creditspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_creditspecification.go new file mode 100644 index 000000000000..9b6ee2c2b8dc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_creditspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2Instance_CreditSpecification AWS CloudFormation Resource (AWS::EC2::Instance.CreditSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html +type AWSEC2Instance_CreditSpecification struct { + + // CPUCredits AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html#cfn-ec2-instance-creditspecification-cpucredits + CPUCredits string `json:"CPUCredits,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_CreditSpecification) AWSCloudFormationType() string { + return "AWS::EC2::Instance.CreditSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_CreditSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f8522ff6afac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ebs.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_Ebs) AWSCloudFormationType() string { + return "AWS::EC2::Instance.Ebs" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_Ebs) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_elasticgpuspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_elasticgpuspecification.go new file mode 100644 index 000000000000..b4a94f05986b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_elasticgpuspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2Instance_ElasticGpuSpecification AWS CloudFormation Resource (AWS::EC2::Instance.ElasticGpuSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html +type AWSEC2Instance_ElasticGpuSpecification struct { + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html#cfn-ec2-instance-elasticgpuspecification-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_ElasticGpuSpecification) AWSCloudFormationType() string { + return "AWS::EC2::Instance.ElasticGpuSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_ElasticGpuSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8ecbf6d58387 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_instanceipv6address.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::Instance.InstanceIpv6Address" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_InstanceIpv6Address) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_launchtemplatespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_launchtemplatespecification.go new file mode 100644 index 000000000000..f8c176cc19eb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_launchtemplatespecification.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSEC2Instance_LaunchTemplateSpecification AWS CloudFormation Resource (AWS::EC2::Instance.LaunchTemplateSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html +type AWSEC2Instance_LaunchTemplateSpecification struct { + + // LaunchTemplateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplateid + LaunchTemplateId string `json:"LaunchTemplateId,omitempty"` + + // LaunchTemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplatename + LaunchTemplateName string `json:"LaunchTemplateName,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_LaunchTemplateSpecification) AWSCloudFormationType() string { + return "AWS::EC2::Instance.LaunchTemplateSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_LaunchTemplateSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e98451004cdf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_networkinterface.go @@ -0,0 +1,80 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_NetworkInterface) AWSCloudFormationType() string { + return "AWS::EC2::Instance.NetworkInterface" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_NetworkInterface) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..96146f0b1b80 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_nodevice.go @@ -0,0 +1,20 @@ +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 { + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_NoDevice) AWSCloudFormationType() string { + return "AWS::EC2::Instance.NoDevice" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_NoDevice) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..82a893409393 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_privateipaddressspecification.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::Instance.PrivateIpAddressSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_PrivateIpAddressSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c9926e7bee61 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_ssmassociation.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_SsmAssociation) AWSCloudFormationType() string { + return "AWS::EC2::Instance.SsmAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_SsmAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..affba41bd7c3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-instance_volume.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Instance_Volume) AWSCloudFormationType() string { + return "AWS::EC2::Instance.Volume" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Instance_Volume) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fd153197e00b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-internetgateway.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2InternetGateway) AWSCloudFormationType() string { + return "AWS::EC2::InternetGateway" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2InternetGateway) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-launchtemplate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate.go new file mode 100644 index 000000000000..8574cca1fd89 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2LaunchTemplate AWS CloudFormation Resource (AWS::EC2::LaunchTemplate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html +type AWSEC2LaunchTemplate struct { + + // LaunchTemplateData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatedata + LaunchTemplateData *AWSEC2LaunchTemplate_LaunchTemplateData `json:"LaunchTemplateData,omitempty"` + + // LaunchTemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatename + LaunchTemplateName string `json:"LaunchTemplateName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSEC2LaunchTemplate) MarshalJSON() ([]byte, error) { + type Properties AWSEC2LaunchTemplate + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2LaunchTemplate) UnmarshalJSON(b []byte) error { + type Properties AWSEC2LaunchTemplate + 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 = AWSEC2LaunchTemplate(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2LaunchTemplateResources retrieves all AWSEC2LaunchTemplate items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2LaunchTemplateResources() map[string]AWSEC2LaunchTemplate { + results := map[string]AWSEC2LaunchTemplate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2LaunchTemplate: + // 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::LaunchTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2LaunchTemplate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2LaunchTemplateWithName retrieves all AWSEC2LaunchTemplate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2LaunchTemplateWithName(name string) (AWSEC2LaunchTemplate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2LaunchTemplate: + // 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::LaunchTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2LaunchTemplate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2LaunchTemplate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_blockdevicemapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_blockdevicemapping.go new file mode 100644 index 000000000000..bfe34e7e1ca0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_blockdevicemapping.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSEC2LaunchTemplate_BlockDeviceMapping AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.BlockDeviceMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html +type AWSEC2LaunchTemplate_BlockDeviceMapping struct { + + // DeviceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-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-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs + Ebs *AWSEC2LaunchTemplate_Ebs `json:"Ebs,omitempty"` + + // NoDevice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-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-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-virtualname + VirtualName string `json:"VirtualName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.BlockDeviceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_BlockDeviceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_creditspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_creditspecification.go new file mode 100644 index 000000000000..52d64b454049 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_creditspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2LaunchTemplate_CreditSpecification AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.CreditSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-creditspecification.html +type AWSEC2LaunchTemplate_CreditSpecification struct { + + // CpuCredits AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-creditspecification.html#cfn-ec2-launchtemplate-launchtemplatedata-creditspecification-cpucredits + CpuCredits string `json:"CpuCredits,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_CreditSpecification) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.CreditSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_CreditSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ebs.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ebs.go new file mode 100644 index 000000000000..739775e36cc7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ebs.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSEC2LaunchTemplate_Ebs AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.Ebs) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html +type AWSEC2LaunchTemplate_Ebs struct { + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-iops + Iops int `json:"Iops,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // SnapshotId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-snapshotid + SnapshotId string `json:"SnapshotId,omitempty"` + + // VolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-volumesize + VolumeSize int `json:"VolumeSize,omitempty"` + + // VolumeType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-volumetype + VolumeType string `json:"VolumeType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_Ebs) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.Ebs" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_Ebs) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_elasticgpuspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_elasticgpuspecification.go new file mode 100644 index 000000000000..a973a4f02fb2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_elasticgpuspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2LaunchTemplate_ElasticGpuSpecification AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.ElasticGpuSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-elasticgpuspecification.html +type AWSEC2LaunchTemplate_ElasticGpuSpecification struct { + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-elasticgpuspecification.html#cfn-ec2-launchtemplate-elasticgpuspecification-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_ElasticGpuSpecification) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.ElasticGpuSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_ElasticGpuSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_iaminstanceprofile.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_iaminstanceprofile.go new file mode 100644 index 000000000000..ff7bf8530e5b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_iaminstanceprofile.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2LaunchTemplate_IamInstanceProfile AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.IamInstanceProfile) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html +type AWSEC2LaunchTemplate_IamInstanceProfile struct { + + // Arn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile-arn + Arn string `json:"Arn,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_IamInstanceProfile) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.IamInstanceProfile" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_IamInstanceProfile) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_instancemarketoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_instancemarketoptions.go new file mode 100644 index 000000000000..e4583cdb583a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_instancemarketoptions.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2LaunchTemplate_InstanceMarketOptions AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.InstanceMarketOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html +type AWSEC2LaunchTemplate_InstanceMarketOptions struct { + + // MarketType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-markettype + MarketType string `json:"MarketType,omitempty"` + + // SpotOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions + SpotOptions *AWSEC2LaunchTemplate_SpotOptions `json:"SpotOptions,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_InstanceMarketOptions) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.InstanceMarketOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_InstanceMarketOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ipv6add.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ipv6add.go new file mode 100644 index 000000000000..c57a5c3ae8d8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_ipv6add.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2LaunchTemplate_Ipv6Add AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.Ipv6Add) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-ipv6add.html +type AWSEC2LaunchTemplate_Ipv6Add struct { + + // Ipv6Address AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-ipv6add.html#cfn-ec2-launchtemplate-ipv6add-ipv6address + Ipv6Address string `json:"Ipv6Address,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_Ipv6Add) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.Ipv6Add" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_Ipv6Add) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_launchtemplatedata.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_launchtemplatedata.go new file mode 100644 index 000000000000..cff006be1c70 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_launchtemplatedata.go @@ -0,0 +1,120 @@ +package cloudformation + +// AWSEC2LaunchTemplate_LaunchTemplateData AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.LaunchTemplateData) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html +type AWSEC2LaunchTemplate_LaunchTemplateData struct { + + // BlockDeviceMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-blockdevicemappings + BlockDeviceMappings []AWSEC2LaunchTemplate_BlockDeviceMapping `json:"BlockDeviceMappings,omitempty"` + + // CreditSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-creditspecification + CreditSpecification *AWSEC2LaunchTemplate_CreditSpecification `json:"CreditSpecification,omitempty"` + + // DisableApiTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-disableapitermination + DisableApiTermination bool `json:"DisableApiTermination,omitempty"` + + // EbsOptimized AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // ElasticGpuSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-elasticgpuspecifications + ElasticGpuSpecifications []AWSEC2LaunchTemplate_ElasticGpuSpecification `json:"ElasticGpuSpecifications,omitempty"` + + // IamInstanceProfile AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile + IamInstanceProfile *AWSEC2LaunchTemplate_IamInstanceProfile `json:"IamInstanceProfile,omitempty"` + + // ImageId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-imageid + ImageId string `json:"ImageId,omitempty"` + + // InstanceInitiatedShutdownBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instanceinitiatedshutdownbehavior + InstanceInitiatedShutdownBehavior string `json:"InstanceInitiatedShutdownBehavior,omitempty"` + + // InstanceMarketOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions + InstanceMarketOptions *AWSEC2LaunchTemplate_InstanceMarketOptions `json:"InstanceMarketOptions,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // KernelId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-kernelid + KernelId string `json:"KernelId,omitempty"` + + // KeyName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-keyname + KeyName string `json:"KeyName,omitempty"` + + // Monitoring AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-monitoring + Monitoring *AWSEC2LaunchTemplate_Monitoring `json:"Monitoring,omitempty"` + + // NetworkInterfaces AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-networkinterfaces + NetworkInterfaces []AWSEC2LaunchTemplate_NetworkInterface `json:"NetworkInterfaces,omitempty"` + + // Placement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-placement + Placement *AWSEC2LaunchTemplate_Placement `json:"Placement,omitempty"` + + // RamDiskId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-ramdiskid + RamDiskId string `json:"RamDiskId,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // TagSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-tagspecifications + TagSpecifications []AWSEC2LaunchTemplate_TagSpecification `json:"TagSpecifications,omitempty"` + + // UserData AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-userdata + UserData string `json:"UserData,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_LaunchTemplateData) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.LaunchTemplateData" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_LaunchTemplateData) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_monitoring.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_monitoring.go new file mode 100644 index 000000000000..3f3f81fb651e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_monitoring.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2LaunchTemplate_Monitoring AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.Monitoring) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-monitoring.html +type AWSEC2LaunchTemplate_Monitoring struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-monitoring.html#cfn-ec2-launchtemplate-launchtemplatedata-monitoring-enabled + Enabled bool `json:"Enabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_Monitoring) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.Monitoring" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_Monitoring) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_networkinterface.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_networkinterface.go new file mode 100644 index 000000000000..5a04cd9062d1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_networkinterface.go @@ -0,0 +1,80 @@ +package cloudformation + +// AWSEC2LaunchTemplate_NetworkInterface AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.NetworkInterface) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html +type AWSEC2LaunchTemplate_NetworkInterface struct { + + // AssociatePublicIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-associatepublicipaddress + AssociatePublicIpAddress bool `json:"AssociatePublicIpAddress,omitempty"` + + // DeleteOnTermination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-deleteontermination + DeleteOnTermination bool `json:"DeleteOnTermination,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-description + Description string `json:"Description,omitempty"` + + // DeviceIndex AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-deviceindex + DeviceIndex int `json:"DeviceIndex,omitempty"` + + // Groups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-groups + Groups []string `json:"Groups,omitempty"` + + // Ipv6AddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-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-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-ipv6addresses + Ipv6Addresses []AWSEC2LaunchTemplate_Ipv6Add `json:"Ipv6Addresses,omitempty"` + + // NetworkInterfaceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-networkinterfaceid + NetworkInterfaceId string `json:"NetworkInterfaceId,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` + + // PrivateIpAddresses AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-privateipaddresses + PrivateIpAddresses []AWSEC2LaunchTemplate_PrivateIpAdd `json:"PrivateIpAddresses,omitempty"` + + // SecondaryPrivateIpAddressCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-secondaryprivateipaddresscount + SecondaryPrivateIpAddressCount int `json:"SecondaryPrivateIpAddressCount,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_NetworkInterface) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.NetworkInterface" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_NetworkInterface) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_placement.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_placement.go new file mode 100644 index 000000000000..f7d744a03840 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_placement.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSEC2LaunchTemplate_Placement AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.Placement) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html +type AWSEC2LaunchTemplate_Placement struct { + + // Affinity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-affinity + Affinity string `json:"Affinity,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // GroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-groupname + GroupName string `json:"GroupName,omitempty"` + + // HostId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-hostid + HostId string `json:"HostId,omitempty"` + + // Tenancy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-tenancy + Tenancy string `json:"Tenancy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_Placement) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.Placement" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_Placement) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_privateipadd.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_privateipadd.go new file mode 100644 index 000000000000..320462fd56cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_privateipadd.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2LaunchTemplate_PrivateIpAdd AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.PrivateIpAdd) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html +type AWSEC2LaunchTemplate_PrivateIpAdd struct { + + // Primary AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html#cfn-ec2-launchtemplate-privateipadd-primary + Primary bool `json:"Primary,omitempty"` + + // PrivateIpAddress AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html#cfn-ec2-launchtemplate-privateipadd-privateipaddress + PrivateIpAddress string `json:"PrivateIpAddress,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_PrivateIpAdd) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.PrivateIpAdd" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_PrivateIpAdd) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_spotoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_spotoptions.go new file mode 100644 index 000000000000..0986e1a394ed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_spotoptions.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSEC2LaunchTemplate_SpotOptions AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.SpotOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html +type AWSEC2LaunchTemplate_SpotOptions struct { + + // InstanceInterruptionBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-instanceinterruptionbehavior + InstanceInterruptionBehavior string `json:"InstanceInterruptionBehavior,omitempty"` + + // MaxPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-maxprice + MaxPrice string `json:"MaxPrice,omitempty"` + + // SpotInstanceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-spotinstancetype + SpotInstanceType string `json:"SpotInstanceType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_SpotOptions) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.SpotOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_SpotOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_tagspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_tagspecification.go new file mode 100644 index 000000000000..0a9f4165701e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-launchtemplate_tagspecification.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2LaunchTemplate_TagSpecification AWS CloudFormation Resource (AWS::EC2::LaunchTemplate.TagSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html +type AWSEC2LaunchTemplate_TagSpecification struct { + + // ResourceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html#cfn-ec2-launchtemplate-tagspecification-resourcetype + ResourceType string `json:"ResourceType,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html#cfn-ec2-launchtemplate-tagspecification-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2LaunchTemplate_TagSpecification) AWSCloudFormationType() string { + return "AWS::EC2::LaunchTemplate.TagSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2LaunchTemplate_TagSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..31bbb46e1f56 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-natgateway.go @@ -0,0 +1,131 @@ +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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NatGateway) AWSCloudFormationType() string { + return "AWS::EC2::NatGateway" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NatGateway) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2de90d746b3d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkacl.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAcl) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAcl" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkAcl) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6f8f173b435e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry.go @@ -0,0 +1,161 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkAclEntry) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..caa6fda42547 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_icmp.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry_Icmp) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry.Icmp" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkAclEntry_Icmp) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c7e18856131a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkaclentry_portrange.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkAclEntry_PortRange) AWSCloudFormationType() string { + return "AWS::EC2::NetworkAclEntry.PortRange" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkAclEntry_PortRange) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e43aeb5d0e11 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface.go @@ -0,0 +1,171 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkInterface) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..803016ebb331 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_instanceipv6address.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface.InstanceIpv6Address" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkInterface_InstanceIpv6Address) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b8ba38478f0e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterface_privateipaddressspecification.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterface_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterface.PrivateIpAddressSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkInterface_PrivateIpAddressSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ec6b85716fe0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfaceattachment.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterfaceAttachment) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterfaceAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkInterfaceAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..18c740bbe44c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-networkinterfacepermission.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2NetworkInterfacePermission) AWSCloudFormationType() string { + return "AWS::EC2::NetworkInterfacePermission" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2NetworkInterfacePermission) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..af4b214bc829 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-placementgroup.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2PlacementGroup) AWSCloudFormationType() string { + return "AWS::EC2::PlacementGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2PlacementGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..df4bfa47ecf0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-route.go @@ -0,0 +1,161 @@ +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"` + + // EgressOnlyInternetGatewayId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-egressonlyinternetgatewayid + EgressOnlyInternetGatewayId string `json:"EgressOnlyInternetGatewayId,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Route) AWSCloudFormationType() string { + return "AWS::EC2::Route" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Route) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d8bada6cbea1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-routetable.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2RouteTable) AWSCloudFormationType() string { + return "AWS::EC2::RouteTable" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2RouteTable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..0ce650b1a353 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SecurityGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..a1ce15ed952f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_egress.go @@ -0,0 +1,60 @@ +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"` + + // Description 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-description + Description string `json:"Description,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup_Egress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup.Egress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SecurityGroup_Egress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bd96fd3b9fb0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroup_ingress.go @@ -0,0 +1,65 @@ +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"` + + // Description 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-description + Description string `json:"Description,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroup_Ingress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroup.Ingress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SecurityGroup_Ingress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..784e5365170b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupegress.go @@ -0,0 +1,161 @@ +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"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-description + Description string `json:"Description,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroupEgress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroupEgress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SecurityGroupEgress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5e57bcd10fc4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-securitygroupingress.go @@ -0,0 +1,171 @@ +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"` + + // Description 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-description + Description string `json:"Description,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::EC2::SecurityGroupIngress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SecurityGroupIngress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..df370a259032 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4f2e58a438ce --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_blockdevicemapping.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.BlockDeviceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_BlockDeviceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b3bbc17ea9c8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_ebsblockdevice.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_EbsBlockDevice) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.EbsBlockDevice" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_EbsBlockDevice) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_fleetlaunchtemplatespecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_fleetlaunchtemplatespecification.go new file mode 100644 index 000000000000..716a8076d9f6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_fleetlaunchtemplatespecification.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSEC2SpotFleet_FleetLaunchTemplateSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.FleetLaunchTemplateSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html +type AWSEC2SpotFleet_FleetLaunchTemplateSpecification struct { + + // LaunchTemplateId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-launchtemplateid + LaunchTemplateId string `json:"LaunchTemplateId,omitempty"` + + // LaunchTemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-launchtemplatename + LaunchTemplateName string `json:"LaunchTemplateName,omitempty"` + + // Version AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_FleetLaunchTemplateSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.FleetLaunchTemplateSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_FleetLaunchTemplateSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5d815efa744e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_groupidentifier.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_GroupIdentifier) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.GroupIdentifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_GroupIdentifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..589d91b18a72 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_iaminstanceprofilespecification.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_IamInstanceProfileSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.IamInstanceProfileSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_IamInstanceProfileSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..340f33c724e0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instanceipv6address.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_InstanceIpv6Address) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.InstanceIpv6Address" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_InstanceIpv6Address) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..157adcb2c8a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_instancenetworkinterfacespecification.go @@ -0,0 +1,75 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.InstanceNetworkInterfaceSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateconfig.go new file mode 100644 index 000000000000..1a0406cfb6bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2SpotFleet_LaunchTemplateConfig AWS CloudFormation Resource (AWS::EC2::SpotFleet.LaunchTemplateConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html +type AWSEC2SpotFleet_LaunchTemplateConfig struct { + + // LaunchTemplateSpecification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html#cfn-ec2-spotfleet-launchtemplateconfig-launchtemplatespecification + LaunchTemplateSpecification *AWSEC2SpotFleet_FleetLaunchTemplateSpecification `json:"LaunchTemplateSpecification,omitempty"` + + // Overrides AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html#cfn-ec2-spotfleet-launchtemplateconfig-overrides + Overrides []AWSEC2SpotFleet_LaunchTemplateOverrides `json:"Overrides,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_LaunchTemplateConfig) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.LaunchTemplateConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_LaunchTemplateConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateoverrides.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateoverrides.go new file mode 100644 index 000000000000..af484014bdf7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_launchtemplateoverrides.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSEC2SpotFleet_LaunchTemplateOverrides AWS CloudFormation Resource (AWS::EC2::SpotFleet.LaunchTemplateOverrides) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html +type AWSEC2SpotFleet_LaunchTemplateOverrides struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // SpotPrice AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-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-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // WeightedCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-weightedcapacity + WeightedCapacity float64 `json:"WeightedCapacity,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_LaunchTemplateOverrides) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.LaunchTemplateOverrides" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_LaunchTemplateOverrides) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7ff67467b763 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_privateipaddressspecification.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_PrivateIpAddressSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.PrivateIpAddressSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_PrivateIpAddressSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..624c40e26c91 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetlaunchspecification.go @@ -0,0 +1,105 @@ +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"` + + // TagSpecifications 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-tagspecifications + TagSpecifications []AWSEC2SpotFleet_SpotFleetTagSpecification `json:"TagSpecifications,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetLaunchSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetLaunchSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_SpotFleetLaunchSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3273af339189 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetmonitoring.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetMonitoring) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetMonitoring" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_SpotFleetMonitoring) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5cd5c5262115 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleetrequestconfigdata.go @@ -0,0 +1,80 @@ +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: false + // 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"` + + // LaunchTemplateConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-launchtemplateconfigs + LaunchTemplateConfigs []AWSEC2SpotFleet_LaunchTemplateConfig `json:"LaunchTemplateConfigs,omitempty"` + + // ReplaceUnhealthyInstances AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-replaceunhealthyinstances + ReplaceUnhealthyInstances bool `json:"ReplaceUnhealthyInstances,omitempty"` + + // SpotPrice AWS CloudFormation Property + // Required: false + // 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"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-type + Type string `json:"Type,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetRequestConfigData" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleettagspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleettagspecification.go new file mode 100644 index 000000000000..beffa6d0506a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotfleettagspecification.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEC2SpotFleet_SpotFleetTagSpecification AWS CloudFormation Resource (AWS::EC2::SpotFleet.SpotFleetTagSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-tagspecifications.html +type AWSEC2SpotFleet_SpotFleetTagSpecification struct { + + // ResourceType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-tagspecifications.html#cfn-ec2-spotfleet-spotfleettagspecification-resourcetype + ResourceType string `json:"ResourceType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotFleetTagSpecification) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotFleetTagSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_SpotFleetTagSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a05a5dfd40fb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-spotfleet_spotplacement.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SpotFleet_SpotPlacement) AWSCloudFormationType() string { + return "AWS::EC2::SpotFleet.SpotPlacement" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SpotFleet_SpotPlacement) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..151a1ab105a1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnet.go @@ -0,0 +1,151 @@ +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 { + + // AssignIpv6AddressOnCreation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-assignipv6addressoncreation + AssignIpv6AddressOnCreation bool `json:"AssignIpv6AddressOnCreation,omitempty"` + + // 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"` + + // Ipv6CidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-ipv6cidrblock + Ipv6CidrBlock string `json:"Ipv6CidrBlock,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Subnet) AWSCloudFormationType() string { + return "AWS::EC2::Subnet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Subnet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..a5312eaa2709 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetcidrblock.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetCidrBlock) AWSCloudFormationType() string { + return "AWS::EC2::SubnetCidrBlock" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SubnetCidrBlock) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2ee45e969b2e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetnetworkaclassociation.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetNetworkAclAssociation) AWSCloudFormationType() string { + return "AWS::EC2::SubnetNetworkAclAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SubnetNetworkAclAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9bcdfd5dd870 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-subnetroutetableassociation.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2SubnetRouteTableAssociation) AWSCloudFormationType() string { + return "AWS::EC2::SubnetRouteTableAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2SubnetRouteTableAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9df1a6ed3c82 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-trunkinterfaceassociation.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2TrunkInterfaceAssociation) AWSCloudFormationType() string { + return "AWS::EC2::TrunkInterfaceAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2TrunkInterfaceAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..65ecba93db70 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volume.go @@ -0,0 +1,161 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2Volume) AWSCloudFormationType() string { + return "AWS::EC2::Volume" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2Volume) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7fc2e1f5ccf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-volumeattachment.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VolumeAttachment) AWSCloudFormationType() string { + return "AWS::EC2::VolumeAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VolumeAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9bc461b72da7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpc.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPC) AWSCloudFormationType() string { + return "AWS::EC2::VPC" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPC) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..da56408c5980 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpccidrblock.go @@ -0,0 +1,131 @@ +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"` + + // CidrBlock AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-cidrblock + CidrBlock string `json:"CidrBlock,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCCidrBlock) AWSCloudFormationType() string { + return "AWS::EC2::VPCCidrBlock" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCCidrBlock) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..75932cd7631f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcdhcpoptionsassociation.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCDHCPOptionsAssociation) AWSCloudFormationType() string { + return "AWS::EC2::VPCDHCPOptionsAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCDHCPOptionsAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..33f99fd47e9e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpoint.go @@ -0,0 +1,156 @@ +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 { + + // IsPrivateDnsEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-isprivatednsenabled + IsPrivateDnsEnabled bool `json:"IsPrivateDnsEnabled,omitempty"` + + // 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"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,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"` + + // SubnetIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // VPCEndpointType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcendpointtype + VPCEndpointType string `json:"VPCEndpointType,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCEndpoint) AWSCloudFormationType() string { + return "AWS::EC2::VPCEndpoint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCEndpoint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-vpcendpointconnectionnotification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpointconnectionnotification.go new file mode 100644 index 000000000000..75870e04e336 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpointconnectionnotification.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCEndpointConnectionNotification AWS CloudFormation Resource (AWS::EC2::VPCEndpointConnectionNotification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html +type AWSEC2VPCEndpointConnectionNotification struct { + + // ConnectionEvents AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionevents + ConnectionEvents []string `json:"ConnectionEvents,omitempty"` + + // ConnectionNotificationArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionnotificationarn + ConnectionNotificationArn string `json:"ConnectionNotificationArn,omitempty"` + + // ServiceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-serviceid + ServiceId string `json:"ServiceId,omitempty"` + + // VPCEndpointId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-vpcendpointid + VPCEndpointId string `json:"VPCEndpointId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCEndpointConnectionNotification) AWSCloudFormationType() string { + return "AWS::EC2::VPCEndpointConnectionNotification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCEndpointConnectionNotification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSEC2VPCEndpointConnectionNotification) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCEndpointConnectionNotification + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCEndpointConnectionNotification) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCEndpointConnectionNotification + 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 = AWSEC2VPCEndpointConnectionNotification(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCEndpointConnectionNotificationResources retrieves all AWSEC2VPCEndpointConnectionNotification items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCEndpointConnectionNotificationResources() map[string]AWSEC2VPCEndpointConnectionNotification { + results := map[string]AWSEC2VPCEndpointConnectionNotification{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCEndpointConnectionNotification: + // 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::VPCEndpointConnectionNotification" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpointConnectionNotification + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCEndpointConnectionNotificationWithName retrieves all AWSEC2VPCEndpointConnectionNotification items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCEndpointConnectionNotificationWithName(name string) (AWSEC2VPCEndpointConnectionNotification, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCEndpointConnectionNotification: + // 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::VPCEndpointConnectionNotification" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpointConnectionNotification + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCEndpointConnectionNotification{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpointservicepermissions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpointservicepermissions.go new file mode 100644 index 000000000000..d49429645061 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcendpointservicepermissions.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEC2VPCEndpointServicePermissions AWS CloudFormation Resource (AWS::EC2::VPCEndpointServicePermissions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html +type AWSEC2VPCEndpointServicePermissions struct { + + // AllowedPrincipals AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-allowedprincipals + AllowedPrincipals []string `json:"AllowedPrincipals,omitempty"` + + // ServiceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-serviceid + ServiceId string `json:"ServiceId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCEndpointServicePermissions) AWSCloudFormationType() string { + return "AWS::EC2::VPCEndpointServicePermissions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCEndpointServicePermissions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSEC2VPCEndpointServicePermissions) MarshalJSON() ([]byte, error) { + type Properties AWSEC2VPCEndpointServicePermissions + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEC2VPCEndpointServicePermissions) UnmarshalJSON(b []byte) error { + type Properties AWSEC2VPCEndpointServicePermissions + 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 = AWSEC2VPCEndpointServicePermissions(*res.Properties) + } + + return nil +} + +// GetAllAWSEC2VPCEndpointServicePermissionsResources retrieves all AWSEC2VPCEndpointServicePermissions items from an AWS CloudFormation template +func (t *Template) GetAllAWSEC2VPCEndpointServicePermissionsResources() map[string]AWSEC2VPCEndpointServicePermissions { + results := map[string]AWSEC2VPCEndpointServicePermissions{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEC2VPCEndpointServicePermissions: + // 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::VPCEndpointServicePermissions" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpointServicePermissions + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEC2VPCEndpointServicePermissionsWithName retrieves all AWSEC2VPCEndpointServicePermissions items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEC2VPCEndpointServicePermissionsWithName(name string) (AWSEC2VPCEndpointServicePermissions, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEC2VPCEndpointServicePermissions: + // 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::VPCEndpointServicePermissions" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEC2VPCEndpointServicePermissions + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEC2VPCEndpointServicePermissions{}, 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 000000000000..586a94957451 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcgatewayattachment.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCGatewayAttachment) AWSCloudFormationType() string { + return "AWS::EC2::VPCGatewayAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCGatewayAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2474d7f24cdb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpcpeeringconnection.go @@ -0,0 +1,146 @@ +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"` + + // PeerRegion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerregion + PeerRegion string `json:"PeerRegion,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPCPeeringConnection) AWSCloudFormationType() string { + return "AWS::EC2::VPCPeeringConnection" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPCPeeringConnection) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..81272d094add --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection.go @@ -0,0 +1,146 @@ +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"` + + // VpnTunnelOptionsSpecifications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpntunneloptionsspecifications + VpnTunnelOptionsSpecifications []AWSEC2VPNConnection_VpnTunnelOptionsSpecification `json:"VpnTunnelOptionsSpecifications,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNConnection) AWSCloudFormationType() string { + return "AWS::EC2::VPNConnection" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPNConnection) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-vpnconnection_vpntunneloptionsspecification.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection_vpntunneloptionsspecification.go new file mode 100644 index 000000000000..425b6e7092a0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnection_vpntunneloptionsspecification.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEC2VPNConnection_VpnTunnelOptionsSpecification AWS CloudFormation Resource (AWS::EC2::VPNConnection.VpnTunnelOptionsSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html +type AWSEC2VPNConnection_VpnTunnelOptionsSpecification struct { + + // PreSharedKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html#cfn-ec2-vpnconnection-vpntunneloptionsspecification-presharedkey + PreSharedKey string `json:"PreSharedKey,omitempty"` + + // TunnelInsideCidr AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html#cfn-ec2-vpnconnection-vpntunneloptionsspecification-tunnelinsidecidr + TunnelInsideCidr string `json:"TunnelInsideCidr,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNConnection_VpnTunnelOptionsSpecification) AWSCloudFormationType() string { + return "AWS::EC2::VPNConnection.VpnTunnelOptionsSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPNConnection_VpnTunnelOptionsSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1aea4bce2e12 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpnconnectionroute.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNConnectionRoute) AWSCloudFormationType() string { + return "AWS::EC2::VPNConnectionRoute" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPNConnectionRoute) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..46913a1b9617 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngateway.go @@ -0,0 +1,131 @@ +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 { + + // AmazonSideAsn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-amazonsideasn + AmazonSideAsn int64 `json:"AmazonSideAsn,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNGateway) AWSCloudFormationType() string { + return "AWS::EC2::VPNGateway" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPNGateway) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..58ad95b8b651 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ec2-vpngatewayroutepropagation.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEC2VPNGatewayRoutePropagation) AWSCloudFormationType() string { + return "AWS::EC2::VPNGatewayRoutePropagation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEC2VPNGatewayRoutePropagation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..267c6dc65ad7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository.go @@ -0,0 +1,131 @@ +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 { + + // LifecyclePolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html#cfn-ecr-repository-lifecyclepolicy + LifecyclePolicy *AWSECRRepository_LifecyclePolicy `json:"LifecyclePolicy,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECRRepository) AWSCloudFormationType() string { + return "AWS::ECR::Repository" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECRRepository) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-ecr-repository_lifecyclepolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository_lifecyclepolicy.go new file mode 100644 index 000000000000..c9d12cbd4e21 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecr-repository_lifecyclepolicy.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSECRRepository_LifecyclePolicy AWS CloudFormation Resource (AWS::ECR::Repository.LifecyclePolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecr-repository-lifecyclepolicy.html +type AWSECRRepository_LifecyclePolicy struct { + + // LifecyclePolicyText AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecr-repository-lifecyclepolicy.html#cfn-ecr-repository-lifecyclepolicy-lifecyclepolicytext + LifecyclePolicyText string `json:"LifecyclePolicyText,omitempty"` + + // RegistryId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecr-repository-lifecyclepolicy.html#cfn-ecr-repository-lifecyclepolicy-registryid + RegistryId string `json:"RegistryId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECRRepository_LifecyclePolicy) AWSCloudFormationType() string { + return "AWS::ECR::Repository.LifecyclePolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECRRepository_LifecyclePolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9ce2fc211754 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-cluster.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSCluster) AWSCloudFormationType() string { + return "AWS::ECS::Cluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d2ecfdca6c07 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service.go @@ -0,0 +1,186 @@ +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"` + + // HealthCheckGracePeriodSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-healthcheckgraceperiodseconds + HealthCheckGracePeriodSeconds int `json:"HealthCheckGracePeriodSeconds,omitempty"` + + // LaunchType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-launchtype + LaunchType string `json:"LaunchType,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"` + + // NetworkConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-networkconfiguration + NetworkConfiguration *AWSECSService_NetworkConfiguration `json:"NetworkConfiguration,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"` + + // PlatformVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-platformversion + PlatformVersion string `json:"PlatformVersion,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"` + + // ServiceRegistries AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-serviceregistries + ServiceRegistries []AWSECSService_ServiceRegistry `json:"ServiceRegistries,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService) AWSCloudFormationType() string { + return "AWS::ECS::Service" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_awsvpcconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_awsvpcconfiguration.go new file mode 100644 index 000000000000..d27b0443a58d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_awsvpcconfiguration.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSECSService_AwsVpcConfiguration AWS CloudFormation Resource (AWS::ECS::Service.AwsVpcConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-awsvpcconfiguration.html +type AWSECSService_AwsVpcConfiguration struct { + + // AssignPublicIp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-awsvpcconfiguration.html#cfn-ecs-service-awsvpcconfiguration-assignpublicip + AssignPublicIp string `json:"AssignPublicIp,omitempty"` + + // SecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-awsvpcconfiguration.html#cfn-ecs-service-awsvpcconfiguration-securitygroups + SecurityGroups []string `json:"SecurityGroups,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-awsvpcconfiguration.html#cfn-ecs-service-awsvpcconfiguration-subnets + Subnets []string `json:"Subnets,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_AwsVpcConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::Service.AwsVpcConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_AwsVpcConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..84634564184d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_deploymentconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_DeploymentConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::Service.DeploymentConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_DeploymentConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a04871d202e9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_loadbalancer.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_LoadBalancer) AWSCloudFormationType() string { + return "AWS::ECS::Service.LoadBalancer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_LoadBalancer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_networkconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_networkconfiguration.go new file mode 100644 index 000000000000..ce146ec7e33f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_networkconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSECSService_NetworkConfiguration AWS CloudFormation Resource (AWS::ECS::Service.NetworkConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-networkconfiguration.html +type AWSECSService_NetworkConfiguration struct { + + // AwsvpcConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-networkconfiguration.html#cfn-ecs-service-networkconfiguration-awsvpcconfiguration + AwsvpcConfiguration *AWSECSService_AwsVpcConfiguration `json:"AwsvpcConfiguration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_NetworkConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::Service.NetworkConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_NetworkConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b573e90ebd65 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementconstraint.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_PlacementConstraint) AWSCloudFormationType() string { + return "AWS::ECS::Service.PlacementConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_PlacementConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d118e4c6c21e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_placementstrategy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_PlacementStrategy) AWSCloudFormationType() string { + return "AWS::ECS::Service.PlacementStrategy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_PlacementStrategy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_serviceregistry.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_serviceregistry.go new file mode 100644 index 000000000000..ff654a3f90ee --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-service_serviceregistry.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSECSService_ServiceRegistry AWS CloudFormation Resource (AWS::ECS::Service.ServiceRegistry) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-serviceregistry.html +type AWSECSService_ServiceRegistry struct { + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-serviceregistry.html#cfn-ecs-service-serviceregistry-port + Port int `json:"Port,omitempty"` + + // RegistryArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-service-serviceregistry.html#cfn-ecs-service-serviceregistry-registryarn + RegistryArn string `json:"RegistryArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSService_ServiceRegistry) AWSCloudFormationType() string { + return "AWS::ECS::Service.ServiceRegistry" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSService_ServiceRegistry) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..04721ab76c30 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition.go @@ -0,0 +1,166 @@ +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"` + + // Cpu AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-cpu + Cpu string `json:"Cpu,omitempty"` + + // ExecutionRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-executionrolearn + ExecutionRoleArn string `json:"ExecutionRoleArn,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"` + + // Memory AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-memory + Memory string `json:"Memory,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"` + + // RequiresCompatibilities AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-requirescompatibilities + RequiresCompatibilities []string `json:"RequiresCompatibilities,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..8cb3ef06444e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_containerdefinition.go @@ -0,0 +1,160 @@ +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"` + + // HealthCheck AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-healthcheck + HealthCheck *AWSECSTaskDefinition_HealthCheck `json:"HealthCheck,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"` + + // LinuxParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-linuxparameters + LinuxParameters *AWSECSTaskDefinition_LinuxParameters `json:"LinuxParameters,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_ContainerDefinition) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.ContainerDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_ContainerDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_device.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_device.go new file mode 100644 index 000000000000..a28df6e95f35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_device.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSECSTaskDefinition_Device AWS CloudFormation Resource (AWS::ECS::TaskDefinition.Device) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html +type AWSECSTaskDefinition_Device struct { + + // ContainerPath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-containerpath + ContainerPath string `json:"ContainerPath,omitempty"` + + // HostPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-hostpath + HostPath string `json:"HostPath,omitempty"` + + // Permissions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-device.html#cfn-ecs-taskdefinition-device-permissions + Permissions []string `json:"Permissions,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_Device) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.Device" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_Device) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_healthcheck.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_healthcheck.go new file mode 100644 index 000000000000..cbeb513b71f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_healthcheck.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSECSTaskDefinition_HealthCheck AWS CloudFormation Resource (AWS::ECS::TaskDefinition.HealthCheck) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html +type AWSECSTaskDefinition_HealthCheck struct { + + // Command AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-command + Command []string `json:"Command,omitempty"` + + // Interval AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-interval + Interval int `json:"Interval,omitempty"` + + // Retries AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-retries + Retries int `json:"Retries,omitempty"` + + // StartPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-startperiod + StartPeriod int `json:"StartPeriod,omitempty"` + + // Timeout AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-healthcheck.html#cfn-ecs-taskdefinition-healthcheck-timeout + Timeout int `json:"Timeout,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_HealthCheck) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.HealthCheck" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_HealthCheck) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..55ec80ce7426 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostentry.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_HostEntry) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.HostEntry" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_HostEntry) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0301a4c3136e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_hostvolumeproperties.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_HostVolumeProperties) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.HostVolumeProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_HostVolumeProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_kernelcapabilities.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_kernelcapabilities.go new file mode 100644 index 000000000000..c05b4c80629e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_kernelcapabilities.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSECSTaskDefinition_KernelCapabilities AWS CloudFormation Resource (AWS::ECS::TaskDefinition.KernelCapabilities) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-kernelcapabilities.html +type AWSECSTaskDefinition_KernelCapabilities struct { + + // Add AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-kernelcapabilities.html#cfn-ecs-taskdefinition-kernelcapabilities-add + Add []string `json:"Add,omitempty"` + + // Drop AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-kernelcapabilities.html#cfn-ecs-taskdefinition-kernelcapabilities-drop + Drop []string `json:"Drop,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_KernelCapabilities) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.KernelCapabilities" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_KernelCapabilities) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5d6801ae1a4b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_keyvaluepair.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_KeyValuePair) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.KeyValuePair" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_KeyValuePair) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_linuxparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_linuxparameters.go new file mode 100644 index 000000000000..c03042a9bb57 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_linuxparameters.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSECSTaskDefinition_LinuxParameters AWS CloudFormation Resource (AWS::ECS::TaskDefinition.LinuxParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html +type AWSECSTaskDefinition_LinuxParameters struct { + + // Capabilities AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-capabilities + Capabilities *AWSECSTaskDefinition_KernelCapabilities `json:"Capabilities,omitempty"` + + // Devices AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-devices + Devices []AWSECSTaskDefinition_Device `json:"Devices,omitempty"` + + // InitProcessEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-linuxparameters.html#cfn-ecs-taskdefinition-linuxparameters-initprocessenabled + InitProcessEnabled bool `json:"InitProcessEnabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_LinuxParameters) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.LinuxParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_LinuxParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bc24a41aa483 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_logconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_LogConfiguration) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.LogConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_LogConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f73ce72ace0f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_mountpoint.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_MountPoint) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.MountPoint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_MountPoint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a37c071c7b5c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_portmapping.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_PortMapping) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.PortMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_PortMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6cd0d665004c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_taskdefinitionplacementconstraint.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_TaskDefinitionPlacementConstraint) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.TaskDefinitionPlacementConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_TaskDefinitionPlacementConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..233ddab5c69f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_ulimit.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_Ulimit) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.Ulimit" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_Ulimit) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2c98e5ae52a5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volume.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_Volume) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.Volume" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_Volume) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8bfbf1184e51 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ecs-taskdefinition_volumefrom.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSECSTaskDefinition_VolumeFrom) AWSCloudFormationType() string { + return "AWS::ECS::TaskDefinition.VolumeFrom" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSECSTaskDefinition_VolumeFrom) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1244667a3bca --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem.go @@ -0,0 +1,146 @@ +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 { + + // Encrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-encrypted + Encrypted bool `json:"Encrypted,omitempty"` + + // 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"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-efs-filesystem-kmskeyid + KmsKeyId string `json:"KmsKeyId,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"` + + // ProvisionedThroughputInMibps AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-provisionedthroughputinmibps + ProvisionedThroughputInMibps float64 `json:"ProvisionedThroughputInMibps,omitempty"` + + // ThroughputMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-efs-filesystem.html#cfn-elasticfilesystem-filesystem-throughputmode + ThroughputMode string `json:"ThroughputMode,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSFileSystem) AWSCloudFormationType() string { + return "AWS::EFS::FileSystem" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEFSFileSystem) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..b105a3447b91 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-filesystem_elasticfilesystemtag.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSFileSystem_ElasticFileSystemTag) AWSCloudFormationType() string { + return "AWS::EFS::FileSystem.ElasticFileSystemTag" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEFSFileSystem_ElasticFileSystemTag) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..48aa9dca59fc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-efs-mounttarget.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEFSMountTarget) AWSCloudFormationType() string { + return "AWS::EFS::MountTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEFSMountTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-eks-cluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-eks-cluster.go new file mode 100644 index 000000000000..04709d8c568c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-eks-cluster.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSEKSCluster AWS CloudFormation Resource (AWS::EKS::Cluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html +type AWSEKSCluster struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-name + Name string `json:"Name,omitempty"` + + // ResourcesVpcConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-resourcesvpcconfig + ResourcesVpcConfig *AWSEKSCluster_ResourcesVpcConfig `json:"ResourcesVpcConfig,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Version AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-cluster.html#cfn-eks-cluster-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEKSCluster) AWSCloudFormationType() string { + return "AWS::EKS::Cluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEKSCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSEKSCluster) MarshalJSON() ([]byte, error) { + type Properties AWSEKSCluster + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSEKSCluster) UnmarshalJSON(b []byte) error { + type Properties AWSEKSCluster + 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 = AWSEKSCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSEKSClusterResources retrieves all AWSEKSCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSEKSClusterResources() map[string]AWSEKSCluster { + results := map[string]AWSEKSCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSEKSCluster: + // 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::EKS::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEKSCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSEKSClusterWithName retrieves all AWSEKSCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSEKSClusterWithName(name string) (AWSEKSCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSEKSCluster: + // 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::EKS::Cluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSEKSCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSEKSCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-eks-cluster_resourcesvpcconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-eks-cluster_resourcesvpcconfig.go new file mode 100644 index 000000000000..bb2bc43b83df --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-eks-cluster_resourcesvpcconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEKSCluster_ResourcesVpcConfig AWS CloudFormation Resource (AWS::EKS::Cluster.ResourcesVpcConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-cluster-resourcesvpcconfig.html +type AWSEKSCluster_ResourcesVpcConfig struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-cluster-resourcesvpcconfig.html#cfn-eks-cluster-resourcesvpcconfig-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-cluster-resourcesvpcconfig.html#cfn-eks-cluster-resourcesvpcconfig-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEKSCluster_ResourcesVpcConfig) AWSCloudFormationType() string { + return "AWS::EKS::Cluster.ResourcesVpcConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEKSCluster_ResourcesVpcConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d7b5d3f9f0cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-cachecluster.go @@ -0,0 +1,221 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheCacheCluster) AWSCloudFormationType() string { + return "AWS::ElastiCache::CacheCluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheCacheCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..43425f57be8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-parametergroup.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheParameterGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::ParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..865a80dbf82e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup.go @@ -0,0 +1,261 @@ +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 { + + // AtRestEncryptionEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-atrestencryptionenabled + AtRestEncryptionEnabled bool `json:"AtRestEncryptionEnabled,omitempty"` + + // AuthToken AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-authtoken + AuthToken string `json:"AuthToken,omitempty"` + + // 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"` + + // TransitEncryptionEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticache-replicationgroup.html#cfn-elasticache-replicationgroup-transitencryptionenabled + TransitEncryptionEnabled bool `json:"TransitEncryptionEnabled,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheReplicationGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::ReplicationGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheReplicationGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..744990a22f90 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-replicationgroup_nodegroupconfiguration.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheReplicationGroup_NodeGroupConfiguration) AWSCloudFormationType() string { + return "AWS::ElastiCache::ReplicationGroup.NodeGroupConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheReplicationGroup_NodeGroupConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bbcbcb97c44f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroup.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSecurityGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::SecurityGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheSecurityGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..367597368201 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-securitygroupingress.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::ElastiCache::SecurityGroupIngress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheSecurityGroupIngress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1662e7d7734c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticache-subnetgroup.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElastiCacheSubnetGroup) AWSCloudFormationType() string { + return "AWS::ElastiCache::SubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElastiCacheSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..3e7d5c11536d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application.go @@ -0,0 +1,131 @@ +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"` + + // ResourceLifecycleConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk.html#cfn-elasticbeanstalk-application-resourcelifecycleconfig + ResourceLifecycleConfig *AWSElasticBeanstalkApplication_ApplicationResourceLifecycleConfig `json:"ResourceLifecycleConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplication) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-application_applicationresourcelifecycleconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_applicationresourcelifecycleconfig.go new file mode 100644 index 000000000000..b37205ec2dc2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_applicationresourcelifecycleconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticBeanstalkApplication_ApplicationResourceLifecycleConfig AWS CloudFormation Resource (AWS::ElasticBeanstalk::Application.ApplicationResourceLifecycleConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationresourcelifecycleconfig.html +type AWSElasticBeanstalkApplication_ApplicationResourceLifecycleConfig struct { + + // ServiceRole AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationresourcelifecycleconfig.html#cfn-elasticbeanstalk-application-applicationresourcelifecycleconfig-servicerole + ServiceRole string `json:"ServiceRole,omitempty"` + + // VersionLifecycleConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationresourcelifecycleconfig.html#cfn-elasticbeanstalk-application-applicationresourcelifecycleconfig-versionlifecycleconfig + VersionLifecycleConfig *AWSElasticBeanstalkApplication_ApplicationVersionLifecycleConfig `json:"VersionLifecycleConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication_ApplicationResourceLifecycleConfig) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application.ApplicationResourceLifecycleConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplication_ApplicationResourceLifecycleConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_applicationversionlifecycleconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_applicationversionlifecycleconfig.go new file mode 100644 index 000000000000..bb4547e81362 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_applicationversionlifecycleconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticBeanstalkApplication_ApplicationVersionLifecycleConfig AWS CloudFormation Resource (AWS::ElasticBeanstalk::Application.ApplicationVersionLifecycleConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationversionlifecycleconfig.html +type AWSElasticBeanstalkApplication_ApplicationVersionLifecycleConfig struct { + + // MaxAgeRule AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationversionlifecycleconfig.html#cfn-elasticbeanstalk-application-applicationversionlifecycleconfig-maxagerule + MaxAgeRule *AWSElasticBeanstalkApplication_MaxAgeRule `json:"MaxAgeRule,omitempty"` + + // MaxCountRule AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-applicationversionlifecycleconfig.html#cfn-elasticbeanstalk-application-applicationversionlifecycleconfig-maxcountrule + MaxCountRule *AWSElasticBeanstalkApplication_MaxCountRule `json:"MaxCountRule,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication_ApplicationVersionLifecycleConfig) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application.ApplicationVersionLifecycleConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplication_ApplicationVersionLifecycleConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxagerule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxagerule.go new file mode 100644 index 000000000000..1b65940c8e65 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxagerule.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSElasticBeanstalkApplication_MaxAgeRule AWS CloudFormation Resource (AWS::ElasticBeanstalk::Application.MaxAgeRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxagerule.html +type AWSElasticBeanstalkApplication_MaxAgeRule struct { + + // DeleteSourceFromS3 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxagerule.html#cfn-elasticbeanstalk-application-maxagerule-deletesourcefroms3 + DeleteSourceFromS3 bool `json:"DeleteSourceFromS3,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxagerule.html#cfn-elasticbeanstalk-application-maxagerule-enabled + Enabled bool `json:"Enabled,omitempty"` + + // MaxAgeInDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxagerule.html#cfn-elasticbeanstalk-application-maxagerule-maxageindays + MaxAgeInDays int `json:"MaxAgeInDays,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication_MaxAgeRule) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application.MaxAgeRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplication_MaxAgeRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxcountrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxcountrule.go new file mode 100644 index 000000000000..528ef080d245 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-application_maxcountrule.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSElasticBeanstalkApplication_MaxCountRule AWS CloudFormation Resource (AWS::ElasticBeanstalk::Application.MaxCountRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxcountrule.html +type AWSElasticBeanstalkApplication_MaxCountRule struct { + + // DeleteSourceFromS3 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxcountrule.html#cfn-elasticbeanstalk-application-maxcountrule-deletesourcefroms3 + DeleteSourceFromS3 bool `json:"DeleteSourceFromS3,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxcountrule.html#cfn-elasticbeanstalk-application-maxcountrule-enabled + Enabled bool `json:"Enabled,omitempty"` + + // MaxCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-application-maxcountrule.html#cfn-elasticbeanstalk-application-maxcountrule-maxcount + MaxCount int `json:"MaxCount,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplication_MaxCountRule) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Application.MaxCountRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplication_MaxCountRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..08213e6c4131 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplicationVersion) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ApplicationVersion" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplicationVersion) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..712fcd7c9c3a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-applicationversion_sourcebundle.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkApplicationVersion_SourceBundle) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ApplicationVersion.SourceBundle" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkApplicationVersion_SourceBundle) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6081b2c4d0a8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate.go @@ -0,0 +1,151 @@ +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-elasticbeanstalk-configurationtemplate.html +type AWSElasticBeanstalkConfigurationTemplate struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticbeanstalk-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-elasticbeanstalk-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-elasticbeanstalk-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-elasticbeanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-optionsettings + OptionSettings []AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting `json:"OptionSettings,omitempty"` + + // PlatformArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticbeanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-platformarn + PlatformArn string `json:"PlatformArn,omitempty"` + + // SolutionStackName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticbeanstalk-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-elasticbeanstalk-configurationtemplate.html#cfn-elasticbeanstalk-configurationtemplate-sourceconfiguration + SourceConfiguration *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration `json:"SourceConfiguration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkConfigurationTemplate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..e3a555851c84 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_configurationoptionsetting.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting AWS CloudFormation Resource (AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-configurationoptionsetting.html +type AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting struct { + + // Namespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-configurationoptionsetting.html#cfn-elasticbeanstalk-configurationtemplate-configurationoptionsetting-namespace + Namespace string `json:"Namespace,omitempty"` + + // OptionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-configurationoptionsetting.html#cfn-elasticbeanstalk-configurationtemplate-configurationoptionsetting-optionname + OptionName string `json:"OptionName,omitempty"` + + // ResourceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-configurationoptionsetting.html#cfn-elasticbeanstalk-configurationtemplate-configurationoptionsetting-resourcename + ResourceName string `json:"ResourceName,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-configurationoptionsetting.html#cfn-elasticbeanstalk-configurationtemplate-configurationoptionsetting-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate.ConfigurationOptionSetting" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkConfigurationTemplate_ConfigurationOptionSetting) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..178793ebaeaa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-configurationtemplate_sourceconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration AWS CloudFormation Resource (AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-sourceconfiguration.html +type AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration struct { + + // ApplicationName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticbeanstalk-configurationtemplate-sourceconfiguration.html#cfn-elasticbeanstalk-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-elasticbeanstalk-configurationtemplate-sourceconfiguration.html#cfn-elasticbeanstalk-configurationtemplate-sourceconfiguration-templatename + TemplateName string `json:"TemplateName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::ConfigurationTemplate.SourceConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkConfigurationTemplate_SourceConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f3b96f878109 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment.go @@ -0,0 +1,171 @@ +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_OptionSetting `json:"OptionSettings,omitempty"` + + // PlatformArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html#cfn-beanstalk-environment-platformarn + PlatformArn string `json:"PlatformArn,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkEnvironment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_optionsetting.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_optionsetting.go new file mode 100644 index 000000000000..e81862e06bd9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_optionsetting.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSElasticBeanstalkEnvironment_OptionSetting AWS CloudFormation Resource (AWS::ElasticBeanstalk::Environment.OptionSetting) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html +type AWSElasticBeanstalkEnvironment_OptionSetting 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"` + + // ResourceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-elasticbeanstalk-environment-optionsetting-resourcename + ResourceName string `json:"ResourceName,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-option-settings.html#cfn-beanstalk-optionsettings-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment_OptionSetting) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment.OptionSetting" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkEnvironment_OptionSetting) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..782df8d5b321 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticbeanstalk-environment_tier.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticBeanstalkEnvironment_Tier) AWSCloudFormationType() string { + return "AWS::ElasticBeanstalk::Environment.Tier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticBeanstalkEnvironment_Tier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..accdb0a39f4e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer.go @@ -0,0 +1,196 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1d5646408aa0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_accessloggingpolicy.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.AccessLoggingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_AccessLoggingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..69e6b7856bb7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_appcookiestickinesspolicy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.AppCookieStickinessPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_AppCookieStickinessPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e3cf434782c7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectiondrainingpolicy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionDrainingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionDrainingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..baec161edf66 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_connectionsettings.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionSettings) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.ConnectionSettings" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_ConnectionSettings) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2ed3c25cdf34 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_healthcheck.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_HealthCheck) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.HealthCheck" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_HealthCheck) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3ef699426573 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_lbcookiestickinesspolicy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.LBCookieStickinessPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_LBCookieStickinessPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..283cfec41d7b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_listeners.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_Listeners) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.Listeners" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_Listeners) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..eeaee5ccf039 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancing-loadbalancer_policies.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingLoadBalancer_Policies) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancing::LoadBalancer.Policies" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingLoadBalancer_Policies) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..49f8a6596450 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2Listener) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4e420ced794a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_action.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener_Action) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2Listener_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ec36a38a40bc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listener_certificate.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2Listener_Certificate) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::Listener.Certificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2Listener_Certificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate.go new file mode 100644 index 000000000000..2d0196fd7fe1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSElasticLoadBalancingV2ListenerCertificate AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerCertificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenercertificate.html +type AWSElasticLoadBalancingV2ListenerCertificate struct { + + // Certificates AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenercertificate.html#cfn-elasticloadbalancingv2-listenercertificate-certificates + Certificates []AWSElasticLoadBalancingV2ListenerCertificate_Certificate `json:"Certificates,omitempty"` + + // ListenerArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenercertificate.html#cfn-elasticloadbalancingv2-listenercertificate-listenerarn + ListenerArn string `json:"ListenerArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerCertificate) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerCertificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2ListenerCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSElasticLoadBalancingV2ListenerCertificate) MarshalJSON() ([]byte, error) { + type Properties AWSElasticLoadBalancingV2ListenerCertificate + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSElasticLoadBalancingV2ListenerCertificate) UnmarshalJSON(b []byte) error { + type Properties AWSElasticLoadBalancingV2ListenerCertificate + 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 = AWSElasticLoadBalancingV2ListenerCertificate(*res.Properties) + } + + return nil +} + +// GetAllAWSElasticLoadBalancingV2ListenerCertificateResources retrieves all AWSElasticLoadBalancingV2ListenerCertificate items from an AWS CloudFormation template +func (t *Template) GetAllAWSElasticLoadBalancingV2ListenerCertificateResources() map[string]AWSElasticLoadBalancingV2ListenerCertificate { + results := map[string]AWSElasticLoadBalancingV2ListenerCertificate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2ListenerCertificate: + // 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::ListenerCertificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2ListenerCertificate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSElasticLoadBalancingV2ListenerCertificateWithName retrieves all AWSElasticLoadBalancingV2ListenerCertificate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSElasticLoadBalancingV2ListenerCertificateWithName(name string) (AWSElasticLoadBalancingV2ListenerCertificate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSElasticLoadBalancingV2ListenerCertificate: + // 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::ListenerCertificate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSElasticLoadBalancingV2ListenerCertificate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSElasticLoadBalancingV2ListenerCertificate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate_certificate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate_certificate.go new file mode 100644 index 000000000000..25c4f3194382 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenercertificate_certificate.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSElasticLoadBalancingV2ListenerCertificate_Certificate AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::ListenerCertificate.Certificate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-listener-certificates.html +type AWSElasticLoadBalancingV2ListenerCertificate_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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerCertificate_Certificate) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerCertificate.Certificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2ListenerCertificate_Certificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5209445055ba --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2ListenerRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6dccff83acfe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_action.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule_Action) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2ListenerRule_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1e297853e211 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-listenerrule_rulecondition.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2ListenerRule_RuleCondition) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::ListenerRule.RuleCondition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2ListenerRule_RuleCondition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c5ea2c80b230 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer.go @@ -0,0 +1,161 @@ +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"` + + // SubnetMappings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-subnetmappings + SubnetMappings []AWSElasticLoadBalancingV2LoadBalancer_SubnetMapping `json:"SubnetMappings,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"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2-loadbalancer-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2LoadBalancer) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::LoadBalancer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2LoadBalancer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..73c04f751aa3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_loadbalancerattribute.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::LoadBalancer.LoadBalancerAttribute" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2LoadBalancer_LoadBalancerAttribute) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_subnetmapping.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_subnetmapping.go new file mode 100644 index 000000000000..e6b4cb8f0290 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-loadbalancer_subnetmapping.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticLoadBalancingV2LoadBalancer_SubnetMapping AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::LoadBalancer.SubnetMapping) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-subnetmapping.html +type AWSElasticLoadBalancingV2LoadBalancer_SubnetMapping struct { + + // AllocationId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-subnetmapping.html#cfn-elasticloadbalancingv2-loadbalancer-subnetmapping-allocationid + AllocationId string `json:"AllocationId,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-subnetmapping.html#cfn-elasticloadbalancingv2-loadbalancer-subnetmapping-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2LoadBalancer_SubnetMapping) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::LoadBalancer.SubnetMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2LoadBalancer_SubnetMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f7466ccfdd99 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup.go @@ -0,0 +1,196 @@ +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"` + + // TargetType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2-targetgroup-targettype + TargetType string `json:"TargetType,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2TargetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..978d49a907b5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_matcher.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_Matcher) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.Matcher" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2TargetGroup_Matcher) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2d3f285455bf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetdescription.go @@ -0,0 +1,35 @@ +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 { + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetdescription.html#cfn-elasticloadbalancingv2-targetgroup-targetdescription-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetDescription) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.TargetDescription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetDescription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d50a3537ad95 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticloadbalancingv2-targetgroup_targetgroupattribute.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute AWS CloudFormation Resource (AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattribute.html +type AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-targetgroup-targetgroupattribute.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattribute-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-targetgroupattribute.html#cfn-elasticloadbalancingv2-targetgroup-targetgroupattribute-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute) AWSCloudFormationType() string { + return "AWS::ElasticLoadBalancingV2::TargetGroup.TargetGroupAttribute" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticLoadBalancingV2TargetGroup_TargetGroupAttribute) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3e47a0ca651b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain.go @@ -0,0 +1,166 @@ +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"` + + // EncryptionAtRestOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-encryptionatrestoptions + EncryptionAtRestOptions *AWSElasticsearchDomain_EncryptionAtRestOptions `json:"EncryptionAtRestOptions,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"` + + // VPCOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticsearch-domain.html#cfn-elasticsearch-domain-vpcoptions + VPCOptions *AWSElasticsearchDomain_VPCOptions `json:"VPCOptions,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..65b49f09b7c8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_ebsoptions.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_EBSOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.EBSOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain_EBSOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..08f6b5733908 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_elasticsearchclusterconfig.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_ElasticsearchClusterConfig) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.ElasticsearchClusterConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain_ElasticsearchClusterConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_encryptionatrestoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_encryptionatrestoptions.go new file mode 100644 index 000000000000..9196d690c899 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_encryptionatrestoptions.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticsearchDomain_EncryptionAtRestOptions AWS CloudFormation Resource (AWS::Elasticsearch::Domain.EncryptionAtRestOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-encryptionatrestoptions.html +type AWSElasticsearchDomain_EncryptionAtRestOptions struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-encryptionatrestoptions.html#cfn-elasticsearch-domain-encryptionatrestoptions-enabled + Enabled bool `json:"Enabled,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-encryptionatrestoptions.html#cfn-elasticsearch-domain-encryptionatrestoptions-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_EncryptionAtRestOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.EncryptionAtRestOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain_EncryptionAtRestOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e4886b7cb589 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_snapshotoptions.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_SnapshotOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.SnapshotOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain_SnapshotOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_vpcoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_vpcoptions.go new file mode 100644 index 000000000000..37e0e85fcb21 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-elasticsearch-domain_vpcoptions.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSElasticsearchDomain_VPCOptions AWS CloudFormation Resource (AWS::Elasticsearch::Domain.VPCOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-vpcoptions.html +type AWSElasticsearchDomain_VPCOptions struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-vpcoptions.html#cfn-elasticsearch-domain-vpcoptions-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticsearch-domain-vpcoptions.html#cfn-elasticsearch-domain-vpcoptions-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSElasticsearchDomain_VPCOptions) AWSCloudFormationType() string { + return "AWS::Elasticsearch::Domain.VPCOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSElasticsearchDomain_VPCOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8b01c45397fa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster.go @@ -0,0 +1,206 @@ +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-elasticmapreduce-cluster.html +type AWSEMRCluster struct { + + // AdditionalInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-additionalinfo + AdditionalInfo interface{} `json:"AdditionalInfo,omitempty"` + + // Applications AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-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-elasticmapreduce-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-elasticmapreduce-cluster.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` + + // CustomAmiId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-customamiid + CustomAmiId string `json:"CustomAmiId,omitempty"` + + // EbsRootVolumeSize AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-ebsrootvolumesize + EbsRootVolumeSize int `json:"EbsRootVolumeSize,omitempty"` + + // Instances AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-jobflowrole + JobFlowRole string `json:"JobFlowRole,omitempty"` + + // KerberosAttributes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-kerberosattributes + KerberosAttributes *AWSEMRCluster_KerberosAttributes `json:"KerberosAttributes,omitempty"` + + // LogUri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-loguri + LogUri string `json:"LogUri,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-name + Name string `json:"Name,omitempty"` + + // ReleaseLabel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-releaselabel + ReleaseLabel string `json:"ReleaseLabel,omitempty"` + + // ScaleDownBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-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-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-securityconfiguration + SecurityConfiguration string `json:"SecurityConfiguration,omitempty"` + + // ServiceRole AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-servicerole + ServiceRole string `json:"ServiceRole,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticmapreduce-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-elasticmapreduce-cluster.html#cfn-elasticmapreduce-cluster-visibletoallusers + VisibleToAllUsers bool `json:"VisibleToAllUsers,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster) AWSCloudFormationType() string { + return "AWS::EMR::Cluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..33046e43498a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_application.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSEMRCluster_Application AWS CloudFormation Resource (AWS::EMR::Cluster.Application) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-application.html +type AWSEMRCluster_Application struct { + + // AdditionalInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-application.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-application.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-application.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-application.html#cfn-elasticmapreduce-cluster-application-version + Version string `json:"Version,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_Application) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.Application" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_Application) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..539d953bd7ac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_autoscalingpolicy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_AutoScalingPolicy) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.AutoScalingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_AutoScalingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f59ca62729cb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_bootstrapactionconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEMRCluster_BootstrapActionConfig AWS CloudFormation Resource (AWS::EMR::Cluster.BootstrapActionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-bootstrapactionconfig.html +type AWSEMRCluster_BootstrapActionConfig struct { + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-bootstrapactionconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-bootstrapactionconfig.html#cfn-elasticmapreduce-cluster-bootstrapactionconfig-scriptbootstrapaction + ScriptBootstrapAction *AWSEMRCluster_ScriptBootstrapActionConfig `json:"ScriptBootstrapAction,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_BootstrapActionConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.BootstrapActionConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_BootstrapActionConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ebe0ee1b364f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_cloudwatchalarmdefinition.go @@ -0,0 +1,65 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_CloudWatchAlarmDefinition) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.CloudWatchAlarmDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_CloudWatchAlarmDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..40dc9b21ab8f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_configuration.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSEMRCluster_Configuration AWS CloudFormation Resource (AWS::EMR::Cluster.Configuration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-configuration.html +type AWSEMRCluster_Configuration struct { + + // Classification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-configuration.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-configuration.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-configuration.html#cfn-elasticmapreduce-cluster-configuration-configurations + Configurations []AWSEMRCluster_Configuration `json:"Configurations,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.Configuration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_Configuration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..25d2f0ac1772 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsblockdeviceconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEMRCluster_EbsBlockDeviceConfig AWS CloudFormation Resource (AWS::EMR::Cluster.EbsBlockDeviceConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-ebsblockdeviceconfig.html +type AWSEMRCluster_EbsBlockDeviceConfig struct { + + // VolumeSpecification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-ebsblockdeviceconfig.html#cfn-elasticmapreduce-cluster-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-elasticmapreduce-cluster-ebsblockdeviceconfig.html#cfn-elasticmapreduce-cluster-ebsblockdeviceconfig-volumesperinstance + VolumesPerInstance int `json:"VolumesPerInstance,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.EbsBlockDeviceConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_EbsBlockDeviceConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2f6a6950efbf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_ebsconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEMRCluster_EbsConfiguration AWS CloudFormation Resource (AWS::EMR::Cluster.EbsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-ebsconfiguration.html +type AWSEMRCluster_EbsConfiguration struct { + + // EbsBlockDeviceConfigs AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-ebsconfiguration.html#cfn-elasticmapreduce-cluster-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-elasticmapreduce-cluster-ebsconfiguration.html#cfn-elasticmapreduce-cluster-ebsconfiguration-ebsoptimized + EbsOptimized bool `json:"EbsOptimized,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.EbsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_EbsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..882be3709148 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetconfig.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceFleetConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceFleetConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_InstanceFleetConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..12bc0019f5f7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancefleetprovisioningspecifications.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceFleetProvisioningSpecifications) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceFleetProvisioningSpecifications" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_InstanceFleetProvisioningSpecifications) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2c0c0d12cf78 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancegroupconfig.go @@ -0,0 +1,60 @@ +package cloudformation + +// AWSEMRCluster_InstanceGroupConfig AWS CloudFormation Resource (AWS::EMR::Cluster.InstanceGroupConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html +type AWSEMRCluster_InstanceGroupConfig struct { + + // AutoScalingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-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-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-bidprice + BidPrice string `json:"BidPrice,omitempty"` + + // Configurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-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-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-ebsconfiguration + EbsConfiguration *AWSEMRCluster_EbsConfiguration `json:"EbsConfiguration,omitempty"` + + // InstanceCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-instancecount + InstanceCount int `json:"InstanceCount,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // Market AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-market + Market string `json:"Market,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-instancegroupconfig.html#cfn-elasticmapreduce-cluster-instancegroupconfig-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceGroupConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceGroupConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_InstanceGroupConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c686e8ddd6a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_instancetypeconfig.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_InstanceTypeConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.InstanceTypeConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_InstanceTypeConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..323f51ffbc41 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_jobflowinstancesconfig.go @@ -0,0 +1,90 @@ +package cloudformation + +// AWSEMRCluster_JobFlowInstancesConfig AWS CloudFormation Resource (AWS::EMR::Cluster.JobFlowInstancesConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-jobflowinstancesconfig.html +type AWSEMRCluster_JobFlowInstancesConfig struct { + + // AdditionalMasterSecurityGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-cluster-jobflowinstancesconfig-masterinstancegroup + MasterInstanceGroup *AWSEMRCluster_InstanceGroupConfig `json:"MasterInstanceGroup,omitempty"` + + // Placement AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-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-elasticmapreduce-cluster-jobflowinstancesconfig.html#cfn-elasticmapreduce-cluster-jobflowinstancesconfig-terminationprotected + TerminationProtected bool `json:"TerminationProtected,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_JobFlowInstancesConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.JobFlowInstancesConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_JobFlowInstancesConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_kerberosattributes.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_kerberosattributes.go new file mode 100644 index 000000000000..ff17cdb2d249 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_kerberosattributes.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSEMRCluster_KerberosAttributes AWS CloudFormation Resource (AWS::EMR::Cluster.KerberosAttributes) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html +type AWSEMRCluster_KerberosAttributes struct { + + // ADDomainJoinPassword AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html#cfn-elasticmapreduce-cluster-kerberosattributes-addomainjoinpassword + ADDomainJoinPassword string `json:"ADDomainJoinPassword,omitempty"` + + // ADDomainJoinUser AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html#cfn-elasticmapreduce-cluster-kerberosattributes-addomainjoinuser + ADDomainJoinUser string `json:"ADDomainJoinUser,omitempty"` + + // CrossRealmTrustPrincipalPassword AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html#cfn-elasticmapreduce-cluster-kerberosattributes-crossrealmtrustprincipalpassword + CrossRealmTrustPrincipalPassword string `json:"CrossRealmTrustPrincipalPassword,omitempty"` + + // KdcAdminPassword AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html#cfn-elasticmapreduce-cluster-kerberosattributes-kdcadminpassword + KdcAdminPassword string `json:"KdcAdminPassword,omitempty"` + + // Realm AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-kerberosattributes.html#cfn-elasticmapreduce-cluster-kerberosattributes-realm + Realm string `json:"Realm,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_KerberosAttributes) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.KerberosAttributes" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_KerberosAttributes) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2545c4103a61 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_metricdimension.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_MetricDimension) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.MetricDimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_MetricDimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2c05e2b5a89f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_placementtype.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEMRCluster_PlacementType AWS CloudFormation Resource (AWS::EMR::Cluster.PlacementType) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-placementtype.html +type AWSEMRCluster_PlacementType struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-placementtype.html#cfn-elasticmapreduce-cluster-placementtype-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_PlacementType) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.PlacementType" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_PlacementType) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4ab9c2e373c3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingaction.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingAction) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_ScalingAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..506d09b8b9a8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingconstraints.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingConstraints) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingConstraints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_ScalingConstraints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5df00ca81f3a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingrule.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingRule) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_ScalingRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..027e938cc5f2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scalingtrigger.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScalingTrigger) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScalingTrigger" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_ScalingTrigger) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9cd33df1b4db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_scriptbootstrapactionconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEMRCluster_ScriptBootstrapActionConfig AWS CloudFormation Resource (AWS::EMR::Cluster.ScriptBootstrapActionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scriptbootstrapactionconfig.html +type AWSEMRCluster_ScriptBootstrapActionConfig struct { + + // Args AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scriptbootstrapactionconfig.html#cfn-elasticmapreduce-cluster-scriptbootstrapactionconfig-args + Args []string `json:"Args,omitempty"` + + // Path AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-scriptbootstrapactionconfig.html#cfn-elasticmapreduce-cluster-scriptbootstrapactionconfig-path + Path string `json:"Path,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_ScriptBootstrapActionConfig) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.ScriptBootstrapActionConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_ScriptBootstrapActionConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ed3ebe329f20 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_simplescalingpolicyconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_SimpleScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.SimpleScalingPolicyConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_SimpleScalingPolicyConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..da840246f3ce --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_spotprovisioningspecification.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_SpotProvisioningSpecification) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.SpotProvisioningSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_SpotProvisioningSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ab9a7f3a9120 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-cluster_volumespecification.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSEMRCluster_VolumeSpecification AWS CloudFormation Resource (AWS::EMR::Cluster.VolumeSpecification) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-volumespecification.html +type AWSEMRCluster_VolumeSpecification struct { + + // Iops AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-cluster-volumespecification.html#cfn-elasticmapreduce-cluster-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-cluster-volumespecification.html#cfn-elasticmapreduce-cluster-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-cluster-volumespecification.html#cfn-elasticmapreduce-cluster-volumespecification-volumetype + VolumeType string `json:"VolumeType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRCluster_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::Cluster.VolumeSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRCluster_VolumeSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ed6db8626b0d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f09b4e121d82 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_configuration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.Configuration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_Configuration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b408ea299b08 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsblockdeviceconfig.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.EbsBlockDeviceConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_EbsBlockDeviceConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ce53b3b251f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_ebsconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.EbsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_EbsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8d99004346db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancefleetprovisioningspecifications.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.InstanceFleetProvisioningSpecifications" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_InstanceFleetProvisioningSpecifications) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f5ba7748861f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_instancetypeconfig.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_InstanceTypeConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.InstanceTypeConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_InstanceTypeConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8a426e75834d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_spotprovisioningspecification.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_SpotProvisioningSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.SpotProvisioningSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_SpotProvisioningSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f7dac4ac2f33 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancefleetconfig_volumespecification.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceFleetConfig_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceFleetConfig.VolumeSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceFleetConfig_VolumeSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..18d8ff467692 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig.go @@ -0,0 +1,166 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..ff5cfe9d551d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_autoscalingpolicy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_AutoScalingPolicy) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.AutoScalingPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_AutoScalingPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..94348564752b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_cloudwatchalarmdefinition.go @@ -0,0 +1,65 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.CloudWatchAlarmDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_CloudWatchAlarmDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b8f3cd334f41 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_configuration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_Configuration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.Configuration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_Configuration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e847d3f14136 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsblockdeviceconfig.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.EbsBlockDeviceConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_EbsBlockDeviceConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d48acea9b4ec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_ebsconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_EbsConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.EbsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_EbsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b5b8f637fbb6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_metricdimension.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_MetricDimension) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.MetricDimension" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_MetricDimension) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f47c6fe66060 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingaction.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingAction) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_ScalingAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..30b3b00223d1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingconstraints.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingConstraints) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingConstraints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_ScalingConstraints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..51b882e755b0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingrule.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingRule) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_ScalingRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d5bbe74487bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_scalingtrigger.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_ScalingTrigger) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.ScalingTrigger" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_ScalingTrigger) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e74f42540620 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_simplescalingpolicyconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.SimpleScalingPolicyConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_SimpleScalingPolicyConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..636ac1137805 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-instancegroupconfig_volumespecification.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRInstanceGroupConfig_VolumeSpecification) AWSCloudFormationType() string { + return "AWS::EMR::InstanceGroupConfig.VolumeSpecification" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRInstanceGroupConfig_VolumeSpecification) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f99ce28904fe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-securityconfiguration.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRSecurityConfiguration) AWSCloudFormationType() string { + return "AWS::EMR::SecurityConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRSecurityConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..658ebd011f61 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep) AWSCloudFormationType() string { + return "AWS::EMR::Step" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRStep) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5059747e89ed --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_hadoopjarstepconfig.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep_HadoopJarStepConfig) AWSCloudFormationType() string { + return "AWS::EMR::Step.HadoopJarStepConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRStep_HadoopJarStepConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f93dacb4d20f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-emr-step_keyvalue.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEMRStep_KeyValue) AWSCloudFormationType() string { + return "AWS::EMR::Step.KeyValue" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEMRStep_KeyValue) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c0481244a7e7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule) AWSCloudFormationType() string { + return "AWS::Events::Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_ecsparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_ecsparameters.go new file mode 100644 index 000000000000..9f74156835bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_ecsparameters.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEventsRule_EcsParameters AWS CloudFormation Resource (AWS::Events::Rule.EcsParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html +type AWSEventsRule_EcsParameters struct { + + // TaskCount AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html#cfn-events-rule-ecsparameters-taskcount + TaskCount int `json:"TaskCount,omitempty"` + + // TaskDefinitionArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html#cfn-events-rule-ecsparameters-taskdefinitionarn + TaskDefinitionArn string `json:"TaskDefinitionArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_EcsParameters) AWSCloudFormationType() string { + return "AWS::Events::Rule.EcsParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_EcsParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_inputtransformer.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_inputtransformer.go new file mode 100644 index 000000000000..ed21d12f6637 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_inputtransformer.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEventsRule_InputTransformer AWS CloudFormation Resource (AWS::Events::Rule.InputTransformer) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html +type AWSEventsRule_InputTransformer struct { + + // InputPathsMap AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html#cfn-events-rule-inputtransformer-inputpathsmap + InputPathsMap map[string]string `json:"InputPathsMap,omitempty"` + + // InputTemplate AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-inputtransformer.html#cfn-events-rule-inputtransformer-inputtemplate + InputTemplate string `json:"InputTemplate,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_InputTransformer) AWSCloudFormationType() string { + return "AWS::Events::Rule.InputTransformer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_InputTransformer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_kinesisparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_kinesisparameters.go new file mode 100644 index 000000000000..46c3ac347771 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_kinesisparameters.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEventsRule_KinesisParameters AWS CloudFormation Resource (AWS::Events::Rule.KinesisParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-kinesisparameters.html +type AWSEventsRule_KinesisParameters struct { + + // PartitionKeyPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-kinesisparameters.html#cfn-events-rule-kinesisparameters-partitionkeypath + PartitionKeyPath string `json:"PartitionKeyPath,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_KinesisParameters) AWSCloudFormationType() string { + return "AWS::Events::Rule.KinesisParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_KinesisParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandparameters.go new file mode 100644 index 000000000000..25766de3c718 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandparameters.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSEventsRule_RunCommandParameters AWS CloudFormation Resource (AWS::Events::Rule.RunCommandParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandparameters.html +type AWSEventsRule_RunCommandParameters struct { + + // RunCommandTargets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandparameters.html#cfn-events-rule-runcommandparameters-runcommandtargets + RunCommandTargets []AWSEventsRule_RunCommandTarget `json:"RunCommandTargets,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_RunCommandParameters) AWSCloudFormationType() string { + return "AWS::Events::Rule.RunCommandParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_RunCommandParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandtarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandtarget.go new file mode 100644 index 000000000000..66e0046e2b32 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_runcommandtarget.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSEventsRule_RunCommandTarget AWS CloudFormation Resource (AWS::Events::Rule.RunCommandTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandtarget.html +type AWSEventsRule_RunCommandTarget struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandtarget.html#cfn-events-rule-runcommandtarget-key + Key string `json:"Key,omitempty"` + + // Values AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-runcommandtarget.html#cfn-events-rule-runcommandtarget-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_RunCommandTarget) AWSCloudFormationType() string { + return "AWS::Events::Rule.RunCommandTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_RunCommandTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2ea509590310 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-events-rule_target.go @@ -0,0 +1,65 @@ +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"` + + // EcsParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-ecsparameters + EcsParameters *AWSEventsRule_EcsParameters `json:"EcsParameters,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"` + + // InputTransformer AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-inputtransformer + InputTransformer *AWSEventsRule_InputTransformer `json:"InputTransformer,omitempty"` + + // KinesisParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-kinesisparameters + KinesisParameters *AWSEventsRule_KinesisParameters `json:"KinesisParameters,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"` + + // RunCommandParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-runcommandparameters + RunCommandParameters *AWSEventsRule_RunCommandParameters `json:"RunCommandParameters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSEventsRule_Target) AWSCloudFormationType() string { + return "AWS::Events::Rule.Target" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSEventsRule_Target) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5a1aeb6802a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftAlias) AWSCloudFormationType() string { + return "AWS::GameLift::Alias" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftAlias) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7adb02ccdaf8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-alias_routingstrategy.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftAlias_RoutingStrategy) AWSCloudFormationType() string { + return "AWS::GameLift::Alias.RoutingStrategy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftAlias_RoutingStrategy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2fd8d9d2736e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftBuild) AWSCloudFormationType() string { + return "AWS::GameLift::Build" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftBuild) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..78e7d88a3785 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-build_s3location.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftBuild_S3Location) AWSCloudFormationType() string { + return "AWS::GameLift::Build.S3Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftBuild_S3Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..84b28d642e4d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet.go @@ -0,0 +1,171 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftFleet) AWSCloudFormationType() string { + return "AWS::GameLift::Fleet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftFleet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..dbac606430f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-gamelift-fleet_ippermission.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGameLiftFleet_IpPermission) AWSCloudFormationType() string { + return "AWS::GameLift::Fleet.IpPermission" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGameLiftFleet_IpPermission) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier.go new file mode 100644 index 000000000000..0b3166879878 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueClassifier AWS CloudFormation Resource (AWS::Glue::Classifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-classifier.html +type AWSGlueClassifier struct { + + // GrokClassifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-classifier.html#cfn-glue-classifier-grokclassifier + GrokClassifier *AWSGlueClassifier_GrokClassifier `json:"GrokClassifier,omitempty"` + + // JsonClassifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-classifier.html#cfn-glue-classifier-jsonclassifier + JsonClassifier *AWSGlueClassifier_JsonClassifier `json:"JsonClassifier,omitempty"` + + // XMLClassifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-classifier.html#cfn-glue-classifier-xmlclassifier + XMLClassifier *AWSGlueClassifier_XMLClassifier `json:"XMLClassifier,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueClassifier) AWSCloudFormationType() string { + return "AWS::Glue::Classifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueClassifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueClassifier) MarshalJSON() ([]byte, error) { + type Properties AWSGlueClassifier + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueClassifier) UnmarshalJSON(b []byte) error { + type Properties AWSGlueClassifier + 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 = AWSGlueClassifier(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueClassifierResources retrieves all AWSGlueClassifier items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueClassifierResources() map[string]AWSGlueClassifier { + results := map[string]AWSGlueClassifier{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueClassifier: + // 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::Glue::Classifier" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueClassifier + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueClassifierWithName retrieves all AWSGlueClassifier items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueClassifierWithName(name string) (AWSGlueClassifier, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueClassifier: + // 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::Glue::Classifier" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueClassifier + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueClassifier{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_grokclassifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_grokclassifier.go new file mode 100644 index 000000000000..ea1775f8bf9f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_grokclassifier.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSGlueClassifier_GrokClassifier AWS CloudFormation Resource (AWS::Glue::Classifier.GrokClassifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-grokclassifier.html +type AWSGlueClassifier_GrokClassifier struct { + + // Classification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-grokclassifier.html#cfn-glue-classifier-grokclassifier-classification + Classification string `json:"Classification,omitempty"` + + // CustomPatterns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-grokclassifier.html#cfn-glue-classifier-grokclassifier-custompatterns + CustomPatterns string `json:"CustomPatterns,omitempty"` + + // GrokPattern AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-grokclassifier.html#cfn-glue-classifier-grokclassifier-grokpattern + GrokPattern string `json:"GrokPattern,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-grokclassifier.html#cfn-glue-classifier-grokclassifier-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueClassifier_GrokClassifier) AWSCloudFormationType() string { + return "AWS::Glue::Classifier.GrokClassifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueClassifier_GrokClassifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_jsonclassifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_jsonclassifier.go new file mode 100644 index 000000000000..cc79a42b84b3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_jsonclassifier.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueClassifier_JsonClassifier AWS CloudFormation Resource (AWS::Glue::Classifier.JsonClassifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-jsonclassifier.html +type AWSGlueClassifier_JsonClassifier struct { + + // JsonPath AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-jsonclassifier.html#cfn-glue-classifier-jsonclassifier-jsonpath + JsonPath string `json:"JsonPath,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-jsonclassifier.html#cfn-glue-classifier-jsonclassifier-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueClassifier_JsonClassifier) AWSCloudFormationType() string { + return "AWS::Glue::Classifier.JsonClassifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueClassifier_JsonClassifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_xmlclassifier.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_xmlclassifier.go new file mode 100644 index 000000000000..31747211340b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-classifier_xmlclassifier.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueClassifier_XMLClassifier AWS CloudFormation Resource (AWS::Glue::Classifier.XMLClassifier) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-xmlclassifier.html +type AWSGlueClassifier_XMLClassifier struct { + + // Classification AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-xmlclassifier.html#cfn-glue-classifier-xmlclassifier-classification + Classification string `json:"Classification,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-xmlclassifier.html#cfn-glue-classifier-xmlclassifier-name + Name string `json:"Name,omitempty"` + + // RowTag AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-classifier-xmlclassifier.html#cfn-glue-classifier-xmlclassifier-rowtag + RowTag string `json:"RowTag,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueClassifier_XMLClassifier) AWSCloudFormationType() string { + return "AWS::Glue::Classifier.XMLClassifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueClassifier_XMLClassifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection.go new file mode 100644 index 000000000000..81bfc8eab75e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueConnection AWS CloudFormation Resource (AWS::Glue::Connection) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-connection.html +type AWSGlueConnection struct { + + // CatalogId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-connection.html#cfn-glue-connection-catalogid + CatalogId string `json:"CatalogId,omitempty"` + + // ConnectionInput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-connection.html#cfn-glue-connection-connectioninput + ConnectionInput *AWSGlueConnection_ConnectionInput `json:"ConnectionInput,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueConnection) AWSCloudFormationType() string { + return "AWS::Glue::Connection" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueConnection) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueConnection) MarshalJSON() ([]byte, error) { + type Properties AWSGlueConnection + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueConnection) UnmarshalJSON(b []byte) error { + type Properties AWSGlueConnection + 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 = AWSGlueConnection(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueConnectionResources retrieves all AWSGlueConnection items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueConnectionResources() map[string]AWSGlueConnection { + results := map[string]AWSGlueConnection{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueConnection: + // 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::Glue::Connection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueConnection + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueConnectionWithName retrieves all AWSGlueConnection items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueConnectionWithName(name string) (AWSGlueConnection, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueConnection: + // 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::Glue::Connection" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueConnection + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueConnection{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_connectioninput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_connectioninput.go new file mode 100644 index 000000000000..70b452252d2b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_connectioninput.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSGlueConnection_ConnectionInput AWS CloudFormation Resource (AWS::Glue::Connection.ConnectionInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html +type AWSGlueConnection_ConnectionInput struct { + + // ConnectionProperties AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-connectionproperties + ConnectionProperties interface{} `json:"ConnectionProperties,omitempty"` + + // ConnectionType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-connectiontype + ConnectionType string `json:"ConnectionType,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-description + Description string `json:"Description,omitempty"` + + // MatchCriteria AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-matchcriteria + MatchCriteria []string `json:"MatchCriteria,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-name + Name string `json:"Name,omitempty"` + + // PhysicalConnectionRequirements AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-connectioninput.html#cfn-glue-connection-connectioninput-physicalconnectionrequirements + PhysicalConnectionRequirements *AWSGlueConnection_PhysicalConnectionRequirements `json:"PhysicalConnectionRequirements,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueConnection_ConnectionInput) AWSCloudFormationType() string { + return "AWS::Glue::Connection.ConnectionInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueConnection_ConnectionInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_physicalconnectionrequirements.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_physicalconnectionrequirements.go new file mode 100644 index 000000000000..192e84310d38 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-connection_physicalconnectionrequirements.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueConnection_PhysicalConnectionRequirements AWS CloudFormation Resource (AWS::Glue::Connection.PhysicalConnectionRequirements) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html +type AWSGlueConnection_PhysicalConnectionRequirements struct { + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html#cfn-glue-connection-physicalconnectionrequirements-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // SecurityGroupIdList AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html#cfn-glue-connection-physicalconnectionrequirements-securitygroupidlist + SecurityGroupIdList []string `json:"SecurityGroupIdList,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-connection-physicalconnectionrequirements.html#cfn-glue-connection-physicalconnectionrequirements-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueConnection_PhysicalConnectionRequirements) AWSCloudFormationType() string { + return "AWS::Glue::Connection.PhysicalConnectionRequirements" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueConnection_PhysicalConnectionRequirements) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler.go new file mode 100644 index 000000000000..c4ba523e9ce7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler.go @@ -0,0 +1,166 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueCrawler AWS CloudFormation Resource (AWS::Glue::Crawler) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html +type AWSGlueCrawler struct { + + // Classifiers AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-classifiers + Classifiers []string `json:"Classifiers,omitempty"` + + // Configuration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-configuration + Configuration string `json:"Configuration,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-name + Name string `json:"Name,omitempty"` + + // Role AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-role + Role string `json:"Role,omitempty"` + + // Schedule AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-schedule + Schedule *AWSGlueCrawler_Schedule `json:"Schedule,omitempty"` + + // SchemaChangePolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-schemachangepolicy + SchemaChangePolicy *AWSGlueCrawler_SchemaChangePolicy `json:"SchemaChangePolicy,omitempty"` + + // TablePrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-tableprefix + TablePrefix string `json:"TablePrefix,omitempty"` + + // Targets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-crawler.html#cfn-glue-crawler-targets + Targets *AWSGlueCrawler_Targets `json:"Targets,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler) AWSCloudFormationType() string { + return "AWS::Glue::Crawler" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueCrawler) MarshalJSON() ([]byte, error) { + type Properties AWSGlueCrawler + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueCrawler) UnmarshalJSON(b []byte) error { + type Properties AWSGlueCrawler + 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 = AWSGlueCrawler(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueCrawlerResources retrieves all AWSGlueCrawler items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueCrawlerResources() map[string]AWSGlueCrawler { + results := map[string]AWSGlueCrawler{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueCrawler: + // 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::Glue::Crawler" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueCrawler + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueCrawlerWithName retrieves all AWSGlueCrawler items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueCrawlerWithName(name string) (AWSGlueCrawler, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueCrawler: + // 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::Glue::Crawler" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueCrawler + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueCrawler{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_jdbctarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_jdbctarget.go new file mode 100644 index 000000000000..ff320dad9a06 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_jdbctarget.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueCrawler_JdbcTarget AWS CloudFormation Resource (AWS::Glue::Crawler.JdbcTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-jdbctarget.html +type AWSGlueCrawler_JdbcTarget struct { + + // ConnectionName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-jdbctarget.html#cfn-glue-crawler-jdbctarget-connectionname + ConnectionName string `json:"ConnectionName,omitempty"` + + // Exclusions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-jdbctarget.html#cfn-glue-crawler-jdbctarget-exclusions + Exclusions []string `json:"Exclusions,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-jdbctarget.html#cfn-glue-crawler-jdbctarget-path + Path string `json:"Path,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler_JdbcTarget) AWSCloudFormationType() string { + return "AWS::Glue::Crawler.JdbcTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler_JdbcTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_s3target.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_s3target.go new file mode 100644 index 000000000000..a2fbe59ed998 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_s3target.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueCrawler_S3Target AWS CloudFormation Resource (AWS::Glue::Crawler.S3Target) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-s3target.html +type AWSGlueCrawler_S3Target struct { + + // Exclusions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-s3target.html#cfn-glue-crawler-s3target-exclusions + Exclusions []string `json:"Exclusions,omitempty"` + + // Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-s3target.html#cfn-glue-crawler-s3target-path + Path string `json:"Path,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler_S3Target) AWSCloudFormationType() string { + return "AWS::Glue::Crawler.S3Target" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler_S3Target) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schedule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schedule.go new file mode 100644 index 000000000000..5abf59b6f288 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schedule.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSGlueCrawler_Schedule AWS CloudFormation Resource (AWS::Glue::Crawler.Schedule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-schedule.html +type AWSGlueCrawler_Schedule struct { + + // ScheduleExpression AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-schedule.html#cfn-glue-crawler-schedule-scheduleexpression + ScheduleExpression string `json:"ScheduleExpression,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler_Schedule) AWSCloudFormationType() string { + return "AWS::Glue::Crawler.Schedule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler_Schedule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schemachangepolicy.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schemachangepolicy.go new file mode 100644 index 000000000000..ae7cd8e210f6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_schemachangepolicy.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueCrawler_SchemaChangePolicy AWS CloudFormation Resource (AWS::Glue::Crawler.SchemaChangePolicy) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-schemachangepolicy.html +type AWSGlueCrawler_SchemaChangePolicy struct { + + // DeleteBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-schemachangepolicy.html#cfn-glue-crawler-schemachangepolicy-deletebehavior + DeleteBehavior string `json:"DeleteBehavior,omitempty"` + + // UpdateBehavior AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-schemachangepolicy.html#cfn-glue-crawler-schemachangepolicy-updatebehavior + UpdateBehavior string `json:"UpdateBehavior,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler_SchemaChangePolicy) AWSCloudFormationType() string { + return "AWS::Glue::Crawler.SchemaChangePolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler_SchemaChangePolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_targets.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_targets.go new file mode 100644 index 000000000000..15944454cf43 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-crawler_targets.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueCrawler_Targets AWS CloudFormation Resource (AWS::Glue::Crawler.Targets) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-targets.html +type AWSGlueCrawler_Targets struct { + + // JdbcTargets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-targets.html#cfn-glue-crawler-targets-jdbctargets + JdbcTargets []AWSGlueCrawler_JdbcTarget `json:"JdbcTargets,omitempty"` + + // S3Targets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-crawler-targets.html#cfn-glue-crawler-targets-s3targets + S3Targets []AWSGlueCrawler_S3Target `json:"S3Targets,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueCrawler_Targets) AWSCloudFormationType() string { + return "AWS::Glue::Crawler.Targets" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueCrawler_Targets) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database.go new file mode 100644 index 000000000000..8fdc6266bb32 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueDatabase AWS CloudFormation Resource (AWS::Glue::Database) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-database.html +type AWSGlueDatabase struct { + + // CatalogId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-database.html#cfn-glue-database-catalogid + CatalogId string `json:"CatalogId,omitempty"` + + // DatabaseInput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-database.html#cfn-glue-database-databaseinput + DatabaseInput *AWSGlueDatabase_DatabaseInput `json:"DatabaseInput,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueDatabase) AWSCloudFormationType() string { + return "AWS::Glue::Database" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueDatabase) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueDatabase) MarshalJSON() ([]byte, error) { + type Properties AWSGlueDatabase + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueDatabase) UnmarshalJSON(b []byte) error { + type Properties AWSGlueDatabase + 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 = AWSGlueDatabase(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueDatabaseResources retrieves all AWSGlueDatabase items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueDatabaseResources() map[string]AWSGlueDatabase { + results := map[string]AWSGlueDatabase{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueDatabase: + // 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::Glue::Database" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueDatabase + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueDatabaseWithName retrieves all AWSGlueDatabase items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueDatabaseWithName(name string) (AWSGlueDatabase, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueDatabase: + // 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::Glue::Database" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueDatabase + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueDatabase{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database_databaseinput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database_databaseinput.go new file mode 100644 index 000000000000..7a41ee9c7dfa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-database_databaseinput.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSGlueDatabase_DatabaseInput AWS CloudFormation Resource (AWS::Glue::Database.DatabaseInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-database-databaseinput.html +type AWSGlueDatabase_DatabaseInput struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-database-databaseinput.html#cfn-glue-database-databaseinput-description + Description string `json:"Description,omitempty"` + + // LocationUri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-database-databaseinput.html#cfn-glue-database-databaseinput-locationuri + LocationUri string `json:"LocationUri,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-database-databaseinput.html#cfn-glue-database-databaseinput-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-database-databaseinput.html#cfn-glue-database-databaseinput-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueDatabase_DatabaseInput) AWSCloudFormationType() string { + return "AWS::Glue::Database.DatabaseInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueDatabase_DatabaseInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-devendpoint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-devendpoint.go new file mode 100644 index 000000000000..788254808fb8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-devendpoint.go @@ -0,0 +1,156 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueDevEndpoint AWS CloudFormation Resource (AWS::Glue::DevEndpoint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html +type AWSGlueDevEndpoint struct { + + // EndpointName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-endpointname + EndpointName string `json:"EndpointName,omitempty"` + + // ExtraJarsS3Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-extrajarss3path + ExtraJarsS3Path string `json:"ExtraJarsS3Path,omitempty"` + + // ExtraPythonLibsS3Path AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-extrapythonlibss3path + ExtraPythonLibsS3Path string `json:"ExtraPythonLibsS3Path,omitempty"` + + // NumberOfNodes AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-numberofnodes + NumberOfNodes int `json:"NumberOfNodes,omitempty"` + + // PublicKey AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-publickey + PublicKey string `json:"PublicKey,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-devendpoint.html#cfn-glue-devendpoint-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueDevEndpoint) AWSCloudFormationType() string { + return "AWS::Glue::DevEndpoint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueDevEndpoint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueDevEndpoint) MarshalJSON() ([]byte, error) { + type Properties AWSGlueDevEndpoint + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueDevEndpoint) UnmarshalJSON(b []byte) error { + type Properties AWSGlueDevEndpoint + 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 = AWSGlueDevEndpoint(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueDevEndpointResources retrieves all AWSGlueDevEndpoint items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueDevEndpointResources() map[string]AWSGlueDevEndpoint { + results := map[string]AWSGlueDevEndpoint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueDevEndpoint: + // 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::Glue::DevEndpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueDevEndpoint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueDevEndpointWithName retrieves all AWSGlueDevEndpoint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueDevEndpointWithName(name string) (AWSGlueDevEndpoint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueDevEndpoint: + // 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::Glue::DevEndpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueDevEndpoint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueDevEndpoint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job.go new file mode 100644 index 000000000000..fbb6b2b8be93 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job.go @@ -0,0 +1,166 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueJob AWS CloudFormation Resource (AWS::Glue::Job) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html +type AWSGlueJob struct { + + // AllocatedCapacity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-allocatedcapacity + AllocatedCapacity float64 `json:"AllocatedCapacity,omitempty"` + + // Command AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-command + Command *AWSGlueJob_JobCommand `json:"Command,omitempty"` + + // Connections AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-connections + Connections *AWSGlueJob_ConnectionsList `json:"Connections,omitempty"` + + // DefaultArguments AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-defaultarguments + DefaultArguments interface{} `json:"DefaultArguments,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-description + Description string `json:"Description,omitempty"` + + // ExecutionProperty AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-executionproperty + ExecutionProperty *AWSGlueJob_ExecutionProperty `json:"ExecutionProperty,omitempty"` + + // LogUri AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-loguri + LogUri string `json:"LogUri,omitempty"` + + // MaxRetries AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-maxretries + MaxRetries float64 `json:"MaxRetries,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-name + Name string `json:"Name,omitempty"` + + // Role AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-job.html#cfn-glue-job-role + Role string `json:"Role,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueJob) AWSCloudFormationType() string { + return "AWS::Glue::Job" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueJob) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueJob) MarshalJSON() ([]byte, error) { + type Properties AWSGlueJob + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueJob) UnmarshalJSON(b []byte) error { + type Properties AWSGlueJob + 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 = AWSGlueJob(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueJobResources retrieves all AWSGlueJob items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueJobResources() map[string]AWSGlueJob { + results := map[string]AWSGlueJob{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueJob: + // 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::Glue::Job" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueJob + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueJobWithName retrieves all AWSGlueJob items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueJobWithName(name string) (AWSGlueJob, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueJob: + // 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::Glue::Job" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueJob + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueJob{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_connectionslist.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_connectionslist.go new file mode 100644 index 000000000000..a6a07dfcdd49 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_connectionslist.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSGlueJob_ConnectionsList AWS CloudFormation Resource (AWS::Glue::Job.ConnectionsList) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-connectionslist.html +type AWSGlueJob_ConnectionsList struct { + + // Connections AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-connectionslist.html#cfn-glue-job-connectionslist-connections + Connections []string `json:"Connections,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueJob_ConnectionsList) AWSCloudFormationType() string { + return "AWS::Glue::Job.ConnectionsList" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueJob_ConnectionsList) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_executionproperty.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_executionproperty.go new file mode 100644 index 000000000000..79459eb99420 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_executionproperty.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSGlueJob_ExecutionProperty AWS CloudFormation Resource (AWS::Glue::Job.ExecutionProperty) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-executionproperty.html +type AWSGlueJob_ExecutionProperty struct { + + // MaxConcurrentRuns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-executionproperty.html#cfn-glue-job-executionproperty-maxconcurrentruns + MaxConcurrentRuns float64 `json:"MaxConcurrentRuns,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueJob_ExecutionProperty) AWSCloudFormationType() string { + return "AWS::Glue::Job.ExecutionProperty" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueJob_ExecutionProperty) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_jobcommand.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_jobcommand.go new file mode 100644 index 000000000000..a1d9010d24f8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-job_jobcommand.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueJob_JobCommand AWS CloudFormation Resource (AWS::Glue::Job.JobCommand) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-jobcommand.html +type AWSGlueJob_JobCommand struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-jobcommand.html#cfn-glue-job-jobcommand-name + Name string `json:"Name,omitempty"` + + // ScriptLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-job-jobcommand.html#cfn-glue-job-jobcommand-scriptlocation + ScriptLocation string `json:"ScriptLocation,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueJob_JobCommand) AWSCloudFormationType() string { + return "AWS::Glue::Job.JobCommand" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueJob_JobCommand) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition.go new file mode 100644 index 000000000000..922f0acb7aa0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGluePartition AWS CloudFormation Resource (AWS::Glue::Partition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-partition.html +type AWSGluePartition struct { + + // CatalogId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-partition.html#cfn-glue-partition-catalogid + CatalogId string `json:"CatalogId,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-partition.html#cfn-glue-partition-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // PartitionInput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-partition.html#cfn-glue-partition-partitioninput + PartitionInput *AWSGluePartition_PartitionInput `json:"PartitionInput,omitempty"` + + // TableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-partition.html#cfn-glue-partition-tablename + TableName string `json:"TableName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition) AWSCloudFormationType() string { + return "AWS::Glue::Partition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGluePartition) MarshalJSON() ([]byte, error) { + type Properties AWSGluePartition + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGluePartition) UnmarshalJSON(b []byte) error { + type Properties AWSGluePartition + 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 = AWSGluePartition(*res.Properties) + } + + return nil +} + +// GetAllAWSGluePartitionResources retrieves all AWSGluePartition items from an AWS CloudFormation template +func (t *Template) GetAllAWSGluePartitionResources() map[string]AWSGluePartition { + results := map[string]AWSGluePartition{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGluePartition: + // 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::Glue::Partition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGluePartition + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGluePartitionWithName retrieves all AWSGluePartition items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGluePartitionWithName(name string) (AWSGluePartition, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGluePartition: + // 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::Glue::Partition" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGluePartition + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGluePartition{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_column.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_column.go new file mode 100644 index 000000000000..48cc14c0d488 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_column.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGluePartition_Column AWS CloudFormation Resource (AWS::Glue::Partition.Column) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-column.html +type AWSGluePartition_Column struct { + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-column.html#cfn-glue-partition-column-comment + Comment string `json:"Comment,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-column.html#cfn-glue-partition-column-name + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-column.html#cfn-glue-partition-column-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_Column) AWSCloudFormationType() string { + return "AWS::Glue::Partition.Column" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_Column) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_order.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_order.go new file mode 100644 index 000000000000..e7f897fc46fc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_order.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGluePartition_Order AWS CloudFormation Resource (AWS::Glue::Partition.Order) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-order.html +type AWSGluePartition_Order struct { + + // Column AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-order.html#cfn-glue-partition-order-column + Column string `json:"Column,omitempty"` + + // SortOrder AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-order.html#cfn-glue-partition-order-sortorder + SortOrder int `json:"SortOrder,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_Order) AWSCloudFormationType() string { + return "AWS::Glue::Partition.Order" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_Order) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_partitioninput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_partitioninput.go new file mode 100644 index 000000000000..179325fc893f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_partitioninput.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGluePartition_PartitionInput AWS CloudFormation Resource (AWS::Glue::Partition.PartitionInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-partitioninput.html +type AWSGluePartition_PartitionInput struct { + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-partitioninput.html#cfn-glue-partition-partitioninput-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // StorageDescriptor AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-partitioninput.html#cfn-glue-partition-partitioninput-storagedescriptor + StorageDescriptor *AWSGluePartition_StorageDescriptor `json:"StorageDescriptor,omitempty"` + + // Values AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-partitioninput.html#cfn-glue-partition-partitioninput-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_PartitionInput) AWSCloudFormationType() string { + return "AWS::Glue::Partition.PartitionInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_PartitionInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_serdeinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_serdeinfo.go new file mode 100644 index 000000000000..fcf9920cc034 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_serdeinfo.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGluePartition_SerdeInfo AWS CloudFormation Resource (AWS::Glue::Partition.SerdeInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-serdeinfo.html +type AWSGluePartition_SerdeInfo struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-serdeinfo.html#cfn-glue-partition-serdeinfo-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-serdeinfo.html#cfn-glue-partition-serdeinfo-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // SerializationLibrary AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-serdeinfo.html#cfn-glue-partition-serdeinfo-serializationlibrary + SerializationLibrary string `json:"SerializationLibrary,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_SerdeInfo) AWSCloudFormationType() string { + return "AWS::Glue::Partition.SerdeInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_SerdeInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_skewedinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_skewedinfo.go new file mode 100644 index 000000000000..0d1504ec247c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_skewedinfo.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGluePartition_SkewedInfo AWS CloudFormation Resource (AWS::Glue::Partition.SkewedInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-skewedinfo.html +type AWSGluePartition_SkewedInfo struct { + + // SkewedColumnNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-skewedinfo.html#cfn-glue-partition-skewedinfo-skewedcolumnnames + SkewedColumnNames []string `json:"SkewedColumnNames,omitempty"` + + // SkewedColumnValueLocationMaps AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-skewedinfo.html#cfn-glue-partition-skewedinfo-skewedcolumnvaluelocationmaps + SkewedColumnValueLocationMaps interface{} `json:"SkewedColumnValueLocationMaps,omitempty"` + + // SkewedColumnValues AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-skewedinfo.html#cfn-glue-partition-skewedinfo-skewedcolumnvalues + SkewedColumnValues []string `json:"SkewedColumnValues,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_SkewedInfo) AWSCloudFormationType() string { + return "AWS::Glue::Partition.SkewedInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_SkewedInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_storagedescriptor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_storagedescriptor.go new file mode 100644 index 000000000000..744cdafd8887 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-partition_storagedescriptor.go @@ -0,0 +1,80 @@ +package cloudformation + +// AWSGluePartition_StorageDescriptor AWS CloudFormation Resource (AWS::Glue::Partition.StorageDescriptor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html +type AWSGluePartition_StorageDescriptor struct { + + // BucketColumns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-bucketcolumns + BucketColumns []string `json:"BucketColumns,omitempty"` + + // Columns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-columns + Columns []AWSGluePartition_Column `json:"Columns,omitempty"` + + // Compressed AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-compressed + Compressed bool `json:"Compressed,omitempty"` + + // InputFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-inputformat + InputFormat string `json:"InputFormat,omitempty"` + + // Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-location + Location string `json:"Location,omitempty"` + + // NumberOfBuckets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-numberofbuckets + NumberOfBuckets int `json:"NumberOfBuckets,omitempty"` + + // OutputFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-outputformat + OutputFormat string `json:"OutputFormat,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // SerdeInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-serdeinfo + SerdeInfo *AWSGluePartition_SerdeInfo `json:"SerdeInfo,omitempty"` + + // SkewedInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-skewedinfo + SkewedInfo *AWSGluePartition_SkewedInfo `json:"SkewedInfo,omitempty"` + + // SortColumns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-sortcolumns + SortColumns []AWSGluePartition_Order `json:"SortColumns,omitempty"` + + // StoredAsSubDirectories AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-partition-storagedescriptor.html#cfn-glue-partition-storagedescriptor-storedassubdirectories + StoredAsSubDirectories bool `json:"StoredAsSubDirectories,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGluePartition_StorageDescriptor) AWSCloudFormationType() string { + return "AWS::Glue::Partition.StorageDescriptor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGluePartition_StorageDescriptor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table.go new file mode 100644 index 000000000000..2cca90a94130 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueTable AWS CloudFormation Resource (AWS::Glue::Table) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-table.html +type AWSGlueTable struct { + + // CatalogId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-table.html#cfn-glue-table-catalogid + CatalogId string `json:"CatalogId,omitempty"` + + // DatabaseName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-table.html#cfn-glue-table-databasename + DatabaseName string `json:"DatabaseName,omitempty"` + + // TableInput AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-table.html#cfn-glue-table-tableinput + TableInput *AWSGlueTable_TableInput `json:"TableInput,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable) AWSCloudFormationType() string { + return "AWS::Glue::Table" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueTable) MarshalJSON() ([]byte, error) { + type Properties AWSGlueTable + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueTable) UnmarshalJSON(b []byte) error { + type Properties AWSGlueTable + 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 = AWSGlueTable(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueTableResources retrieves all AWSGlueTable items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueTableResources() map[string]AWSGlueTable { + results := map[string]AWSGlueTable{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueTable: + // 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::Glue::Table" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueTable + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueTableWithName retrieves all AWSGlueTable items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueTableWithName(name string) (AWSGlueTable, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueTable: + // 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::Glue::Table" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueTable + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueTable{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_column.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_column.go new file mode 100644 index 000000000000..2b6e7e63cd56 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_column.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueTable_Column AWS CloudFormation Resource (AWS::Glue::Table.Column) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-column.html +type AWSGlueTable_Column struct { + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-column.html#cfn-glue-table-column-comment + Comment string `json:"Comment,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-column.html#cfn-glue-table-column-name + Name string `json:"Name,omitempty"` + + // Type AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-column.html#cfn-glue-table-column-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_Column) AWSCloudFormationType() string { + return "AWS::Glue::Table.Column" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_Column) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_order.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_order.go new file mode 100644 index 000000000000..6ff38eae7d38 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_order.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueTable_Order AWS CloudFormation Resource (AWS::Glue::Table.Order) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-order.html +type AWSGlueTable_Order struct { + + // Column AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-order.html#cfn-glue-table-order-column + Column string `json:"Column,omitempty"` + + // SortOrder AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-order.html#cfn-glue-table-order-sortorder + SortOrder int `json:"SortOrder,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_Order) AWSCloudFormationType() string { + return "AWS::Glue::Table.Order" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_Order) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_serdeinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_serdeinfo.go new file mode 100644 index 000000000000..0fc71e1f7bae --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_serdeinfo.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueTable_SerdeInfo AWS CloudFormation Resource (AWS::Glue::Table.SerdeInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-serdeinfo.html +type AWSGlueTable_SerdeInfo struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-serdeinfo.html#cfn-glue-table-serdeinfo-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-serdeinfo.html#cfn-glue-table-serdeinfo-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // SerializationLibrary AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-serdeinfo.html#cfn-glue-table-serdeinfo-serializationlibrary + SerializationLibrary string `json:"SerializationLibrary,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_SerdeInfo) AWSCloudFormationType() string { + return "AWS::Glue::Table.SerdeInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_SerdeInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_skewedinfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_skewedinfo.go new file mode 100644 index 000000000000..18170fdbd50b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_skewedinfo.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueTable_SkewedInfo AWS CloudFormation Resource (AWS::Glue::Table.SkewedInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-skewedinfo.html +type AWSGlueTable_SkewedInfo struct { + + // SkewedColumnNames AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-skewedinfo.html#cfn-glue-table-skewedinfo-skewedcolumnnames + SkewedColumnNames []string `json:"SkewedColumnNames,omitempty"` + + // SkewedColumnValueLocationMaps AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-skewedinfo.html#cfn-glue-table-skewedinfo-skewedcolumnvaluelocationmaps + SkewedColumnValueLocationMaps interface{} `json:"SkewedColumnValueLocationMaps,omitempty"` + + // SkewedColumnValues AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-skewedinfo.html#cfn-glue-table-skewedinfo-skewedcolumnvalues + SkewedColumnValues []string `json:"SkewedColumnValues,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_SkewedInfo) AWSCloudFormationType() string { + return "AWS::Glue::Table.SkewedInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_SkewedInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_storagedescriptor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_storagedescriptor.go new file mode 100644 index 000000000000..992ed403dbad --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_storagedescriptor.go @@ -0,0 +1,80 @@ +package cloudformation + +// AWSGlueTable_StorageDescriptor AWS CloudFormation Resource (AWS::Glue::Table.StorageDescriptor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html +type AWSGlueTable_StorageDescriptor struct { + + // BucketColumns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-bucketcolumns + BucketColumns []string `json:"BucketColumns,omitempty"` + + // Columns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-columns + Columns []AWSGlueTable_Column `json:"Columns,omitempty"` + + // Compressed AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-compressed + Compressed bool `json:"Compressed,omitempty"` + + // InputFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-inputformat + InputFormat string `json:"InputFormat,omitempty"` + + // Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-location + Location string `json:"Location,omitempty"` + + // NumberOfBuckets AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-numberofbuckets + NumberOfBuckets int `json:"NumberOfBuckets,omitempty"` + + // OutputFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-outputformat + OutputFormat string `json:"OutputFormat,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // SerdeInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-serdeinfo + SerdeInfo *AWSGlueTable_SerdeInfo `json:"SerdeInfo,omitempty"` + + // SkewedInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-skewedinfo + SkewedInfo *AWSGlueTable_SkewedInfo `json:"SkewedInfo,omitempty"` + + // SortColumns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-sortcolumns + SortColumns []AWSGlueTable_Order `json:"SortColumns,omitempty"` + + // StoredAsSubDirectories AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-storedassubdirectories + StoredAsSubDirectories bool `json:"StoredAsSubDirectories,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_StorageDescriptor) AWSCloudFormationType() string { + return "AWS::Glue::Table.StorageDescriptor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_StorageDescriptor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_tableinput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_tableinput.go new file mode 100644 index 000000000000..5619edc7c8f5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-table_tableinput.go @@ -0,0 +1,70 @@ +package cloudformation + +// AWSGlueTable_TableInput AWS CloudFormation Resource (AWS::Glue::Table.TableInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html +type AWSGlueTable_TableInput struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-name + Name string `json:"Name,omitempty"` + + // Owner AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-owner + Owner string `json:"Owner,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // PartitionKeys AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-partitionkeys + PartitionKeys []AWSGlueTable_Column `json:"PartitionKeys,omitempty"` + + // Retention AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-retention + Retention int `json:"Retention,omitempty"` + + // StorageDescriptor AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-storagedescriptor + StorageDescriptor *AWSGlueTable_StorageDescriptor `json:"StorageDescriptor,omitempty"` + + // TableType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-tabletype + TableType string `json:"TableType,omitempty"` + + // ViewExpandedText AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-viewexpandedtext + ViewExpandedText string `json:"ViewExpandedText,omitempty"` + + // ViewOriginalText AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-tableinput.html#cfn-glue-table-tableinput-vieworiginaltext + ViewOriginalText string `json:"ViewOriginalText,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTable_TableInput) AWSCloudFormationType() string { + return "AWS::Glue::Table.TableInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTable_TableInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger.go new file mode 100644 index 000000000000..fd7c01b53d86 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger.go @@ -0,0 +1,146 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGlueTrigger AWS CloudFormation Resource (AWS::Glue::Trigger) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html +type AWSGlueTrigger struct { + + // Actions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-actions + Actions []AWSGlueTrigger_Action `json:"Actions,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-name + Name string `json:"Name,omitempty"` + + // Predicate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-predicate + Predicate *AWSGlueTrigger_Predicate `json:"Predicate,omitempty"` + + // Schedule AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-schedule + Schedule string `json:"Schedule,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-glue-trigger.html#cfn-glue-trigger-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTrigger) AWSCloudFormationType() string { + return "AWS::Glue::Trigger" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTrigger) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGlueTrigger) MarshalJSON() ([]byte, error) { + type Properties AWSGlueTrigger + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGlueTrigger) UnmarshalJSON(b []byte) error { + type Properties AWSGlueTrigger + 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 = AWSGlueTrigger(*res.Properties) + } + + return nil +} + +// GetAllAWSGlueTriggerResources retrieves all AWSGlueTrigger items from an AWS CloudFormation template +func (t *Template) GetAllAWSGlueTriggerResources() map[string]AWSGlueTrigger { + results := map[string]AWSGlueTrigger{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGlueTrigger: + // 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::Glue::Trigger" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueTrigger + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGlueTriggerWithName retrieves all AWSGlueTrigger items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGlueTriggerWithName(name string) (AWSGlueTrigger, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGlueTrigger: + // 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::Glue::Trigger" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGlueTrigger + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGlueTrigger{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_action.go new file mode 100644 index 000000000000..32eb241ba12d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_action.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueTrigger_Action AWS CloudFormation Resource (AWS::Glue::Trigger.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-action.html +type AWSGlueTrigger_Action struct { + + // Arguments AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-action.html#cfn-glue-trigger-action-arguments + Arguments interface{} `json:"Arguments,omitempty"` + + // JobName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-action.html#cfn-glue-trigger-action-jobname + JobName string `json:"JobName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTrigger_Action) AWSCloudFormationType() string { + return "AWS::Glue::Trigger.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTrigger_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_condition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_condition.go new file mode 100644 index 000000000000..aa9f54ed5580 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_condition.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSGlueTrigger_Condition AWS CloudFormation Resource (AWS::Glue::Trigger.Condition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-condition.html +type AWSGlueTrigger_Condition struct { + + // JobName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-condition.html#cfn-glue-trigger-condition-jobname + JobName string `json:"JobName,omitempty"` + + // LogicalOperator AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-condition.html#cfn-glue-trigger-condition-logicaloperator + LogicalOperator string `json:"LogicalOperator,omitempty"` + + // State AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-condition.html#cfn-glue-trigger-condition-state + State string `json:"State,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTrigger_Condition) AWSCloudFormationType() string { + return "AWS::Glue::Trigger.Condition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTrigger_Condition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_predicate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_predicate.go new file mode 100644 index 000000000000..d2bda1a64167 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-glue-trigger_predicate.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGlueTrigger_Predicate AWS CloudFormation Resource (AWS::Glue::Trigger.Predicate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-predicate.html +type AWSGlueTrigger_Predicate struct { + + // Conditions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-predicate.html#cfn-glue-trigger-predicate-conditions + Conditions []AWSGlueTrigger_Condition `json:"Conditions,omitempty"` + + // Logical AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-trigger-predicate.html#cfn-glue-trigger-predicate-logical + Logical string `json:"Logical,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGlueTrigger_Predicate) AWSCloudFormationType() string { + return "AWS::Glue::Trigger.Predicate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGlueTrigger_Predicate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-detector.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-detector.go new file mode 100644 index 000000000000..a422602e6985 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-detector.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyDetector AWS CloudFormation Resource (AWS::GuardDuty::Detector) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-detector.html +type AWSGuardDutyDetector struct { + + // Enable AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-detector.html#cfn-guardduty-detector-enable + Enable bool `json:"Enable,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyDetector) AWSCloudFormationType() string { + return "AWS::GuardDuty::Detector" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyDetector) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyDetector) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyDetector + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyDetector) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyDetector + 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 = AWSGuardDutyDetector(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyDetectorResources retrieves all AWSGuardDutyDetector items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyDetectorResources() map[string]AWSGuardDutyDetector { + results := map[string]AWSGuardDutyDetector{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyDetector: + // 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::GuardDuty::Detector" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyDetector + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyDetectorWithName retrieves all AWSGuardDutyDetector items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyDetectorWithName(name string) (AWSGuardDutyDetector, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyDetector: + // 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::GuardDuty::Detector" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyDetector + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyDetector{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter.go new file mode 100644 index 000000000000..53ef01a44551 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter.go @@ -0,0 +1,146 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyFilter AWS CloudFormation Resource (AWS::GuardDuty::Filter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html +type AWSGuardDutyFilter struct { + + // Action AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-action + Action string `json:"Action,omitempty"` + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-description + Description string `json:"Description,omitempty"` + + // DetectorId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-detectorid + DetectorId string `json:"DetectorId,omitempty"` + + // FindingCriteria AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-findingcriteria + FindingCriteria *AWSGuardDutyFilter_FindingCriteria `json:"FindingCriteria,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-name + Name string `json:"Name,omitempty"` + + // Rank AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-filter.html#cfn-guardduty-filter-rank + Rank int `json:"Rank,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyFilter) AWSCloudFormationType() string { + return "AWS::GuardDuty::Filter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyFilter) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyFilter + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyFilter) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyFilter + 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 = AWSGuardDutyFilter(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyFilterResources retrieves all AWSGuardDutyFilter items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyFilterResources() map[string]AWSGuardDutyFilter { + results := map[string]AWSGuardDutyFilter{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyFilter: + // 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::GuardDuty::Filter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyFilter + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyFilterWithName retrieves all AWSGuardDutyFilter items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyFilterWithName(name string) (AWSGuardDutyFilter, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyFilter: + // 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::GuardDuty::Filter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyFilter + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyFilter{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_condition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_condition.go new file mode 100644 index 000000000000..db961b69a236 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_condition.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSGuardDutyFilter_Condition AWS CloudFormation Resource (AWS::GuardDuty::Filter.Condition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html +type AWSGuardDutyFilter_Condition struct { + + // Eq AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html#cfn-guardduty-filter-condition-eq + Eq []string `json:"Eq,omitempty"` + + // Gte AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html#cfn-guardduty-filter-condition-gte + Gte int `json:"Gte,omitempty"` + + // Lt AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html#cfn-guardduty-filter-condition-lt + Lt int `json:"Lt,omitempty"` + + // Lte AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html#cfn-guardduty-filter-condition-lte + Lte int `json:"Lte,omitempty"` + + // Neq AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-condition.html#cfn-guardduty-filter-condition-neq + Neq []string `json:"Neq,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyFilter_Condition) AWSCloudFormationType() string { + return "AWS::GuardDuty::Filter.Condition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyFilter_Condition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_findingcriteria.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_findingcriteria.go new file mode 100644 index 000000000000..b17f957a21ca --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-filter_findingcriteria.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSGuardDutyFilter_FindingCriteria AWS CloudFormation Resource (AWS::GuardDuty::Filter.FindingCriteria) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-findingcriteria.html +type AWSGuardDutyFilter_FindingCriteria struct { + + // Criterion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-findingcriteria.html#cfn-guardduty-filter-findingcriteria-criterion + Criterion interface{} `json:"Criterion,omitempty"` + + // ItemType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-guardduty-filter-findingcriteria.html#cfn-guardduty-filter-findingcriteria-itemtype + ItemType *AWSGuardDutyFilter_Condition `json:"ItemType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyFilter_FindingCriteria) AWSCloudFormationType() string { + return "AWS::GuardDuty::Filter.FindingCriteria" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyFilter_FindingCriteria) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-ipset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-ipset.go new file mode 100644 index 000000000000..3488345acd99 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-ipset.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyIPSet AWS CloudFormation Resource (AWS::GuardDuty::IPSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html +type AWSGuardDutyIPSet struct { + + // Activate AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html#cfn-guardduty-ipset-activate + Activate bool `json:"Activate,omitempty"` + + // DetectorId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html#cfn-guardduty-ipset-detectorid + DetectorId string `json:"DetectorId,omitempty"` + + // Format AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html#cfn-guardduty-ipset-format + Format string `json:"Format,omitempty"` + + // Location AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html#cfn-guardduty-ipset-location + Location string `json:"Location,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-ipset.html#cfn-guardduty-ipset-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyIPSet) AWSCloudFormationType() string { + return "AWS::GuardDuty::IPSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyIPSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyIPSet) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyIPSet + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyIPSet) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyIPSet + 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 = AWSGuardDutyIPSet(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyIPSetResources retrieves all AWSGuardDutyIPSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyIPSetResources() map[string]AWSGuardDutyIPSet { + results := map[string]AWSGuardDutyIPSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyIPSet: + // 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::GuardDuty::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyIPSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyIPSetWithName retrieves all AWSGuardDutyIPSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyIPSetWithName(name string) (AWSGuardDutyIPSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyIPSet: + // 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::GuardDuty::IPSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyIPSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyIPSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-master.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-master.go new file mode 100644 index 000000000000..428c6b44f1b6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-master.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyMaster AWS CloudFormation Resource (AWS::GuardDuty::Master) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-master.html +type AWSGuardDutyMaster struct { + + // DetectorId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-master.html#cfn-guardduty-master-detectorid + DetectorId string `json:"DetectorId,omitempty"` + + // InvitationId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-master.html#cfn-guardduty-master-invitationid + InvitationId string `json:"InvitationId,omitempty"` + + // MasterId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-master.html#cfn-guardduty-master-masterid + MasterId string `json:"MasterId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyMaster) AWSCloudFormationType() string { + return "AWS::GuardDuty::Master" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyMaster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyMaster) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyMaster + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyMaster) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyMaster + 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 = AWSGuardDutyMaster(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyMasterResources retrieves all AWSGuardDutyMaster items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyMasterResources() map[string]AWSGuardDutyMaster { + results := map[string]AWSGuardDutyMaster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyMaster: + // 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::GuardDuty::Master" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyMaster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyMasterWithName retrieves all AWSGuardDutyMaster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyMasterWithName(name string) (AWSGuardDutyMaster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyMaster: + // 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::GuardDuty::Master" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyMaster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyMaster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-member.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-member.go new file mode 100644 index 000000000000..95d2a2bee07f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-member.go @@ -0,0 +1,146 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyMember AWS CloudFormation Resource (AWS::GuardDuty::Member) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html +type AWSGuardDutyMember struct { + + // DetectorId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-detectorid + DetectorId string `json:"DetectorId,omitempty"` + + // DisableEmailNotification AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-disableemailnotification + DisableEmailNotification bool `json:"DisableEmailNotification,omitempty"` + + // Email AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-email + Email string `json:"Email,omitempty"` + + // MemberId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-memberid + MemberId string `json:"MemberId,omitempty"` + + // Message AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-message + Message string `json:"Message,omitempty"` + + // Status AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-member.html#cfn-guardduty-member-status + Status string `json:"Status,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyMember) AWSCloudFormationType() string { + return "AWS::GuardDuty::Member" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyMember) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyMember) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyMember + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyMember) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyMember + 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 = AWSGuardDutyMember(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyMemberResources retrieves all AWSGuardDutyMember items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyMemberResources() map[string]AWSGuardDutyMember { + results := map[string]AWSGuardDutyMember{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyMember: + // 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::GuardDuty::Member" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyMember + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyMemberWithName retrieves all AWSGuardDutyMember items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyMemberWithName(name string) (AWSGuardDutyMember, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyMember: + // 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::GuardDuty::Member" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyMember + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyMember{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-threatintelset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-threatintelset.go new file mode 100644 index 000000000000..651bd37f1614 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-guardduty-threatintelset.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSGuardDutyThreatIntelSet AWS CloudFormation Resource (AWS::GuardDuty::ThreatIntelSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html +type AWSGuardDutyThreatIntelSet struct { + + // Activate AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html#cfn-guardduty-threatintelset-activate + Activate bool `json:"Activate,omitempty"` + + // DetectorId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html#cfn-guardduty-threatintelset-detectorid + DetectorId string `json:"DetectorId,omitempty"` + + // Format AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html#cfn-guardduty-threatintelset-format + Format string `json:"Format,omitempty"` + + // Location AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html#cfn-guardduty-threatintelset-location + Location string `json:"Location,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-guardduty-threatintelset.html#cfn-guardduty-threatintelset-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSGuardDutyThreatIntelSet) AWSCloudFormationType() string { + return "AWS::GuardDuty::ThreatIntelSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSGuardDutyThreatIntelSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSGuardDutyThreatIntelSet) MarshalJSON() ([]byte, error) { + type Properties AWSGuardDutyThreatIntelSet + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSGuardDutyThreatIntelSet) UnmarshalJSON(b []byte) error { + type Properties AWSGuardDutyThreatIntelSet + 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 = AWSGuardDutyThreatIntelSet(*res.Properties) + } + + return nil +} + +// GetAllAWSGuardDutyThreatIntelSetResources retrieves all AWSGuardDutyThreatIntelSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSGuardDutyThreatIntelSetResources() map[string]AWSGuardDutyThreatIntelSet { + results := map[string]AWSGuardDutyThreatIntelSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSGuardDutyThreatIntelSet: + // 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::GuardDuty::ThreatIntelSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyThreatIntelSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSGuardDutyThreatIntelSetWithName retrieves all AWSGuardDutyThreatIntelSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSGuardDutyThreatIntelSetWithName(name string) (AWSGuardDutyThreatIntelSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSGuardDutyThreatIntelSet: + // 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::GuardDuty::ThreatIntelSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSGuardDutyThreatIntelSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSGuardDutyThreatIntelSet{}, errors.New("resource not found") +} 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 000000000000..b9bb14af6104 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-accesskey.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMAccessKey) AWSCloudFormationType() string { + return "AWS::IAM::AccessKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMAccessKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..02db03659c6c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMGroup) AWSCloudFormationType() string { + return "AWS::IAM::Group" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..96a726590577 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-group_policy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMGroup_Policy) AWSCloudFormationType() string { + return "AWS::IAM::Group.Policy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMGroup_Policy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f08b2b8df7af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-instanceprofile.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMInstanceProfile) AWSCloudFormationType() string { + return "AWS::IAM::InstanceProfile" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMInstanceProfile) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..bd279942c4e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-managedpolicy.go @@ -0,0 +1,151 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMManagedPolicy) AWSCloudFormationType() string { + return "AWS::IAM::ManagedPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMManagedPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f319f1dcd50b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-policy.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMPolicy) AWSCloudFormationType() string { + return "AWS::IAM::Policy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7de43c200a2d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role.go @@ -0,0 +1,146 @@ +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"` + + // MaxSessionDuration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-maxsessionduration + MaxSessionDuration int `json:"MaxSessionDuration,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMRole) AWSCloudFormationType() string { + return "AWS::IAM::Role" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMRole) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..0e6c6ccdaa11 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-role_policy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMRole_Policy) AWSCloudFormationType() string { + return "AWS::IAM::Role.Policy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMRole_Policy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-servicelinkedrole.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-servicelinkedrole.go new file mode 100644 index 000000000000..a528899f15f8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-servicelinkedrole.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSIAMServiceLinkedRole AWS CloudFormation Resource (AWS::IAM::ServiceLinkedRole) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-servicelinkedrole.html +type AWSIAMServiceLinkedRole struct { + + // AWSServiceName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-servicelinkedrole.html#cfn-iam-servicelinkedrole-awsservicename + AWSServiceName string `json:"AWSServiceName,omitempty"` + + // CustomSuffix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-servicelinkedrole.html#cfn-iam-servicelinkedrole-customsuffix + CustomSuffix string `json:"CustomSuffix,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-servicelinkedrole.html#cfn-iam-servicelinkedrole-description + Description string `json:"Description,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMServiceLinkedRole) AWSCloudFormationType() string { + return "AWS::IAM::ServiceLinkedRole" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMServiceLinkedRole) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSIAMServiceLinkedRole) MarshalJSON() ([]byte, error) { + type Properties AWSIAMServiceLinkedRole + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSIAMServiceLinkedRole) UnmarshalJSON(b []byte) error { + type Properties AWSIAMServiceLinkedRole + 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 = AWSIAMServiceLinkedRole(*res.Properties) + } + + return nil +} + +// GetAllAWSIAMServiceLinkedRoleResources retrieves all AWSIAMServiceLinkedRole items from an AWS CloudFormation template +func (t *Template) GetAllAWSIAMServiceLinkedRoleResources() map[string]AWSIAMServiceLinkedRole { + results := map[string]AWSIAMServiceLinkedRole{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSIAMServiceLinkedRole: + // 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::ServiceLinkedRole" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMServiceLinkedRole + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSIAMServiceLinkedRoleWithName retrieves all AWSIAMServiceLinkedRole items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSIAMServiceLinkedRoleWithName(name string) (AWSIAMServiceLinkedRole, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSIAMServiceLinkedRole: + // 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::ServiceLinkedRole" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSIAMServiceLinkedRole + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSIAMServiceLinkedRole{}, errors.New("resource not found") +} 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 000000000000..5de7f155a41e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser) AWSCloudFormationType() string { + return "AWS::IAM::User" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMUser) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..ffc29fb77049 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_loginprofile.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser_LoginProfile) AWSCloudFormationType() string { + return "AWS::IAM::User.LoginProfile" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMUser_LoginProfile) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1c4772ff0ed3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-user_policy.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUser_Policy) AWSCloudFormationType() string { + return "AWS::IAM::User.Policy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMUser_Policy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..429b0e138af1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iam-usertogroupaddition.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIAMUserToGroupAddition) AWSCloudFormationType() string { + return "AWS::IAM::UserToGroupAddition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIAMUserToGroupAddition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-inspector-assessmenttarget.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-assessmenttarget.go new file mode 100644 index 000000000000..3e01ab4b47d6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-assessmenttarget.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSInspectorAssessmentTarget AWS CloudFormation Resource (AWS::Inspector::AssessmentTarget) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttarget.html +type AWSInspectorAssessmentTarget struct { + + // AssessmentTargetName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttarget.html#cfn-inspector-assessmenttarget-assessmenttargetname + AssessmentTargetName string `json:"AssessmentTargetName,omitempty"` + + // ResourceGroupArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttarget.html#cfn-inspector-assessmenttarget-resourcegrouparn + ResourceGroupArn string `json:"ResourceGroupArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSInspectorAssessmentTarget) AWSCloudFormationType() string { + return "AWS::Inspector::AssessmentTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSInspectorAssessmentTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSInspectorAssessmentTarget) MarshalJSON() ([]byte, error) { + type Properties AWSInspectorAssessmentTarget + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSInspectorAssessmentTarget) UnmarshalJSON(b []byte) error { + type Properties AWSInspectorAssessmentTarget + 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 = AWSInspectorAssessmentTarget(*res.Properties) + } + + return nil +} + +// GetAllAWSInspectorAssessmentTargetResources retrieves all AWSInspectorAssessmentTarget items from an AWS CloudFormation template +func (t *Template) GetAllAWSInspectorAssessmentTargetResources() map[string]AWSInspectorAssessmentTarget { + results := map[string]AWSInspectorAssessmentTarget{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSInspectorAssessmentTarget: + // 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::Inspector::AssessmentTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorAssessmentTarget + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSInspectorAssessmentTargetWithName retrieves all AWSInspectorAssessmentTarget items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSInspectorAssessmentTargetWithName(name string) (AWSInspectorAssessmentTarget, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSInspectorAssessmentTarget: + // 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::Inspector::AssessmentTarget" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorAssessmentTarget + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSInspectorAssessmentTarget{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-assessmenttemplate.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-assessmenttemplate.go new file mode 100644 index 000000000000..c339a17b07fa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-assessmenttemplate.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSInspectorAssessmentTemplate AWS CloudFormation Resource (AWS::Inspector::AssessmentTemplate) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html +type AWSInspectorAssessmentTemplate struct { + + // AssessmentTargetArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html#cfn-inspector-assessmenttemplate-assessmenttargetarn + AssessmentTargetArn string `json:"AssessmentTargetArn,omitempty"` + + // AssessmentTemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html#cfn-inspector-assessmenttemplate-assessmenttemplatename + AssessmentTemplateName string `json:"AssessmentTemplateName,omitempty"` + + // DurationInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html#cfn-inspector-assessmenttemplate-durationinseconds + DurationInSeconds int `json:"DurationInSeconds,omitempty"` + + // RulesPackageArns AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html#cfn-inspector-assessmenttemplate-rulespackagearns + RulesPackageArns []string `json:"RulesPackageArns,omitempty"` + + // UserAttributesForFindings AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-assessmenttemplate.html#cfn-inspector-assessmenttemplate-userattributesforfindings + UserAttributesForFindings []Tag `json:"UserAttributesForFindings,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSInspectorAssessmentTemplate) AWSCloudFormationType() string { + return "AWS::Inspector::AssessmentTemplate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSInspectorAssessmentTemplate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSInspectorAssessmentTemplate) MarshalJSON() ([]byte, error) { + type Properties AWSInspectorAssessmentTemplate + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSInspectorAssessmentTemplate) UnmarshalJSON(b []byte) error { + type Properties AWSInspectorAssessmentTemplate + 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 = AWSInspectorAssessmentTemplate(*res.Properties) + } + + return nil +} + +// GetAllAWSInspectorAssessmentTemplateResources retrieves all AWSInspectorAssessmentTemplate items from an AWS CloudFormation template +func (t *Template) GetAllAWSInspectorAssessmentTemplateResources() map[string]AWSInspectorAssessmentTemplate { + results := map[string]AWSInspectorAssessmentTemplate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSInspectorAssessmentTemplate: + // 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::Inspector::AssessmentTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorAssessmentTemplate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSInspectorAssessmentTemplateWithName retrieves all AWSInspectorAssessmentTemplate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSInspectorAssessmentTemplateWithName(name string) (AWSInspectorAssessmentTemplate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSInspectorAssessmentTemplate: + // 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::Inspector::AssessmentTemplate" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorAssessmentTemplate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSInspectorAssessmentTemplate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-resourcegroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-resourcegroup.go new file mode 100644 index 000000000000..590f289eda95 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-inspector-resourcegroup.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSInspectorResourceGroup AWS CloudFormation Resource (AWS::Inspector::ResourceGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-resourcegroup.html +type AWSInspectorResourceGroup struct { + + // ResourceGroupTags AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-inspector-resourcegroup.html#cfn-inspector-resourcegroup-resourcegrouptags + ResourceGroupTags []Tag `json:"ResourceGroupTags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSInspectorResourceGroup) AWSCloudFormationType() string { + return "AWS::Inspector::ResourceGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSInspectorResourceGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSInspectorResourceGroup) MarshalJSON() ([]byte, error) { + type Properties AWSInspectorResourceGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSInspectorResourceGroup) UnmarshalJSON(b []byte) error { + type Properties AWSInspectorResourceGroup + 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 = AWSInspectorResourceGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSInspectorResourceGroupResources retrieves all AWSInspectorResourceGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSInspectorResourceGroupResources() map[string]AWSInspectorResourceGroup { + results := map[string]AWSInspectorResourceGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSInspectorResourceGroup: + // 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::Inspector::ResourceGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorResourceGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSInspectorResourceGroupWithName retrieves all AWSInspectorResourceGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSInspectorResourceGroupWithName(name string) (AWSInspectorResourceGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSInspectorResourceGroup: + // 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::Inspector::ResourceGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSInspectorResourceGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSInspectorResourceGroup{}, 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 000000000000..aacc5493ad33 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-certificate.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTCertificate) AWSCloudFormationType() string { + return "AWS::IoT::Certificate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTCertificate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..dada0483242d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policy.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTPolicy) AWSCloudFormationType() string { + return "AWS::IoT::Policy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..70304abe3dc8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-policyprincipalattachment.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTPolicyPrincipalAttachment) AWSCloudFormationType() string { + return "AWS::IoT::PolicyPrincipalAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTPolicyPrincipalAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..5ffbacbcb4ae --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThing) AWSCloudFormationType() string { + return "AWS::IoT::Thing" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTThing) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1f2c0f55d46d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thing_attributepayload.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThing_AttributePayload) AWSCloudFormationType() string { + return "AWS::IoT::Thing.AttributePayload" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTThing_AttributePayload) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a72b4a935d9b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-thingprincipalattachment.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTThingPrincipalAttachment) AWSCloudFormationType() string { + return "AWS::IoT::ThingPrincipalAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTThingPrincipalAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d6c0037a333c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..56eb8c9ca83a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_action.go @@ -0,0 +1,80 @@ +package cloudformation + +// AWSIoTTopicRule_Action AWS CloudFormation Resource (AWS::IoT::TopicRule.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-action.html +type AWSIoTTopicRule_Action struct { + + // CloudwatchAlarm AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-action-dynamodb + DynamoDB *AWSIoTTopicRule_DynamoDBAction `json:"DynamoDB,omitempty"` + + // DynamoDBv2 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-action.html#cfn-iot-topicrule-action-dynamodbv2 + DynamoDBv2 *AWSIoTTopicRule_DynamoDBv2Action `json:"DynamoDBv2,omitempty"` + + // Elasticsearch AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-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-topicrule-action.html#cfn-iot-topicrule-action-sqs + Sqs *AWSIoTTopicRule_SqsAction `json:"Sqs,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_Action) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..cdedcefb636b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchalarmaction.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSIoTTopicRule_CloudwatchAlarmAction AWS CloudFormation Resource (AWS::IoT::TopicRule.CloudwatchAlarmAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchalarmaction.html +type AWSIoTTopicRule_CloudwatchAlarmAction struct { + + // AlarmName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchalarmaction.html#cfn-iot-topicrule-cloudwatchalarmaction-alarmname + AlarmName string `json:"AlarmName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchalarmaction.html#cfn-iot-topicrule-cloudwatchalarmaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // StateReason AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchalarmaction.html#cfn-iot-topicrule-cloudwatchalarmaction-statereason + StateReason string `json:"StateReason,omitempty"` + + // StateValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchalarmaction.html#cfn-iot-topicrule-cloudwatchalarmaction-statevalue + StateValue string `json:"StateValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_CloudwatchAlarmAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.CloudwatchAlarmAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_CloudwatchAlarmAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0ae13be3969d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_cloudwatchmetricaction.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSIoTTopicRule_CloudwatchMetricAction AWS CloudFormation Resource (AWS::IoT::TopicRule.CloudwatchMetricAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html +type AWSIoTTopicRule_CloudwatchMetricAction struct { + + // MetricName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-metricname + MetricName string `json:"MetricName,omitempty"` + + // MetricNamespace AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-metricnamespace + MetricNamespace string `json:"MetricNamespace,omitempty"` + + // MetricTimestamp AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-metrictimestamp + MetricTimestamp string `json:"MetricTimestamp,omitempty"` + + // MetricUnit AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-metricunit + MetricUnit string `json:"MetricUnit,omitempty"` + + // MetricValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-metricvalue + MetricValue string `json:"MetricValue,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-cloudwatchmetricaction.html#cfn-iot-topicrule-cloudwatchmetricaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_CloudwatchMetricAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.CloudwatchMetricAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_CloudwatchMetricAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6b86522c5ba6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbaction.go @@ -0,0 +1,65 @@ +package cloudformation + +// AWSIoTTopicRule_DynamoDBAction AWS CloudFormation Resource (AWS::IoT::TopicRule.DynamoDBAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html +type AWSIoTTopicRule_DynamoDBAction struct { + + // HashKeyField AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-hashkeyfield + HashKeyField string `json:"HashKeyField,omitempty"` + + // HashKeyType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-hashkeytype + HashKeyType string `json:"HashKeyType,omitempty"` + + // HashKeyValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-hashkeyvalue + HashKeyValue string `json:"HashKeyValue,omitempty"` + + // PayloadField AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-payloadfield + PayloadField string `json:"PayloadField,omitempty"` + + // RangeKeyField AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-rangekeyfield + RangeKeyField string `json:"RangeKeyField,omitempty"` + + // RangeKeyType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-rangekeytype + RangeKeyType string `json:"RangeKeyType,omitempty"` + + // RangeKeyValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-rangekeyvalue + RangeKeyValue string `json:"RangeKeyValue,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // TableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbaction.html#cfn-iot-topicrule-dynamodbaction-tablename + TableName string `json:"TableName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_DynamoDBAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.DynamoDBAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_DynamoDBAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbv2action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbv2action.go new file mode 100644 index 000000000000..44050c3e384b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_dynamodbv2action.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSIoTTopicRule_DynamoDBv2Action AWS CloudFormation Resource (AWS::IoT::TopicRule.DynamoDBv2Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbv2action.html +type AWSIoTTopicRule_DynamoDBv2Action struct { + + // PutItem AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbv2action.html#cfn-iot-topicrule-dynamodbv2action-putitem + PutItem *AWSIoTTopicRule_PutItemInput `json:"PutItem,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-dynamodbv2action.html#cfn-iot-topicrule-dynamodbv2action-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_DynamoDBv2Action) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.DynamoDBv2Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_DynamoDBv2Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0b43ebd60b81 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_elasticsearchaction.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSIoTTopicRule_ElasticsearchAction AWS CloudFormation Resource (AWS::IoT::TopicRule.ElasticsearchAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html +type AWSIoTTopicRule_ElasticsearchAction struct { + + // Endpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html#cfn-iot-topicrule-elasticsearchaction-endpoint + Endpoint string `json:"Endpoint,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html#cfn-iot-topicrule-elasticsearchaction-id + Id string `json:"Id,omitempty"` + + // Index AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html#cfn-iot-topicrule-elasticsearchaction-index + Index string `json:"Index,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html#cfn-iot-topicrule-elasticsearchaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-elasticsearchaction.html#cfn-iot-topicrule-elasticsearchaction-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_ElasticsearchAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.ElasticsearchAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_ElasticsearchAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0279e984fc36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_firehoseaction.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSIoTTopicRule_FirehoseAction AWS CloudFormation Resource (AWS::IoT::TopicRule.FirehoseAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-firehoseaction.html +type AWSIoTTopicRule_FirehoseAction struct { + + // DeliveryStreamName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-firehoseaction.html#cfn-iot-topicrule-firehoseaction-deliverystreamname + DeliveryStreamName string `json:"DeliveryStreamName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-firehoseaction.html#cfn-iot-topicrule-firehoseaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Separator AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-firehoseaction.html#cfn-iot-topicrule-firehoseaction-separator + Separator string `json:"Separator,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_FirehoseAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.FirehoseAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_FirehoseAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..80dfeb9865d9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_kinesisaction.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSIoTTopicRule_KinesisAction AWS CloudFormation Resource (AWS::IoT::TopicRule.KinesisAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-kinesisaction.html +type AWSIoTTopicRule_KinesisAction struct { + + // PartitionKey AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-kinesisaction.html#cfn-iot-topicrule-kinesisaction-partitionkey + PartitionKey string `json:"PartitionKey,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-kinesisaction.html#cfn-iot-topicrule-kinesisaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // StreamName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-kinesisaction.html#cfn-iot-topicrule-kinesisaction-streamname + StreamName string `json:"StreamName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_KinesisAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.KinesisAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_KinesisAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4591e3f8ec23 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_lambdaaction.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSIoTTopicRule_LambdaAction AWS CloudFormation Resource (AWS::IoT::TopicRule.LambdaAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-lambdaaction.html +type AWSIoTTopicRule_LambdaAction struct { + + // FunctionArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-lambdaaction.html#cfn-iot-topicrule-lambdaaction-functionarn + FunctionArn string `json:"FunctionArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_LambdaAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.LambdaAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_LambdaAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_putiteminput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_putiteminput.go new file mode 100644 index 000000000000..ca6e4bc35ace --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_putiteminput.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSIoTTopicRule_PutItemInput AWS CloudFormation Resource (AWS::IoT::TopicRule.PutItemInput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-putiteminput.html +type AWSIoTTopicRule_PutItemInput struct { + + // TableName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-putiteminput.html#cfn-iot-topicrule-putiteminput-tablename + TableName string `json:"TableName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_PutItemInput) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.PutItemInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_PutItemInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..51dbf6b44651 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_republishaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSIoTTopicRule_RepublishAction AWS CloudFormation Resource (AWS::IoT::TopicRule.RepublishAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-republishaction.html +type AWSIoTTopicRule_RepublishAction struct { + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-republishaction.html#cfn-iot-topicrule-republishaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // Topic AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-republishaction.html#cfn-iot-topicrule-republishaction-topic + Topic string `json:"Topic,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_RepublishAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.RepublishAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_RepublishAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a8c3474c3a1a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_s3action.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSIoTTopicRule_S3Action AWS CloudFormation Resource (AWS::IoT::TopicRule.S3Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html +type AWSIoTTopicRule_S3Action struct { + + // BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html#cfn-iot-topicrule-s3action-bucketname + BucketName string `json:"BucketName,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html#cfn-iot-topicrule-s3action-key + Key string `json:"Key,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html#cfn-iot-topicrule-s3action-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_S3Action) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.S3Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_S3Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..57d13eaf0c19 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_snsaction.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSIoTTopicRule_SnsAction AWS CloudFormation Resource (AWS::IoT::TopicRule.SnsAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-snsaction.html +type AWSIoTTopicRule_SnsAction struct { + + // MessageFormat AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-snsaction.html#cfn-iot-topicrule-snsaction-messageformat + MessageFormat string `json:"MessageFormat,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-snsaction.html#cfn-iot-topicrule-snsaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // TargetArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-snsaction.html#cfn-iot-topicrule-snsaction-targetarn + TargetArn string `json:"TargetArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_SnsAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.SnsAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_SnsAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..40316e525df7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_sqsaction.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSIoTTopicRule_SqsAction AWS CloudFormation Resource (AWS::IoT::TopicRule.SqsAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-sqsaction.html +type AWSIoTTopicRule_SqsAction struct { + + // QueueUrl AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-sqsaction.html#cfn-iot-topicrule-sqsaction-queueurl + QueueUrl string `json:"QueueUrl,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-sqsaction.html#cfn-iot-topicrule-sqsaction-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // UseBase64 AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-sqsaction.html#cfn-iot-topicrule-sqsaction-usebase64 + UseBase64 bool `json:"UseBase64,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_SqsAction) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.SqsAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_SqsAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1d590c71ddfe --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-iot-topicrule_topicrulepayload.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSIoTTopicRule_TopicRulePayload AWS CloudFormation Resource (AWS::IoT::TopicRule.TopicRulePayload) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-topicrulepayload.html +type AWSIoTTopicRule_TopicRulePayload struct { + + // Actions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-topicrulepayload.html#cfn-iot-topicrule-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-topicrule-topicrulepayload.html#cfn-iot-topicrule-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-topicrule-topicrulepayload.html#cfn-iot-topicrule-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-topicrule-topicrulepayload.html#cfn-iot-topicrule-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-topicrule-topicrulepayload.html#cfn-iot-topicrule-topicrulepayload-sql + Sql string `json:"Sql,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSIoTTopicRule_TopicRulePayload) AWSCloudFormationType() string { + return "AWS::IoT::TopicRule.TopicRulePayload" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSIoTTopicRule_TopicRulePayload) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..dfc40faa4e87 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream.go @@ -0,0 +1,141 @@ +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"` + + // StreamEncryption AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesis-stream.html#cfn-kinesis-stream-streamencryption + StreamEncryption *AWSKinesisStream_StreamEncryption `json:"StreamEncryption,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisStream) AWSCloudFormationType() string { + return "AWS::Kinesis::Stream" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisStream) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-kinesis-stream_streamencryption.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream_streamencryption.go new file mode 100644 index 000000000000..404f021df053 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesis-stream_streamencryption.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisStream_StreamEncryption AWS CloudFormation Resource (AWS::Kinesis::Stream.StreamEncryption) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesis-stream-streamencryption.html +type AWSKinesisStream_StreamEncryption struct { + + // EncryptionType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesis-stream-streamencryption.html#cfn-kinesis-stream-streamencryption-encryptiontype + EncryptionType string `json:"EncryptionType,omitempty"` + + // KeyId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesis-stream-streamencryption.html#cfn-kinesis-stream-streamencryption-keyid + KeyId string `json:"KeyId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisStream_StreamEncryption) AWSCloudFormationType() string { + return "AWS::Kinesis::Stream.StreamEncryption" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisStream_StreamEncryption) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..97e588ab65cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9155bf0c4523 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_csvmappingparameters.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_CSVMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.CSVMappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_CSVMappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e7b5950abf8e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_input.go @@ -0,0 +1,50 @@ +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"` + + // InputProcessingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-input.html#cfn-kinesisanalytics-application-input-inputprocessingconfiguration + InputProcessingConfiguration *AWSKinesisAnalyticsApplication_InputProcessingConfiguration `json:"InputProcessingConfiguration,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_Input) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.Input" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_Input) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputlambdaprocessor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputlambdaprocessor.go new file mode 100644 index 000000000000..9686140bd175 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputlambdaprocessor.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_InputLambdaProcessor AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.InputLambdaProcessor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputlambdaprocessor.html +type AWSKinesisAnalyticsApplication_InputLambdaProcessor struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputlambdaprocessor.html#cfn-kinesisanalytics-application-inputlambdaprocessor-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-inputlambdaprocessor.html#cfn-kinesisanalytics-application-inputlambdaprocessor-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputLambdaProcessor) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputLambdaProcessor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_InputLambdaProcessor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ea1038af63e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputparallelism.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputParallelism) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputParallelism" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_InputParallelism) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputprocessingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputprocessingconfiguration.go new file mode 100644 index 000000000000..6bdb04093003 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputprocessingconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSKinesisAnalyticsApplication_InputProcessingConfiguration AWS CloudFormation Resource (AWS::KinesisAnalytics::Application.InputProcessingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputprocessingconfiguration.html +type AWSKinesisAnalyticsApplication_InputProcessingConfiguration struct { + + // InputLambdaProcessor AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-application-inputprocessingconfiguration.html#cfn-kinesisanalytics-application-inputprocessingconfiguration-inputlambdaprocessor + InputLambdaProcessor *AWSKinesisAnalyticsApplication_InputLambdaProcessor `json:"InputLambdaProcessor,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputProcessingConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputProcessingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_InputProcessingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..739453f4f980 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_inputschema.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_InputSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.InputSchema" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_InputSchema) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c45d6e531673 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_jsonmappingparameters.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_JSONMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.JSONMappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_JSONMappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..99db8fa6c299 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisfirehoseinput.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_KinesisFirehoseInput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.KinesisFirehoseInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_KinesisFirehoseInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5242e5472f0b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_kinesisstreamsinput.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_KinesisStreamsInput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.KinesisStreamsInput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_KinesisStreamsInput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e52a69f5ea20 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_mappingparameters.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_MappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.MappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_MappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6b1f2d5205ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordcolumn.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_RecordColumn) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.RecordColumn" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_RecordColumn) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6ce5a941e028 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-application_recordformat.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplication_RecordFormat) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::Application.RecordFormat" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplication_RecordFormat) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3c1d0e73d6e5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..541f0f7b70b8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_destinationschema.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_DestinationSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.DestinationSchema" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput_DestinationSchema) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..607e49dfbf5d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisfirehoseoutput.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.KinesisFirehoseOutput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisFirehoseOutput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ea7cdb0c43bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_kinesisstreamsoutput.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.KinesisStreamsOutput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput_KinesisStreamsOutput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_lambdaoutput.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_lambdaoutput.go new file mode 100644 index 000000000000..fc62a461feb1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_lambdaoutput.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisAnalyticsApplicationOutput_LambdaOutput AWS CloudFormation Resource (AWS::KinesisAnalytics::ApplicationOutput.LambdaOutput) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-lambdaoutput.html +type AWSKinesisAnalyticsApplicationOutput_LambdaOutput struct { + + // ResourceARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-lambdaoutput.html#cfn-kinesisanalytics-applicationoutput-lambdaoutput-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-lambdaoutput.html#cfn-kinesisanalytics-applicationoutput-lambdaoutput-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_LambdaOutput) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.LambdaOutput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput_LambdaOutput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d296274aec18 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationoutput_output.go @@ -0,0 +1,45 @@ +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"` + + // LambdaOutput AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-output.html#cfn-kinesisanalytics-applicationoutput-output-lambdaoutput + LambdaOutput *AWSKinesisAnalyticsApplicationOutput_LambdaOutput `json:"LambdaOutput,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationOutput_Output) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationOutput.Output" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationOutput_Output) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ee6e29d066cb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..e4a5f3388c58 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_csvmappingparameters.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.CSVMappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_CSVMappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b563412aa77b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_jsonmappingparameters.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.JSONMappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_JSONMappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8b315745774f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_mappingparameters.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.MappingParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_MappingParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bd29802e9570 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordcolumn.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordColumn" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordColumn) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b64cfccaff62 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_recordformat.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.RecordFormat" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_RecordFormat) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..eb983ee24f6a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referencedatasource.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceDataSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceDataSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6c893a8db66e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_referenceschema.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.ReferenceSchema" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_ReferenceSchema) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d20d8b37b8f0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisanalytics-applicationreferencedatasource_s3referencedatasource.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource) AWSCloudFormationType() string { + return "AWS::KinesisAnalytics::ApplicationReferenceDataSource.S3ReferenceDataSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisAnalyticsApplicationReferenceDataSource_S3ReferenceDataSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..28553f34ba7e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream.go @@ -0,0 +1,156 @@ +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-deliverystream-deliverystreamname + DeliveryStreamName string `json:"DeliveryStreamName,omitempty"` + + // DeliveryStreamType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-deliverystreamtype + DeliveryStreamType string `json:"DeliveryStreamType,omitempty"` + + // ElasticsearchDestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration + ElasticsearchDestinationConfiguration *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration `json:"ElasticsearchDestinationConfiguration,omitempty"` + + // ExtendedS3DestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration + ExtendedS3DestinationConfiguration *AWSKinesisFirehoseDeliveryStream_ExtendedS3DestinationConfiguration `json:"ExtendedS3DestinationConfiguration,omitempty"` + + // KinesisStreamSourceConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration + KinesisStreamSourceConfiguration *AWSKinesisFirehoseDeliveryStream_KinesisStreamSourceConfiguration `json:"KinesisStreamSourceConfiguration,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"` + + // SplunkDestinationConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kinesisfirehose-deliverystream.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration + SplunkDestinationConfiguration *AWSKinesisFirehoseDeliveryStream_SplunkDestinationConfiguration `json:"SplunkDestinationConfiguration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7574a35781bc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_bufferinghints.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_BufferingHints AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.BufferingHints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-bufferinghints.html +type AWSKinesisFirehoseDeliveryStream_BufferingHints struct { + + // IntervalInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-bufferinghints.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-bufferinghints.html#cfn-kinesisfirehose-deliverystream-bufferinghints-sizeinmbs + SizeInMBs int `json:"SizeInMBs,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_BufferingHints) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.BufferingHints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_BufferingHints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..be10fbe0042c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_cloudwatchloggingoptions.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-cloudwatchloggingoptions.html +type AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-cloudwatchloggingoptions.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-cloudwatchloggingoptions.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-cloudwatchloggingoptions.html#cfn-kinesisfirehose-deliverystream-cloudwatchloggingoptions-logstreamname + LogStreamName string `json:"LogStreamName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.CloudWatchLoggingOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..20ca94d101cd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_copycommand.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_CopyCommand AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.CopyCommand) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-copycommand.html +type AWSKinesisFirehoseDeliveryStream_CopyCommand struct { + + // CopyOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-copycommand.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-copycommand.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-copycommand.html#cfn-kinesisfirehose-deliverystream-copycommand-datatablename + DataTableName string `json:"DataTableName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_CopyCommand) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.CopyCommand" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_CopyCommand) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..13da7e78a6e8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchbufferinghints.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchbufferinghints.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints struct { + + // IntervalInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchbufferinghints.html#cfn-kinesisfirehose-deliverystream-elasticsearchbufferinghints-intervalinseconds + IntervalInSeconds int `json:"IntervalInSeconds,omitempty"` + + // SizeInMBs AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchbufferinghints.html#cfn-kinesisfirehose-deliverystream-elasticsearchbufferinghints-sizeinmbs + SizeInMBs int `json:"SizeInMBs,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchBufferingHints" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchBufferingHints) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..064997107bd3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchdestinationconfiguration.go @@ -0,0 +1,75 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration struct { + + // BufferingHints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration-indexrotationperiod + IndexRotationPeriod string `json:"IndexRotationPeriod,omitempty"` + + // ProcessingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration-processingconfiguration + ProcessingConfiguration *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration `json:"ProcessingConfiguration,omitempty"` + + // RetryOptions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-elasticsearchdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-elasticsearchdestinationconfiguration-typename + TypeName string `json:"TypeName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchDestinationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchDestinationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a92b23a44007 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_elasticsearchretryoptions.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchretryoptions.html +type AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions struct { + + // DurationInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-elasticsearchretryoptions.html#cfn-kinesisfirehose-deliverystream-elasticsearchretryoptions-durationinseconds + DurationInSeconds int `json:"DurationInSeconds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ElasticsearchRetryOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ElasticsearchRetryOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..cd002c9f348b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_encryptionconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-encryptionconfiguration.html +type AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration struct { + + // KMSEncryptionConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-encryptionconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-encryptionconfiguration.html#cfn-kinesisfirehose-deliverystream-encryptionconfiguration-noencryptionconfig + NoEncryptionConfig string `json:"NoEncryptionConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.EncryptionConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_extendeds3destinationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_extendeds3destinationconfiguration.go new file mode 100644 index 000000000000..e66ac51022d8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_extendeds3destinationconfiguration.go @@ -0,0 +1,70 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ExtendedS3DestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ExtendedS3DestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_ExtendedS3DestinationConfiguration struct { + + // BucketARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-bucketarn + BucketARN string `json:"BucketARN,omitempty"` + + // BufferingHints AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-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-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-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-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-compressionformat + CompressionFormat string `json:"CompressionFormat,omitempty"` + + // EncryptionConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-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-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-prefix + Prefix string `json:"Prefix,omitempty"` + + // ProcessingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-processingconfiguration + ProcessingConfiguration *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration `json:"ProcessingConfiguration,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // S3BackupConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-s3backupconfiguration + S3BackupConfiguration *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration `json:"S3BackupConfiguration,omitempty"` + + // S3BackupMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-extendeds3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-extendeds3destinationconfiguration-s3backupmode + S3BackupMode string `json:"S3BackupMode,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ExtendedS3DestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ExtendedS3DestinationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ExtendedS3DestinationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kinesisstreamsourceconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kinesisstreamsourceconfiguration.go new file mode 100644 index 000000000000..3b2bc957a4ba --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kinesisstreamsourceconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_KinesisStreamSourceConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.KinesisStreamSourceConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration.html +type AWSKinesisFirehoseDeliveryStream_KinesisStreamSourceConfiguration struct { + + // KinesisStreamARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration.html#cfn-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration-kinesisstreamarn + KinesisStreamARN string `json:"KinesisStreamARN,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration.html#cfn-kinesisfirehose-deliverystream-kinesisstreamsourceconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_KinesisStreamSourceConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.KinesisStreamSourceConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_KinesisStreamSourceConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..63f89ac599d4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_kmsencryptionconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-kmsencryptionconfig.html +type AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig struct { + + // AWSKMSKeyARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-kmsencryptionconfig.html#cfn-kinesisfirehose-deliverystream-kmsencryptionconfig-awskmskeyarn + AWSKMSKeyARN string `json:"AWSKMSKeyARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.KMSEncryptionConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_KMSEncryptionConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processingconfiguration.go new file mode 100644 index 000000000000..0d4cc57eef26 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processingconfiguration.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ProcessingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processingconfiguration.html +type AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration struct { + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processingconfiguration.html#cfn-kinesisfirehose-deliverystream-processingconfiguration-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Processors AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processingconfiguration.html#cfn-kinesisfirehose-deliverystream-processingconfiguration-processors + Processors []AWSKinesisFirehoseDeliveryStream_Processor `json:"Processors,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ProcessingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processor.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processor.go new file mode 100644 index 000000000000..29a572c7f9d0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processor.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_Processor AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.Processor) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processor.html +type AWSKinesisFirehoseDeliveryStream_Processor struct { + + // Parameters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processor.html#cfn-kinesisfirehose-deliverystream-processor-parameters + Parameters []AWSKinesisFirehoseDeliveryStream_ProcessorParameter `json:"Parameters,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processor.html#cfn-kinesisfirehose-deliverystream-processor-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_Processor) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.Processor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_Processor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processorparameter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processorparameter.go new file mode 100644 index 000000000000..6c57f72cca68 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_processorparameter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_ProcessorParameter AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.ProcessorParameter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processorparameter.html +type AWSKinesisFirehoseDeliveryStream_ProcessorParameter struct { + + // ParameterName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processorparameter.html#cfn-kinesisfirehose-deliverystream-processorparameter-parametername + ParameterName string `json:"ParameterName,omitempty"` + + // ParameterValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processorparameter.html#cfn-kinesisfirehose-deliverystream-processorparameter-parametervalue + ParameterValue string `json:"ParameterValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_ProcessorParameter) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.ProcessorParameter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_ProcessorParameter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f9abb86bff2b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_redshiftdestinationconfiguration.go @@ -0,0 +1,60 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration struct { + + // CloudWatchLoggingOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-redshiftdestinationconfiguration-password + Password string `json:"Password,omitempty"` + + // ProcessingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-redshiftdestinationconfiguration-processingconfiguration + ProcessingConfiguration *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration `json:"ProcessingConfiguration,omitempty"` + + // RoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-redshiftdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-redshiftdestinationconfiguration-username + Username string `json:"Username,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.RedshiftDestinationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_RedshiftDestinationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9d174f376ea2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_s3destinationconfiguration.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-s3destinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration struct { + + // BucketARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-s3destinationconfiguration-encryptionconfiguration + EncryptionConfiguration *AWSKinesisFirehoseDeliveryStream_EncryptionConfiguration `json:"EncryptionConfiguration,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-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-deliverystream-s3destinationconfiguration.html#cfn-kinesisfirehose-deliverystream-s3destinationconfiguration-rolearn + RoleARN string `json:"RoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.S3DestinationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkdestinationconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkdestinationconfiguration.go new file mode 100644 index 000000000000..3ab69d296966 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkdestinationconfiguration.go @@ -0,0 +1,65 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_SplunkDestinationConfiguration AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.SplunkDestinationConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html +type AWSKinesisFirehoseDeliveryStream_SplunkDestinationConfiguration struct { + + // CloudWatchLoggingOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-cloudwatchloggingoptions + CloudWatchLoggingOptions *AWSKinesisFirehoseDeliveryStream_CloudWatchLoggingOptions `json:"CloudWatchLoggingOptions,omitempty"` + + // HECAcknowledgmentTimeoutInSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-hecacknowledgmenttimeoutinseconds + HECAcknowledgmentTimeoutInSeconds int `json:"HECAcknowledgmentTimeoutInSeconds,omitempty"` + + // HECEndpoint AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-hecendpoint + HECEndpoint string `json:"HECEndpoint,omitempty"` + + // HECEndpointType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-hecendpointtype + HECEndpointType string `json:"HECEndpointType,omitempty"` + + // HECToken AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-hectoken + HECToken string `json:"HECToken,omitempty"` + + // ProcessingConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-processingconfiguration + ProcessingConfiguration *AWSKinesisFirehoseDeliveryStream_ProcessingConfiguration `json:"ProcessingConfiguration,omitempty"` + + // RetryOptions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-retryoptions + RetryOptions *AWSKinesisFirehoseDeliveryStream_SplunkRetryOptions `json:"RetryOptions,omitempty"` + + // S3BackupMode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-s3backupmode + S3BackupMode string `json:"S3BackupMode,omitempty"` + + // S3Configuration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkdestinationconfiguration.html#cfn-kinesisfirehose-deliverystream-splunkdestinationconfiguration-s3configuration + S3Configuration *AWSKinesisFirehoseDeliveryStream_S3DestinationConfiguration `json:"S3Configuration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_SplunkDestinationConfiguration) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.SplunkDestinationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_SplunkDestinationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkretryoptions.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkretryoptions.go new file mode 100644 index 000000000000..9d60cad79a90 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kinesisfirehose-deliverystream_splunkretryoptions.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSKinesisFirehoseDeliveryStream_SplunkRetryOptions AWS CloudFormation Resource (AWS::KinesisFirehose::DeliveryStream.SplunkRetryOptions) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkretryoptions.html +type AWSKinesisFirehoseDeliveryStream_SplunkRetryOptions struct { + + // DurationInSeconds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-splunkretryoptions.html#cfn-kinesisfirehose-deliverystream-splunkretryoptions-durationinseconds + DurationInSeconds int `json:"DurationInSeconds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKinesisFirehoseDeliveryStream_SplunkRetryOptions) AWSCloudFormationType() string { + return "AWS::KinesisFirehose::DeliveryStream.SplunkRetryOptions" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKinesisFirehoseDeliveryStream_SplunkRetryOptions) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1d731d44e38f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-alias.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKMSAlias) AWSCloudFormationType() string { + return "AWS::KMS::Alias" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKMSAlias) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..9e92c290f60c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-kms-key.go @@ -0,0 +1,146 @@ +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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSKMSKey) AWSCloudFormationType() string { + return "AWS::KMS::Key" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSKMSKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c075469ecc43 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias.go @@ -0,0 +1,152 @@ +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"` + + // RoutingConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-alias.html#cfn-lambda-alias-routingconfig + RoutingConfig *AWSLambdaAlias_AliasRoutingConfiguration `json:"RoutingConfig,omitempty"` + + // _updatePolicy represents a CloudFormation UpdatePolicy + _updatePolicy *UpdatePolicy + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaAlias) AWSCloudFormationType() string { + return "AWS::Lambda::Alias" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaAlias) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// SetUpdatePolicy applies an AWS CloudFormation UpdatePolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html +func (r *AWSLambdaAlias) SetUpdatePolicy(policy *UpdatePolicy) { + r._updatePolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + UpdatePolicy *UpdatePolicy `json:"UpdatePolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + UpdatePolicy: r._updatePolicy, + }) +} + +// 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-alias_aliasroutingconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias_aliasroutingconfiguration.go new file mode 100644 index 000000000000..43ab14b2950d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias_aliasroutingconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSLambdaAlias_AliasRoutingConfiguration AWS CloudFormation Resource (AWS::Lambda::Alias.AliasRoutingConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-alias-aliasroutingconfiguration.html +type AWSLambdaAlias_AliasRoutingConfiguration struct { + + // AdditionalVersionWeights AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-alias-aliasroutingconfiguration.html#cfn-lambda-alias-aliasroutingconfiguration-additionalversionweights + AdditionalVersionWeights []AWSLambdaAlias_VersionWeight `json:"AdditionalVersionWeights,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaAlias_AliasRoutingConfiguration) AWSCloudFormationType() string { + return "AWS::Lambda::Alias.AliasRoutingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaAlias_AliasRoutingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias_versionweight.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias_versionweight.go new file mode 100644 index 000000000000..ef95925d1b01 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-alias_versionweight.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSLambdaAlias_VersionWeight AWS CloudFormation Resource (AWS::Lambda::Alias.VersionWeight) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-alias-versionweight.html +type AWSLambdaAlias_VersionWeight struct { + + // FunctionVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-alias-versionweight.html#cfn-lambda-alias-versionweight-functionversion + FunctionVersion string `json:"FunctionVersion,omitempty"` + + // FunctionWeight AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-alias-versionweight.html#cfn-lambda-alias-versionweight-functionweight + FunctionWeight float64 `json:"FunctionWeight,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaAlias_VersionWeight) AWSCloudFormationType() string { + return "AWS::Lambda::Alias.VersionWeight" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaAlias_VersionWeight) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b773e2fcb25a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-eventsourcemapping.go @@ -0,0 +1,141 @@ +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: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition + StartingPosition string `json:"StartingPosition,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaEventSourceMapping) AWSCloudFormationType() string { + return "AWS::Lambda::EventSourceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaEventSourceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..19b674c40c02 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function.go @@ -0,0 +1,191 @@ +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"` + + // ReservedConcurrentExecutions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-reservedconcurrentexecutions + ReservedConcurrentExecutions int `json:"ReservedConcurrentExecutions,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction) AWSCloudFormationType() string { + return "AWS::Lambda::Function" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..56db3d1a824d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_code.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_Code) AWSCloudFormationType() string { + return "AWS::Lambda::Function.Code" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction_Code) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..504e593aed6b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_deadletterconfig.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_DeadLetterConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.DeadLetterConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction_DeadLetterConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..817ddc4fa2ff --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_environment.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_Environment) AWSCloudFormationType() string { + return "AWS::Lambda::Function.Environment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction_Environment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6fb59b9c3105 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_tracingconfig.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_TracingConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.TracingConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction_TracingConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c8ef6eae6710 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-function_vpcconfig.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaFunction_VpcConfig) AWSCloudFormationType() string { + return "AWS::Lambda::Function.VpcConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaFunction_VpcConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0a3d8da8e36f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-permission.go @@ -0,0 +1,146 @@ +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"` + + // EventSourceToken AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html#cfn-lambda-permission-eventsourcetoken + EventSourceToken string `json:"EventSourceToken,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaPermission) AWSCloudFormationType() string { + return "AWS::Lambda::Permission" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaPermission) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..8972dcfc5bb8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-lambda-version.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLambdaVersion) AWSCloudFormationType() string { + return "AWS::Lambda::Version" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLambdaVersion) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d16802af4e58 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-destination.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsDestination) AWSCloudFormationType() string { + return "AWS::Logs::Destination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..ef360a4d0494 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-loggroup.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsLogGroup) AWSCloudFormationType() string { + return "AWS::Logs::LogGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsLogGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d0d4e058bab3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-logstream.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsLogStream) AWSCloudFormationType() string { + return "AWS::Logs::LogStream" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsLogStream) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..a8ec69bc10a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsMetricFilter) AWSCloudFormationType() string { + return "AWS::Logs::MetricFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsMetricFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..cc3f3790a0f6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-metricfilter_metrictransformation.go @@ -0,0 +1,40 @@ +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 { + + // DefaultValue AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-cwl-metricfilter-metrictransformation-defaultvalue + DefaultValue float64 `json:"DefaultValue,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsMetricFilter_MetricTransformation) AWSCloudFormationType() string { + return "AWS::Logs::MetricFilter.MetricTransformation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsMetricFilter_MetricTransformation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..acec957fa73b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-logs-subscriptionfilter.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSLogsSubscriptionFilter) AWSCloudFormationType() string { + return "AWS::Logs::SubscriptionFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSLogsSubscriptionFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-neptune-dbcluster.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbcluster.go new file mode 100644 index 000000000000..8fef289774b1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbcluster.go @@ -0,0 +1,186 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSNeptuneDBCluster AWS CloudFormation Resource (AWS::Neptune::DBCluster) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html +type AWSNeptuneDBCluster struct { + + // AvailabilityZones AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-availabilityzones + AvailabilityZones []string `json:"AvailabilityZones,omitempty"` + + // BackupRetentionPeriod AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-backupretentionperiod + BackupRetentionPeriod int `json:"BackupRetentionPeriod,omitempty"` + + // DBClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-dbclusteridentifier + DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"` + + // DBClusterParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-dbclusterparametergroupname + DBClusterParameterGroupName string `json:"DBClusterParameterGroupName,omitempty"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"` + + // IamAuthEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-iamauthenabled + IamAuthEnabled bool `json:"IamAuthEnabled,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // Port AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-port + Port int `json:"Port,omitempty"` + + // PreferredBackupWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-preferredbackupwindow + PreferredBackupWindow string `json:"PreferredBackupWindow,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // SnapshotIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-snapshotidentifier + SnapshotIdentifier string `json:"SnapshotIdentifier,omitempty"` + + // StorageEncrypted AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-storageencrypted + StorageEncrypted bool `json:"StorageEncrypted,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcSecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbcluster.html#cfn-neptune-dbcluster-vpcsecuritygroupids + VpcSecurityGroupIds []string `json:"VpcSecurityGroupIds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSNeptuneDBCluster) AWSCloudFormationType() string { + return "AWS::Neptune::DBCluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSNeptuneDBCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSNeptuneDBCluster) MarshalJSON() ([]byte, error) { + type Properties AWSNeptuneDBCluster + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSNeptuneDBCluster) UnmarshalJSON(b []byte) error { + type Properties AWSNeptuneDBCluster + 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 = AWSNeptuneDBCluster(*res.Properties) + } + + return nil +} + +// GetAllAWSNeptuneDBClusterResources retrieves all AWSNeptuneDBCluster items from an AWS CloudFormation template +func (t *Template) GetAllAWSNeptuneDBClusterResources() map[string]AWSNeptuneDBCluster { + results := map[string]AWSNeptuneDBCluster{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSNeptuneDBCluster: + // 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::Neptune::DBCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBCluster + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSNeptuneDBClusterWithName retrieves all AWSNeptuneDBCluster items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSNeptuneDBClusterWithName(name string) (AWSNeptuneDBCluster, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSNeptuneDBCluster: + // 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::Neptune::DBCluster" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBCluster + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSNeptuneDBCluster{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbclusterparametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbclusterparametergroup.go new file mode 100644 index 000000000000..65bbeabdacbd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbclusterparametergroup.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSNeptuneDBClusterParameterGroup AWS CloudFormation Resource (AWS::Neptune::DBClusterParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html +type AWSNeptuneDBClusterParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html#cfn-neptune-dbclusterparametergroup-description + Description string `json:"Description,omitempty"` + + // Family AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html#cfn-neptune-dbclusterparametergroup-family + Family string `json:"Family,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html#cfn-neptune-dbclusterparametergroup-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html#cfn-neptune-dbclusterparametergroup-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbclusterparametergroup.html#cfn-neptune-dbclusterparametergroup-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSNeptuneDBClusterParameterGroup) AWSCloudFormationType() string { + return "AWS::Neptune::DBClusterParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSNeptuneDBClusterParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSNeptuneDBClusterParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSNeptuneDBClusterParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSNeptuneDBClusterParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSNeptuneDBClusterParameterGroup + 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 = AWSNeptuneDBClusterParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSNeptuneDBClusterParameterGroupResources retrieves all AWSNeptuneDBClusterParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSNeptuneDBClusterParameterGroupResources() map[string]AWSNeptuneDBClusterParameterGroup { + results := map[string]AWSNeptuneDBClusterParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSNeptuneDBClusterParameterGroup: + // 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::Neptune::DBClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSNeptuneDBClusterParameterGroupWithName retrieves all AWSNeptuneDBClusterParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSNeptuneDBClusterParameterGroupWithName(name string) (AWSNeptuneDBClusterParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSNeptuneDBClusterParameterGroup: + // 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::Neptune::DBClusterParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBClusterParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSNeptuneDBClusterParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbinstance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbinstance.go new file mode 100644 index 000000000000..050835038ab6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbinstance.go @@ -0,0 +1,171 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSNeptuneDBInstance AWS CloudFormation Resource (AWS::Neptune::DBInstance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html +type AWSNeptuneDBInstance struct { + + // AllowMajorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-allowmajorversionupgrade + AllowMajorVersionUpgrade bool `json:"AllowMajorVersionUpgrade,omitempty"` + + // AutoMinorVersionUpgrade AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-autominorversionupgrade + AutoMinorVersionUpgrade bool `json:"AutoMinorVersionUpgrade,omitempty"` + + // AvailabilityZone AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-availabilityzone + AvailabilityZone string `json:"AvailabilityZone,omitempty"` + + // DBClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbclusteridentifier + DBClusterIdentifier string `json:"DBClusterIdentifier,omitempty"` + + // DBInstanceClass AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbinstanceclass + DBInstanceClass string `json:"DBInstanceClass,omitempty"` + + // DBInstanceIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbinstanceidentifier + DBInstanceIdentifier string `json:"DBInstanceIdentifier,omitempty"` + + // DBParameterGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbparametergroupname + DBParameterGroupName string `json:"DBParameterGroupName,omitempty"` + + // DBSnapshotIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbsnapshotidentifier + DBSnapshotIdentifier string `json:"DBSnapshotIdentifier,omitempty"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"` + + // PreferredMaintenanceWindow AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-preferredmaintenancewindow + PreferredMaintenanceWindow string `json:"PreferredMaintenanceWindow,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbinstance.html#cfn-neptune-dbinstance-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSNeptuneDBInstance) AWSCloudFormationType() string { + return "AWS::Neptune::DBInstance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSNeptuneDBInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSNeptuneDBInstance) MarshalJSON() ([]byte, error) { + type Properties AWSNeptuneDBInstance + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSNeptuneDBInstance) UnmarshalJSON(b []byte) error { + type Properties AWSNeptuneDBInstance + 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 = AWSNeptuneDBInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSNeptuneDBInstanceResources retrieves all AWSNeptuneDBInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSNeptuneDBInstanceResources() map[string]AWSNeptuneDBInstance { + results := map[string]AWSNeptuneDBInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSNeptuneDBInstance: + // 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::Neptune::DBInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSNeptuneDBInstanceWithName retrieves all AWSNeptuneDBInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSNeptuneDBInstanceWithName(name string) (AWSNeptuneDBInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSNeptuneDBInstance: + // 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::Neptune::DBInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSNeptuneDBInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbparametergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbparametergroup.go new file mode 100644 index 000000000000..3d4f35f7b991 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbparametergroup.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSNeptuneDBParameterGroup AWS CloudFormation Resource (AWS::Neptune::DBParameterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html +type AWSNeptuneDBParameterGroup struct { + + // Description AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html#cfn-neptune-dbparametergroup-description + Description string `json:"Description,omitempty"` + + // Family AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html#cfn-neptune-dbparametergroup-family + Family string `json:"Family,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html#cfn-neptune-dbparametergroup-name + Name string `json:"Name,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html#cfn-neptune-dbparametergroup-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbparametergroup.html#cfn-neptune-dbparametergroup-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSNeptuneDBParameterGroup) AWSCloudFormationType() string { + return "AWS::Neptune::DBParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSNeptuneDBParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSNeptuneDBParameterGroup) MarshalJSON() ([]byte, error) { + type Properties AWSNeptuneDBParameterGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSNeptuneDBParameterGroup) UnmarshalJSON(b []byte) error { + type Properties AWSNeptuneDBParameterGroup + 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 = AWSNeptuneDBParameterGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSNeptuneDBParameterGroupResources retrieves all AWSNeptuneDBParameterGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSNeptuneDBParameterGroupResources() map[string]AWSNeptuneDBParameterGroup { + results := map[string]AWSNeptuneDBParameterGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSNeptuneDBParameterGroup: + // 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::Neptune::DBParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSNeptuneDBParameterGroupWithName retrieves all AWSNeptuneDBParameterGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSNeptuneDBParameterGroupWithName(name string) (AWSNeptuneDBParameterGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSNeptuneDBParameterGroup: + // 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::Neptune::DBParameterGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBParameterGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSNeptuneDBParameterGroup{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbsubnetgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbsubnetgroup.go new file mode 100644 index 000000000000..0807ed83a5d1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-neptune-dbsubnetgroup.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSNeptuneDBSubnetGroup AWS CloudFormation Resource (AWS::Neptune::DBSubnetGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbsubnetgroup.html +type AWSNeptuneDBSubnetGroup struct { + + // DBSubnetGroupDescription AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbsubnetgroup.html#cfn-neptune-dbsubnetgroup-dbsubnetgroupdescription + DBSubnetGroupDescription string `json:"DBSubnetGroupDescription,omitempty"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbsubnetgroup.html#cfn-neptune-dbsubnetgroup-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,omitempty"` + + // SubnetIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbsubnetgroup.html#cfn-neptune-dbsubnetgroup-subnetids + SubnetIds []string `json:"SubnetIds,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-neptune-dbsubnetgroup.html#cfn-neptune-dbsubnetgroup-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSNeptuneDBSubnetGroup) AWSCloudFormationType() string { + return "AWS::Neptune::DBSubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSNeptuneDBSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSNeptuneDBSubnetGroup) MarshalJSON() ([]byte, error) { + type Properties AWSNeptuneDBSubnetGroup + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSNeptuneDBSubnetGroup) UnmarshalJSON(b []byte) error { + type Properties AWSNeptuneDBSubnetGroup + 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 = AWSNeptuneDBSubnetGroup(*res.Properties) + } + + return nil +} + +// GetAllAWSNeptuneDBSubnetGroupResources retrieves all AWSNeptuneDBSubnetGroup items from an AWS CloudFormation template +func (t *Template) GetAllAWSNeptuneDBSubnetGroupResources() map[string]AWSNeptuneDBSubnetGroup { + results := map[string]AWSNeptuneDBSubnetGroup{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSNeptuneDBSubnetGroup: + // 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::Neptune::DBSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSNeptuneDBSubnetGroupWithName retrieves all AWSNeptuneDBSubnetGroup items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSNeptuneDBSubnetGroupWithName(name string) (AWSNeptuneDBSubnetGroup, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSNeptuneDBSubnetGroup: + // 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::Neptune::DBSubnetGroup" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSNeptuneDBSubnetGroup + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSNeptuneDBSubnetGroup{}, 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 000000000000..6518cdcfb93b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app.go @@ -0,0 +1,176 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp) AWSCloudFormationType() string { + return "AWS::OpsWorks::App" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksApp) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..ddb226e85ca4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_datasource.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_DataSource) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.DataSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksApp_DataSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..91852cd92918 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_environmentvariable.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_EnvironmentVariable) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.EnvironmentVariable" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksApp_EnvironmentVariable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..50e944dbb22b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_source.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_Source) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.Source" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksApp_Source) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..17121e5cd919 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-app_sslconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksApp_SslConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::App.SslConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksApp_SslConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..838724099ea4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-elasticloadbalancerattachment.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksElasticLoadBalancerAttachment) AWSCloudFormationType() string { + return "AWS::OpsWorks::ElasticLoadBalancerAttachment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksElasticLoadBalancerAttachment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..70057abcc413 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance.go @@ -0,0 +1,221 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..62db776065d6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_blockdevicemapping.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_BlockDeviceMapping) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.BlockDeviceMapping" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksInstance_BlockDeviceMapping) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..35741374a5c9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_ebsblockdevice.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_EbsBlockDevice) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.EbsBlockDevice" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksInstance_EbsBlockDevice) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4deb81a148bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-instance_timebasedautoscaling.go @@ -0,0 +1,55 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksInstance_TimeBasedAutoScaling) AWSCloudFormationType() string { + return "AWS::OpsWorks::Instance.TimeBasedAutoScaling" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksInstance_TimeBasedAutoScaling) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..70dd651e0f9c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer.go @@ -0,0 +1,211 @@ +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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-layer.html#cfn-opsworks-layer-tags + Tags []Tag `json:"Tags,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4acd8ea8b039 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_autoscalingthresholds.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_AutoScalingThresholds) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.AutoScalingThresholds" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_AutoScalingThresholds) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..41718bff50d9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_lifecycleeventconfiguration.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_LifecycleEventConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.LifecycleEventConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_LifecycleEventConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9bbc145802bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_loadbasedautoscaling.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_LoadBasedAutoScaling) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.LoadBasedAutoScaling" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_LoadBasedAutoScaling) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2d99064dee85 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_recipes.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_Recipes) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.Recipes" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_Recipes) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c2e4a768948c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_shutdowneventconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_ShutdownEventConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.ShutdownEventConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_ShutdownEventConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..40a483d451a6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-layer_volumeconfiguration.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksLayer_VolumeConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Layer.VolumeConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksLayer_VolumeConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5a84ea4bc5da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack.go @@ -0,0 +1,241 @@ +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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opsworks-stack.html#cfn-opsworks-stack-tags + Tags []Tag `json:"Tags,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..26eba209713c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_chefconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_ChefConfiguration) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.ChefConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack_ChefConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..edd3abb80416 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_elasticip.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_ElasticIp) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.ElasticIp" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack_ElasticIp) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c465c761ea35 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_rdsdbinstance.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_RdsDbInstance) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.RdsDbInstance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack_RdsDbInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ae54f6ffba3e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_source.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_Source) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.Source" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack_Source) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..eb78be22b2e2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-stack_stackconfigurationmanager.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksStack_StackConfigurationManager) AWSCloudFormationType() string { + return "AWS::OpsWorks::Stack.StackConfigurationManager" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksStack_StackConfigurationManager) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..474bfd874248 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-userprofile.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksUserProfile) AWSCloudFormationType() string { + return "AWS::OpsWorks::UserProfile" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksUserProfile) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1cbc1b44e643 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-opsworks-volume.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSOpsWorksVolume) AWSCloudFormationType() string { + return "AWS::OpsWorks::Volume" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSOpsWorksVolume) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f316d72f33ab --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbcluster.go @@ -0,0 +1,211 @@ +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"` + + // DBClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html#cfn-rds-dbcluster-dbclusteridentifier + DBClusterIdentifier string `json:"DBClusterIdentifier,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBCluster) AWSCloudFormationType() string { + return "AWS::RDS::DBCluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..4c6571dc4b89 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbclusterparametergroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBClusterParameterGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBClusterParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBClusterParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..fd9c19d132c7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbinstance.go @@ -0,0 +1,311 @@ +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"` + + // SourceRegion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-sourceregion + SourceRegion string `json:"SourceRegion,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBInstance) AWSCloudFormationType() string { + return "AWS::RDS::DBInstance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..78bbf9e7c46c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbparametergroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBParameterGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..6ad0d6602473 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBSecurityGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..cf1eebc1f731 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroup_ingress.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroup_Ingress) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroup.Ingress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBSecurityGroup_Ingress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..896fb2bd765d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsecuritygroupingress.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::RDS::DBSecurityGroupIngress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBSecurityGroupIngress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..03a3c3cc1222 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-dbsubnetgroup.go @@ -0,0 +1,136 @@ +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"` + + // DBSubnetGroupName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html#cfn-rds-dbsubnetgroup-dbsubnetgroupname + DBSubnetGroupName string `json:"DBSubnetGroupName,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSDBSubnetGroup) AWSCloudFormationType() string { + return "AWS::RDS::DBSubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSDBSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7d31a10f23ac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-eventsubscription.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSEventSubscription) AWSCloudFormationType() string { + return "AWS::RDS::EventSubscription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSEventSubscription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..df76aea2ab92 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup.go @@ -0,0 +1,141 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSOptionGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..fe5bb8c73a7d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionconfiguration.go @@ -0,0 +1,50 @@ +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"` + + // OptionVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-optiongroup-optionconfigurations.html#cfn-rds-optiongroup-optionconfiguration-optionversion + OptionVersion string `json:"OptionVersion,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup_OptionConfiguration) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup.OptionConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSOptionGroup_OptionConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4076b3df909a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-rds-optiongroup_optionsetting.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRDSOptionGroup_OptionSetting) AWSCloudFormationType() string { + return "AWS::RDS::OptionGroup.OptionSetting" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRDSOptionGroup_OptionSetting) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9b83b703fc45 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster.go @@ -0,0 +1,261 @@ +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"` + + // ClusterIdentifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html#cfn-redshift-cluster-clusteridentifier + ClusterIdentifier string `json:"ClusterIdentifier,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftCluster) AWSCloudFormationType() string { + return "AWS::Redshift::Cluster" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftCluster) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2bf603abfb8a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-cluster_loggingproperties.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftCluster_LoggingProperties) AWSCloudFormationType() string { + return "AWS::Redshift::Cluster.LoggingProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftCluster_LoggingProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ae1fb808af72 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterParameterGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterParameterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftClusterParameterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..334b3338d104 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clusterparametergroup_parameter.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterParameterGroup_Parameter) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterParameterGroup.Parameter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftClusterParameterGroup_Parameter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..824be4b57320 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroup.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSecurityGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSecurityGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftClusterSecurityGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..00a89d168d9b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersecuritygroupingress.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSecurityGroupIngress) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSecurityGroupIngress" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftClusterSecurityGroupIngress) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..960f6626471a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-redshift-clustersubnetgroup.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRedshiftClusterSubnetGroup) AWSCloudFormationType() string { + return "AWS::Redshift::ClusterSubnetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRedshiftClusterSubnetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2ad13241a920 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HealthCheck) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..fe2fb5fb9309 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_alarmidentifier.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_AlarmIdentifier) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.AlarmIdentifier" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HealthCheck_AlarmIdentifier) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c754aa494506 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthcheckconfig.go @@ -0,0 +1,100 @@ +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"` + + // Regions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-healthcheck-healthcheckconfig.html#cfn-route53-healthcheck-healthcheckconfig-regions + Regions []string `json:"Regions,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_HealthCheckConfig) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.HealthCheckConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HealthCheck_HealthCheckConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..35d89301b751 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-healthcheck_healthchecktag.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HealthCheck_HealthCheckTag) AWSCloudFormationType() string { + return "AWS::Route53::HealthCheck.HealthCheckTag" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HealthCheck_HealthCheckTag) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8d1f080399a9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone.go @@ -0,0 +1,141 @@ +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"` + + // QueryLoggingConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-queryloggingconfig + QueryLoggingConfig *AWSRoute53HostedZone_QueryLoggingConfig `json:"QueryLoggingConfig,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HostedZone) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..3324ea9cb2d1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzoneconfig.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_HostedZoneConfig) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.HostedZoneConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HostedZone_HostedZoneConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5900a32c2145 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_hostedzonetag.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_HostedZoneTag) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.HostedZoneTag" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HostedZone_HostedZoneTag) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_queryloggingconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_queryloggingconfig.go new file mode 100644 index 000000000000..e7ec2e831ec8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_queryloggingconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSRoute53HostedZone_QueryLoggingConfig AWS CloudFormation Resource (AWS::Route53::HostedZone.QueryLoggingConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-queryloggingconfig.html +type AWSRoute53HostedZone_QueryLoggingConfig struct { + + // CloudWatchLogsLogGroupArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-queryloggingconfig.html#cfn-route53-hostedzone-queryloggingconfig-cloudwatchlogsloggrouparn + CloudWatchLogsLogGroupArn string `json:"CloudWatchLogsLogGroupArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_QueryLoggingConfig) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.QueryLoggingConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HostedZone_QueryLoggingConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..55e15f1922b3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-hostedzone_vpc.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53HostedZone_VPC) AWSCloudFormationType() string { + return "AWS::Route53::HostedZone.VPC" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53HostedZone_VPC) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e2cf37dc6b95 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset.go @@ -0,0 +1,186 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..73ede4cf081d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_aliastarget.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet_AliasTarget) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet.AliasTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSet_AliasTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3894073a24d3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordset_geolocation.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSet_GeoLocation) AWSCloudFormationType() string { + return "AWS::Route53::RecordSet.GeoLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSet_GeoLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a2cafa7924e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSetGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7ad30eb283ec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_aliastarget.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_AliasTarget) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.AliasTarget" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSetGroup_AliasTarget) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..56d0e4d8b497 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_geolocation.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_GeoLocation) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.GeoLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSetGroup_GeoLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..01c0eaa96ba3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-route53-recordsetgroup_recordset.go @@ -0,0 +1,90 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSRoute53RecordSetGroup_RecordSet) AWSCloudFormationType() string { + return "AWS::Route53::RecordSetGroup.RecordSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSRoute53RecordSetGroup_RecordSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3e6c10bcc429 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket.go @@ -0,0 +1,191 @@ +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 { + + // AccelerateConfiguration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-accelerateconfiguration + AccelerateConfiguration *AWSS3Bucket_AccelerateConfiguration `json:"AccelerateConfiguration,omitempty"` + + // 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"` + + // AnalyticsConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-analyticsconfigurations + AnalyticsConfigurations []AWSS3Bucket_AnalyticsConfiguration `json:"AnalyticsConfigurations,omitempty"` + + // BucketEncryption AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-bucketencryption + BucketEncryption *AWSS3Bucket_BucketEncryption `json:"BucketEncryption,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"` + + // InventoryConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-inventoryconfigurations + InventoryConfigurations []AWSS3Bucket_InventoryConfiguration `json:"InventoryConfigurations,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"` + + // MetricsConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html#cfn-s3-bucket-metricsconfigurations + MetricsConfigurations []AWSS3Bucket_MetricsConfiguration `json:"MetricsConfigurations,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket) AWSCloudFormationType() string { + return "AWS::S3::Bucket" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_abortincompletemultipartupload.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_abortincompletemultipartupload.go new file mode 100644 index 000000000000..2ab172dfbc77 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_abortincompletemultipartupload.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_AbortIncompleteMultipartUpload AWS CloudFormation Resource (AWS::S3::Bucket.AbortIncompleteMultipartUpload) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-abortincompletemultipartupload.html +type AWSS3Bucket_AbortIncompleteMultipartUpload struct { + + // DaysAfterInitiation AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-abortincompletemultipartupload.html#cfn-s3-bucket-abortincompletemultipartupload-daysafterinitiation + DaysAfterInitiation int `json:"DaysAfterInitiation,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_AbortIncompleteMultipartUpload) AWSCloudFormationType() string { + return "AWS::S3::Bucket.AbortIncompleteMultipartUpload" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_AbortIncompleteMultipartUpload) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accelerateconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accelerateconfiguration.go new file mode 100644 index 000000000000..2193c98ffa95 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accelerateconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_AccelerateConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.AccelerateConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-accelerateconfiguration.html +type AWSS3Bucket_AccelerateConfiguration struct { + + // AccelerationStatus AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-accelerateconfiguration.html#cfn-s3-bucket-accelerateconfiguration-accelerationstatus + AccelerationStatus string `json:"AccelerationStatus,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_AccelerateConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.AccelerateConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_AccelerateConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accesscontroltranslation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accesscontroltranslation.go new file mode 100644 index 000000000000..5d723e41bafb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_accesscontroltranslation.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_AccessControlTranslation AWS CloudFormation Resource (AWS::S3::Bucket.AccessControlTranslation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-accesscontroltranslation.html +type AWSS3Bucket_AccessControlTranslation struct { + + // Owner AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-accesscontroltranslation.html#cfn-s3-bucket-accesscontroltranslation-owner + Owner string `json:"Owner,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_AccessControlTranslation) AWSCloudFormationType() string { + return "AWS::S3::Bucket.AccessControlTranslation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_AccessControlTranslation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_analyticsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_analyticsconfiguration.go new file mode 100644 index 000000000000..10ae1fdadf43 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_analyticsconfiguration.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSS3Bucket_AnalyticsConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.AnalyticsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-analyticsconfiguration.html +type AWSS3Bucket_AnalyticsConfiguration struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-analyticsconfiguration.html#cfn-s3-bucket-analyticsconfiguration-id + Id string `json:"Id,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-analyticsconfiguration.html#cfn-s3-bucket-analyticsconfiguration-prefix + Prefix string `json:"Prefix,omitempty"` + + // StorageClassAnalysis AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-analyticsconfiguration.html#cfn-s3-bucket-analyticsconfiguration-storageclassanalysis + StorageClassAnalysis *AWSS3Bucket_StorageClassAnalysis `json:"StorageClassAnalysis,omitempty"` + + // TagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-analyticsconfiguration.html#cfn-s3-bucket-analyticsconfiguration-tagfilters + TagFilters []AWSS3Bucket_TagFilter `json:"TagFilters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_AnalyticsConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.AnalyticsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_AnalyticsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_bucketencryption.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_bucketencryption.go new file mode 100644 index 000000000000..314c0876cb1d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_bucketencryption.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_BucketEncryption AWS CloudFormation Resource (AWS::S3::Bucket.BucketEncryption) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-bucketencryption.html +type AWSS3Bucket_BucketEncryption struct { + + // ServerSideEncryptionConfiguration AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-bucketencryption.html#cfn-s3-bucket-bucketencryption-serversideencryptionconfiguration + ServerSideEncryptionConfiguration []AWSS3Bucket_ServerSideEncryptionRule `json:"ServerSideEncryptionConfiguration,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_BucketEncryption) AWSCloudFormationType() string { + return "AWS::S3::Bucket.BucketEncryption" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_BucketEncryption) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1171aed72d8d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsconfiguration.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_CorsConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.CorsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_CorsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..4311ea0874a6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_corsrule.go @@ -0,0 +1,50 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_CorsRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.CorsRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_CorsRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_dataexport.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_dataexport.go new file mode 100644 index 000000000000..bc3502b9a662 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_dataexport.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSS3Bucket_DataExport AWS CloudFormation Resource (AWS::S3::Bucket.DataExport) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-dataexport.html +type AWSS3Bucket_DataExport struct { + + // Destination AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-dataexport.html#cfn-s3-bucket-dataexport-destination + Destination *AWSS3Bucket_Destination `json:"Destination,omitempty"` + + // OutputSchemaVersion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-dataexport.html#cfn-s3-bucket-dataexport-outputschemaversion + OutputSchemaVersion string `json:"OutputSchemaVersion,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_DataExport) AWSCloudFormationType() string { + return "AWS::S3::Bucket.DataExport" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_DataExport) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_destination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_destination.go new file mode 100644 index 000000000000..33173ca7041d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_destination.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSS3Bucket_Destination AWS CloudFormation Resource (AWS::S3::Bucket.Destination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-destination.html +type AWSS3Bucket_Destination struct { + + // BucketAccountId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-destination.html#cfn-s3-bucket-destination-bucketaccountid + BucketAccountId string `json:"BucketAccountId,omitempty"` + + // BucketArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-destination.html#cfn-s3-bucket-destination-bucketarn + BucketArn string `json:"BucketArn,omitempty"` + + // Format AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-destination.html#cfn-s3-bucket-destination-format + Format string `json:"Format,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-destination.html#cfn-s3-bucket-destination-prefix + Prefix string `json:"Prefix,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_Destination) AWSCloudFormationType() string { + return "AWS::S3::Bucket.Destination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_Destination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_encryptionconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_encryptionconfiguration.go new file mode 100644 index 000000000000..d19908a7dfbb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_encryptionconfiguration.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_EncryptionConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.EncryptionConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-encryptionconfiguration.html +type AWSS3Bucket_EncryptionConfiguration struct { + + // ReplicaKmsKeyID AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-encryptionconfiguration.html#cfn-s3-bucket-encryptionconfiguration-replicakmskeyid + ReplicaKmsKeyID string `json:"ReplicaKmsKeyID,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_EncryptionConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.EncryptionConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_EncryptionConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..066e3a14d2f2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_filterrule.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_FilterRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.FilterRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_FilterRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_inventoryconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_inventoryconfiguration.go new file mode 100644 index 000000000000..9411f4280787 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_inventoryconfiguration.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSS3Bucket_InventoryConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.InventoryConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html +type AWSS3Bucket_InventoryConfiguration struct { + + // Destination AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-destination + Destination *AWSS3Bucket_Destination `json:"Destination,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-id + Id string `json:"Id,omitempty"` + + // IncludedObjectVersions AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-includedobjectversions + IncludedObjectVersions string `json:"IncludedObjectVersions,omitempty"` + + // OptionalFields AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-optionalfields + OptionalFields []string `json:"OptionalFields,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-prefix + Prefix string `json:"Prefix,omitempty"` + + // ScheduleFrequency AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-inventoryconfiguration.html#cfn-s3-bucket-inventoryconfiguration-schedulefrequency + ScheduleFrequency string `json:"ScheduleFrequency,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_InventoryConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.InventoryConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_InventoryConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d9a384a93578 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lambdaconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LambdaConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LambdaConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_LambdaConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0b5435c39ba5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_lifecycleconfiguration.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LifecycleConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LifecycleConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_LifecycleConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7fcd216ea858 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_loggingconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_LoggingConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.LoggingConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_LoggingConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_metricsconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_metricsconfiguration.go new file mode 100644 index 000000000000..8962f2236002 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_metricsconfiguration.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSS3Bucket_MetricsConfiguration AWS CloudFormation Resource (AWS::S3::Bucket.MetricsConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-metricsconfiguration.html +type AWSS3Bucket_MetricsConfiguration struct { + + // Id AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-metricsconfiguration.html#cfn-s3-bucket-metricsconfiguration-id + Id string `json:"Id,omitempty"` + + // Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-metricsconfiguration.html#cfn-s3-bucket-metricsconfiguration-prefix + Prefix string `json:"Prefix,omitempty"` + + // TagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-metricsconfiguration.html#cfn-s3-bucket-metricsconfiguration-tagfilters + TagFilters []AWSS3Bucket_TagFilter `json:"TagFilters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_MetricsConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.MetricsConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_MetricsConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..883613197f22 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_noncurrentversiontransition.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NoncurrentVersionTransition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NoncurrentVersionTransition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_NoncurrentVersionTransition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3529b5b26642 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NotificationConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NotificationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_NotificationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9b3442768a43 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_notificationfilter.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_NotificationFilter) AWSCloudFormationType() string { + return "AWS::S3::Bucket.NotificationFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_NotificationFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6a3c46b0c031 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_queueconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_QueueConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.QueueConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_QueueConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..5886ecd6b46f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectallrequeststo.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RedirectAllRequestsTo) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RedirectAllRequestsTo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_RedirectAllRequestsTo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2b26f9c04c64 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_redirectrule.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RedirectRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RedirectRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_RedirectRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a1693864d018 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationconfiguration.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_ReplicationConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f588ff3dba1a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationdestination.go @@ -0,0 +1,45 @@ +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 { + + // AccessControlTranslation 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-replicationdestination-accesscontroltranslation + AccessControlTranslation *AWSS3Bucket_AccessControlTranslation `json:"AccessControlTranslation,omitempty"` + + // Account 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-replicationdestination-account + Account string `json:"Account,omitempty"` + + // 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"` + + // EncryptionConfiguration 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-replicationdestination-encryptionconfiguration + EncryptionConfiguration *AWSS3Bucket_EncryptionConfiguration `json:"EncryptionConfiguration,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationDestination) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationDestination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_ReplicationDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..029288d84ab9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_replicationrule.go @@ -0,0 +1,45 @@ +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"` + + // SourceSelectionCriteria AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-replicationconfiguration-rules.html#cfn-s3-bucket-replicationrule-sourceselectioncriteria + SourceSelectionCriteria *AWSS3Bucket_SourceSelectionCriteria `json:"SourceSelectionCriteria,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ReplicationRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ReplicationRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_ReplicationRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..568befe213d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrule.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RoutingRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RoutingRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_RoutingRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0acf9d2afa30 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_routingrulecondition.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_RoutingRuleCondition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.RoutingRuleCondition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_RoutingRuleCondition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..275f503543db --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_rule.go @@ -0,0 +1,80 @@ +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 { + + // AbortIncompleteMultipartUpload AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-rule-abortincompletemultipartupload + AbortIncompleteMultipartUpload *AWSS3Bucket_AbortIncompleteMultipartUpload `json:"AbortIncompleteMultipartUpload,omitempty"` + + // 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"` + + // TagFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-lifecycleconfig-rule.html#cfn-s3-bucket-rule-tagfilters + TagFilters []AWSS3Bucket_TagFilter `json:"TagFilters,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_Rule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_Rule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b55d932fc611 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_s3keyfilter.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_S3KeyFilter) AWSCloudFormationType() string { + return "AWS::S3::Bucket.S3KeyFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_S3KeyFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionbydefault.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionbydefault.go new file mode 100644 index 000000000000..595d1ecbe4c8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionbydefault.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSS3Bucket_ServerSideEncryptionByDefault AWS CloudFormation Resource (AWS::S3::Bucket.ServerSideEncryptionByDefault) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-serversideencryptionbydefault.html +type AWSS3Bucket_ServerSideEncryptionByDefault struct { + + // KMSMasterKeyID AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-serversideencryptionbydefault.html#cfn-s3-bucket-serversideencryptionbydefault-kmsmasterkeyid + KMSMasterKeyID string `json:"KMSMasterKeyID,omitempty"` + + // SSEAlgorithm AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-serversideencryptionbydefault.html#cfn-s3-bucket-serversideencryptionbydefault-ssealgorithm + SSEAlgorithm string `json:"SSEAlgorithm,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ServerSideEncryptionByDefault) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ServerSideEncryptionByDefault" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_ServerSideEncryptionByDefault) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionrule.go new file mode 100644 index 000000000000..5dfa4fb809a4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_serversideencryptionrule.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_ServerSideEncryptionRule AWS CloudFormation Resource (AWS::S3::Bucket.ServerSideEncryptionRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-serversideencryptionrule.html +type AWSS3Bucket_ServerSideEncryptionRule struct { + + // ServerSideEncryptionByDefault AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-serversideencryptionrule.html#cfn-s3-bucket-serversideencryptionrule-serversideencryptionbydefault + ServerSideEncryptionByDefault *AWSS3Bucket_ServerSideEncryptionByDefault `json:"ServerSideEncryptionByDefault,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_ServerSideEncryptionRule) AWSCloudFormationType() string { + return "AWS::S3::Bucket.ServerSideEncryptionRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_ServerSideEncryptionRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_sourceselectioncriteria.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_sourceselectioncriteria.go new file mode 100644 index 000000000000..51cdd9d8bfe5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_sourceselectioncriteria.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_SourceSelectionCriteria AWS CloudFormation Resource (AWS::S3::Bucket.SourceSelectionCriteria) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-sourceselectioncriteria.html +type AWSS3Bucket_SourceSelectionCriteria struct { + + // SseKmsEncryptedObjects AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-sourceselectioncriteria.html#cfn-s3-bucket-sourceselectioncriteria-ssekmsencryptedobjects + SseKmsEncryptedObjects *AWSS3Bucket_SseKmsEncryptedObjects `json:"SseKmsEncryptedObjects,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_SourceSelectionCriteria) AWSCloudFormationType() string { + return "AWS::S3::Bucket.SourceSelectionCriteria" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_SourceSelectionCriteria) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_ssekmsencryptedobjects.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_ssekmsencryptedobjects.go new file mode 100644 index 000000000000..fe8f4210184f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_ssekmsencryptedobjects.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_SseKmsEncryptedObjects AWS CloudFormation Resource (AWS::S3::Bucket.SseKmsEncryptedObjects) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-ssekmsencryptedobjects.html +type AWSS3Bucket_SseKmsEncryptedObjects struct { + + // Status AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-ssekmsencryptedobjects.html#cfn-s3-bucket-ssekmsencryptedobjects-status + Status string `json:"Status,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_SseKmsEncryptedObjects) AWSCloudFormationType() string { + return "AWS::S3::Bucket.SseKmsEncryptedObjects" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_SseKmsEncryptedObjects) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_storageclassanalysis.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_storageclassanalysis.go new file mode 100644 index 000000000000..4029deea0c50 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_storageclassanalysis.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSS3Bucket_StorageClassAnalysis AWS CloudFormation Resource (AWS::S3::Bucket.StorageClassAnalysis) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-storageclassanalysis.html +type AWSS3Bucket_StorageClassAnalysis struct { + + // DataExport AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-storageclassanalysis.html#cfn-s3-bucket-storageclassanalysis-dataexport + DataExport *AWSS3Bucket_DataExport `json:"DataExport,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_StorageClassAnalysis) AWSCloudFormationType() string { + return "AWS::S3::Bucket.StorageClassAnalysis" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_StorageClassAnalysis) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_tagfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_tagfilter.go new file mode 100644 index 000000000000..ee34c2e5e021 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_tagfilter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSS3Bucket_TagFilter AWS CloudFormation Resource (AWS::S3::Bucket.TagFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-tagfilter.html +type AWSS3Bucket_TagFilter struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-tagfilter.html#cfn-s3-bucket-tagfilter-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-tagfilter.html#cfn-s3-bucket-tagfilter-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_TagFilter) AWSCloudFormationType() string { + return "AWS::S3::Bucket.TagFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_TagFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..3959f8c6d9e4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_topicconfiguration.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_TopicConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.TopicConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_TopicConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d6ad9752c79b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_transition.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_Transition) AWSCloudFormationType() string { + return "AWS::S3::Bucket.Transition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_Transition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..361f64938698 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_versioningconfiguration.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_VersioningConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.VersioningConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_VersioningConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1965664536d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucket_websiteconfiguration.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3Bucket_WebsiteConfiguration) AWSCloudFormationType() string { + return "AWS::S3::Bucket.WebsiteConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3Bucket_WebsiteConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b5586f196bee --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-s3-bucketpolicy.go @@ -0,0 +1,126 @@ +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#aws-properties-s3-policy-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#aws-properties-s3-policy-policydocument + PolicyDocument interface{} `json:"PolicyDocument,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSS3BucketPolicy) AWSCloudFormationType() string { + return "AWS::S3::BucketPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSS3BucketPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-sagemaker-endpoint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpoint.go new file mode 100644 index 000000000000..fc0564064011 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpoint.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSageMakerEndpoint AWS CloudFormation Resource (AWS::SageMaker::Endpoint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpoint.html +type AWSSageMakerEndpoint struct { + + // EndpointConfigName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpoint.html#cfn-sagemaker-endpoint-endpointconfigname + EndpointConfigName string `json:"EndpointConfigName,omitempty"` + + // EndpointName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpoint.html#cfn-sagemaker-endpoint-endpointname + EndpointName string `json:"EndpointName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpoint.html#cfn-sagemaker-endpoint-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerEndpoint) AWSCloudFormationType() string { + return "AWS::SageMaker::Endpoint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerEndpoint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSageMakerEndpoint) MarshalJSON() ([]byte, error) { + type Properties AWSSageMakerEndpoint + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSageMakerEndpoint) UnmarshalJSON(b []byte) error { + type Properties AWSSageMakerEndpoint + 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 = AWSSageMakerEndpoint(*res.Properties) + } + + return nil +} + +// GetAllAWSSageMakerEndpointResources retrieves all AWSSageMakerEndpoint items from an AWS CloudFormation template +func (t *Template) GetAllAWSSageMakerEndpointResources() map[string]AWSSageMakerEndpoint { + results := map[string]AWSSageMakerEndpoint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSageMakerEndpoint: + // 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::SageMaker::Endpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerEndpoint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSageMakerEndpointWithName retrieves all AWSSageMakerEndpoint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSageMakerEndpointWithName(name string) (AWSSageMakerEndpoint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSageMakerEndpoint: + // 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::SageMaker::Endpoint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerEndpoint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSageMakerEndpoint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig.go new file mode 100644 index 000000000000..bc8a2a2338dc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSageMakerEndpointConfig AWS CloudFormation Resource (AWS::SageMaker::EndpointConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpointconfig.html +type AWSSageMakerEndpointConfig struct { + + // EndpointConfigName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpointconfig.html#cfn-sagemaker-endpointconfig-endpointconfigname + EndpointConfigName string `json:"EndpointConfigName,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpointconfig.html#cfn-sagemaker-endpointconfig-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // ProductionVariants AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpointconfig.html#cfn-sagemaker-endpointconfig-productionvariants + ProductionVariants []AWSSageMakerEndpointConfig_ProductionVariant `json:"ProductionVariants,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpointconfig.html#cfn-sagemaker-endpointconfig-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerEndpointConfig) AWSCloudFormationType() string { + return "AWS::SageMaker::EndpointConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerEndpointConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSageMakerEndpointConfig) MarshalJSON() ([]byte, error) { + type Properties AWSSageMakerEndpointConfig + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSageMakerEndpointConfig) UnmarshalJSON(b []byte) error { + type Properties AWSSageMakerEndpointConfig + 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 = AWSSageMakerEndpointConfig(*res.Properties) + } + + return nil +} + +// GetAllAWSSageMakerEndpointConfigResources retrieves all AWSSageMakerEndpointConfig items from an AWS CloudFormation template +func (t *Template) GetAllAWSSageMakerEndpointConfigResources() map[string]AWSSageMakerEndpointConfig { + results := map[string]AWSSageMakerEndpointConfig{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSageMakerEndpointConfig: + // 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::SageMaker::EndpointConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerEndpointConfig + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSageMakerEndpointConfigWithName retrieves all AWSSageMakerEndpointConfig items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSageMakerEndpointConfigWithName(name string) (AWSSageMakerEndpointConfig, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSageMakerEndpointConfig: + // 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::SageMaker::EndpointConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerEndpointConfig + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSageMakerEndpointConfig{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig_productionvariant.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig_productionvariant.go new file mode 100644 index 000000000000..125e6f0adcf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-endpointconfig_productionvariant.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSSageMakerEndpointConfig_ProductionVariant AWS CloudFormation Resource (AWS::SageMaker::EndpointConfig.ProductionVariant) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html +type AWSSageMakerEndpointConfig_ProductionVariant struct { + + // InitialInstanceCount AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html#cfn-sagemaker-endpointconfig-productionvariant-initialinstancecount + InitialInstanceCount int `json:"InitialInstanceCount,omitempty"` + + // InitialVariantWeight AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html#cfn-sagemaker-endpointconfig-productionvariant-initialvariantweight + InitialVariantWeight float64 `json:"InitialVariantWeight,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html#cfn-sagemaker-endpointconfig-productionvariant-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // ModelName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html#cfn-sagemaker-endpointconfig-productionvariant-modelname + ModelName string `json:"ModelName,omitempty"` + + // VariantName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-endpointconfig-productionvariant.html#cfn-sagemaker-endpointconfig-productionvariant-variantname + VariantName string `json:"VariantName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerEndpointConfig_ProductionVariant) AWSCloudFormationType() string { + return "AWS::SageMaker::EndpointConfig.ProductionVariant" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerEndpointConfig_ProductionVariant) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model.go new file mode 100644 index 000000000000..6ed993dc4ffc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSageMakerModel AWS CloudFormation Resource (AWS::SageMaker::Model) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html +type AWSSageMakerModel struct { + + // ExecutionRoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-executionrolearn + ExecutionRoleArn string `json:"ExecutionRoleArn,omitempty"` + + // ModelName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-modelname + ModelName string `json:"ModelName,omitempty"` + + // PrimaryContainer AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-primarycontainer + PrimaryContainer *AWSSageMakerModel_ContainerDefinition `json:"PrimaryContainer,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-tags + Tags []Tag `json:"Tags,omitempty"` + + // VpcConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-model.html#cfn-sagemaker-model-vpcconfig + VpcConfig *AWSSageMakerModel_VpcConfig `json:"VpcConfig,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerModel) AWSCloudFormationType() string { + return "AWS::SageMaker::Model" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerModel) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSageMakerModel) MarshalJSON() ([]byte, error) { + type Properties AWSSageMakerModel + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSageMakerModel) UnmarshalJSON(b []byte) error { + type Properties AWSSageMakerModel + 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 = AWSSageMakerModel(*res.Properties) + } + + return nil +} + +// GetAllAWSSageMakerModelResources retrieves all AWSSageMakerModel items from an AWS CloudFormation template +func (t *Template) GetAllAWSSageMakerModelResources() map[string]AWSSageMakerModel { + results := map[string]AWSSageMakerModel{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSageMakerModel: + // 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::SageMaker::Model" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerModel + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSageMakerModelWithName retrieves all AWSSageMakerModel items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSageMakerModelWithName(name string) (AWSSageMakerModel, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSageMakerModel: + // 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::SageMaker::Model" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerModel + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSageMakerModel{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_containerdefinition.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_containerdefinition.go new file mode 100644 index 000000000000..bb90c2af9816 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_containerdefinition.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSSageMakerModel_ContainerDefinition AWS CloudFormation Resource (AWS::SageMaker::Model.ContainerDefinition) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html +type AWSSageMakerModel_ContainerDefinition struct { + + // ContainerHostname AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-containerhostname + ContainerHostname string `json:"ContainerHostname,omitempty"` + + // Environment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-environment + Environment interface{} `json:"Environment,omitempty"` + + // Image AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-image + Image string `json:"Image,omitempty"` + + // ModelDataUrl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-containerdefinition.html#cfn-sagemaker-model-containerdefinition-modeldataurl + ModelDataUrl string `json:"ModelDataUrl,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerModel_ContainerDefinition) AWSCloudFormationType() string { + return "AWS::SageMaker::Model.ContainerDefinition" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerModel_ContainerDefinition) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_vpcconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_vpcconfig.go new file mode 100644 index 000000000000..2142fe7423d5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-model_vpcconfig.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSageMakerModel_VpcConfig AWS CloudFormation Resource (AWS::SageMaker::Model.VpcConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html +type AWSSageMakerModel_VpcConfig struct { + + // SecurityGroupIds AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html#cfn-sagemaker-model-vpcconfig-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // Subnets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-model-vpcconfig.html#cfn-sagemaker-model-vpcconfig-subnets + Subnets []string `json:"Subnets,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerModel_VpcConfig) AWSCloudFormationType() string { + return "AWS::SageMaker::Model.VpcConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerModel_VpcConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstance.go new file mode 100644 index 000000000000..ac49c72166b8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstance.go @@ -0,0 +1,161 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSageMakerNotebookInstance AWS CloudFormation Resource (AWS::SageMaker::NotebookInstance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html +type AWSSageMakerNotebookInstance struct { + + // DirectInternetAccess AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-directinternetaccess + DirectInternetAccess string `json:"DirectInternetAccess,omitempty"` + + // InstanceType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-instancetype + InstanceType string `json:"InstanceType,omitempty"` + + // KmsKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-kmskeyid + KmsKeyId string `json:"KmsKeyId,omitempty"` + + // LifecycleConfigName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-lifecycleconfigname + LifecycleConfigName string `json:"LifecycleConfigName,omitempty"` + + // NotebookInstanceName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-notebookinstancename + NotebookInstanceName string `json:"NotebookInstanceName,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // SecurityGroupIds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-securitygroupids + SecurityGroupIds []string `json:"SecurityGroupIds,omitempty"` + + // SubnetId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-subnetid + SubnetId string `json:"SubnetId,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstance.html#cfn-sagemaker-notebookinstance-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerNotebookInstance) AWSCloudFormationType() string { + return "AWS::SageMaker::NotebookInstance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerNotebookInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSageMakerNotebookInstance) MarshalJSON() ([]byte, error) { + type Properties AWSSageMakerNotebookInstance + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSageMakerNotebookInstance) UnmarshalJSON(b []byte) error { + type Properties AWSSageMakerNotebookInstance + 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 = AWSSageMakerNotebookInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSSageMakerNotebookInstanceResources retrieves all AWSSageMakerNotebookInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSSageMakerNotebookInstanceResources() map[string]AWSSageMakerNotebookInstance { + results := map[string]AWSSageMakerNotebookInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSageMakerNotebookInstance: + // 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::SageMaker::NotebookInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerNotebookInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSageMakerNotebookInstanceWithName retrieves all AWSSageMakerNotebookInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSageMakerNotebookInstanceWithName(name string) (AWSSageMakerNotebookInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSageMakerNotebookInstance: + // 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::SageMaker::NotebookInstance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerNotebookInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSageMakerNotebookInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig.go new file mode 100644 index 000000000000..9dc43c384f3f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSageMakerNotebookInstanceLifecycleConfig AWS CloudFormation Resource (AWS::SageMaker::NotebookInstanceLifecycleConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstancelifecycleconfig.html +type AWSSageMakerNotebookInstanceLifecycleConfig struct { + + // NotebookInstanceLifecycleConfigName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstancelifecycleconfig.html#cfn-sagemaker-notebookinstancelifecycleconfig-notebookinstancelifecycleconfigname + NotebookInstanceLifecycleConfigName string `json:"NotebookInstanceLifecycleConfigName,omitempty"` + + // OnCreate AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstancelifecycleconfig.html#cfn-sagemaker-notebookinstancelifecycleconfig-oncreate + OnCreate []AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook `json:"OnCreate,omitempty"` + + // OnStart AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-notebookinstancelifecycleconfig.html#cfn-sagemaker-notebookinstancelifecycleconfig-onstart + OnStart []AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook `json:"OnStart,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerNotebookInstanceLifecycleConfig) AWSCloudFormationType() string { + return "AWS::SageMaker::NotebookInstanceLifecycleConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerNotebookInstanceLifecycleConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSageMakerNotebookInstanceLifecycleConfig) MarshalJSON() ([]byte, error) { + type Properties AWSSageMakerNotebookInstanceLifecycleConfig + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSageMakerNotebookInstanceLifecycleConfig) UnmarshalJSON(b []byte) error { + type Properties AWSSageMakerNotebookInstanceLifecycleConfig + 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 = AWSSageMakerNotebookInstanceLifecycleConfig(*res.Properties) + } + + return nil +} + +// GetAllAWSSageMakerNotebookInstanceLifecycleConfigResources retrieves all AWSSageMakerNotebookInstanceLifecycleConfig items from an AWS CloudFormation template +func (t *Template) GetAllAWSSageMakerNotebookInstanceLifecycleConfigResources() map[string]AWSSageMakerNotebookInstanceLifecycleConfig { + results := map[string]AWSSageMakerNotebookInstanceLifecycleConfig{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSageMakerNotebookInstanceLifecycleConfig: + // 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::SageMaker::NotebookInstanceLifecycleConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerNotebookInstanceLifecycleConfig + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSageMakerNotebookInstanceLifecycleConfigWithName retrieves all AWSSageMakerNotebookInstanceLifecycleConfig items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSageMakerNotebookInstanceLifecycleConfigWithName(name string) (AWSSageMakerNotebookInstanceLifecycleConfig, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSageMakerNotebookInstanceLifecycleConfig: + // 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::SageMaker::NotebookInstanceLifecycleConfig" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSageMakerNotebookInstanceLifecycleConfig + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSageMakerNotebookInstanceLifecycleConfig{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig_notebookinstancelifecyclehook.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig_notebookinstancelifecyclehook.go new file mode 100644 index 000000000000..c9d9a8d7f7b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sagemaker-notebookinstancelifecycleconfig_notebookinstancelifecyclehook.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook AWS CloudFormation Resource (AWS::SageMaker::NotebookInstanceLifecycleConfig.NotebookInstanceLifecycleHook) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-notebookinstancelifecycleconfig-notebookinstancelifecyclehook.html +type AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook struct { + + // Content AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sagemaker-notebookinstancelifecycleconfig-notebookinstancelifecyclehook.html#cfn-sagemaker-notebookinstancelifecycleconfig-notebookinstancelifecyclehook-content + Content string `json:"Content,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook) AWSCloudFormationType() string { + return "AWS::SageMaker::NotebookInstanceLifecycleConfig.NotebookInstanceLifecycleHook" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSageMakerNotebookInstanceLifecycleConfig_NotebookInstanceLifecycleHook) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..abfbecab0071 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sdb-domain.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSDBDomain) AWSCloudFormationType() string { + return "AWS::SDB::Domain" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSDBDomain) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..88c69a180c76 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api.go @@ -0,0 +1,156 @@ +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_DefinitionUri `json:"DefinitionUri,omitempty"` + + // MethodSettings AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi + MethodSettings interface{} `json:"MethodSettings,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessApi) AWSCloudFormationType() string { + return "AWS::Serverless::Api" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessApi) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..44b202727897 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-api_s3location.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessApi_S3Location) AWSCloudFormationType() string { + return "AWS::Serverless::Api.S3Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessApi_S3Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..07cc17f6aa93 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function.go @@ -0,0 +1,196 @@ +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_CodeUri `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_Policies `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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction) AWSCloudFormationType() string { + return "AWS::Serverless::Function" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..08fe247bc088 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_alexaskillevent.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_AlexaSkillEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.AlexaSkillEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_AlexaSkillEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a06dcb9ef6bf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_apievent.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_ApiEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.ApiEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_ApiEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..fbb00b5f958f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_cloudwatcheventevent.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_CloudWatchEventEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.CloudWatchEventEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_CloudWatchEventEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..400eb1428fa0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_deadletterqueue.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_DeadLetterQueue) AWSCloudFormationType() string { + return "AWS::Serverless::Function.DeadLetterQueue" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_DeadLetterQueue) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..da0dc39103bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_dynamodbevent.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_DynamoDBEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.DynamoDBEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_DynamoDBEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0d38286c211f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_eventsource.go @@ -0,0 +1,30 @@ +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_Properties `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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_EventSource) AWSCloudFormationType() string { + return "AWS::Serverless::Function.EventSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_EventSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..cb6f35a25559 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_functionenvironment.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_FunctionEnvironment) AWSCloudFormationType() string { + return "AWS::Serverless::Function.FunctionEnvironment" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_FunctionEnvironment) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c10bc6dd3c5a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iampolicydocument.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_IAMPolicyDocument) AWSCloudFormationType() string { + return "AWS::Serverless::Function.IAMPolicyDocument" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_IAMPolicyDocument) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f18c53a8189b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_iotruleevent.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_IoTRuleEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.IoTRuleEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_IoTRuleEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bc5766a337f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_kinesisevent.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_KinesisEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.KinesisEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_KinesisEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..9e5ea3f12564 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3event.go @@ -0,0 +1,35 @@ +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_Events `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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3Event) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3Event" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_S3Event) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0901e42ebee4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3location.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3Location) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3Location" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_S3Location) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..139dc03da207 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_s3notificationfilter.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_S3NotificationFilter) AWSCloudFormationType() string { + return "AWS::Serverless::Function.S3NotificationFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_S3NotificationFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ddf5e22bba0d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_scheduleevent.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_ScheduleEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.ScheduleEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_ScheduleEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a7e94546be6b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_snsevent.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_SNSEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.SNSEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_SNSEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_sqsevent.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_sqsevent.go new file mode 100644 index 000000000000..7dfc9dd42fd6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_sqsevent.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSServerlessFunction_SQSEvent AWS CloudFormation Resource (AWS::Serverless::Function.SQSEvent) +// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sqs +type AWSServerlessFunction_SQSEvent struct { + + // BatchSize AWS CloudFormation Property + // Required: false + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sqs + BatchSize int `json:"BatchSize,omitempty"` + + // Queue AWS CloudFormation Property + // Required: true + // See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#sqs + Queue string `json:"Queue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_SQSEvent) AWSCloudFormationType() string { + return "AWS::Serverless::Function.SQSEvent" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_SQSEvent) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..812a8ac9ac42 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-function_vpcconfig.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessFunction_VpcConfig) AWSCloudFormationType() string { + return "AWS::Serverless::Function.VpcConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessFunction_VpcConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..86862a73d0e4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessSimpleTable) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1ae07ebfcbd1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_primarykey.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable_PrimaryKey) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable.PrimaryKey" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessSimpleTable_PrimaryKey) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c40e4ca243e3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-serverless-simpletable_provisionedthroughput.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServerlessSimpleTable_ProvisionedThroughput) AWSCloudFormationType() string { + return "AWS::Serverless::SimpleTable.ProvisionedThroughput" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServerlessSimpleTable_ProvisionedThroughput) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-acceptedportfolioshare.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-acceptedportfolioshare.go new file mode 100644 index 000000000000..31713db1af85 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-acceptedportfolioshare.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogAcceptedPortfolioShare AWS CloudFormation Resource (AWS::ServiceCatalog::AcceptedPortfolioShare) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-acceptedportfolioshare.html +type AWSServiceCatalogAcceptedPortfolioShare struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-acceptedportfolioshare.html#cfn-servicecatalog-acceptedportfolioshare-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-acceptedportfolioshare.html#cfn-servicecatalog-acceptedportfolioshare-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogAcceptedPortfolioShare) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::AcceptedPortfolioShare" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogAcceptedPortfolioShare) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogAcceptedPortfolioShare) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogAcceptedPortfolioShare + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogAcceptedPortfolioShare) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogAcceptedPortfolioShare + 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 = AWSServiceCatalogAcceptedPortfolioShare(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogAcceptedPortfolioShareResources retrieves all AWSServiceCatalogAcceptedPortfolioShare items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogAcceptedPortfolioShareResources() map[string]AWSServiceCatalogAcceptedPortfolioShare { + results := map[string]AWSServiceCatalogAcceptedPortfolioShare{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogAcceptedPortfolioShare: + // 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::ServiceCatalog::AcceptedPortfolioShare" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogAcceptedPortfolioShare + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogAcceptedPortfolioShareWithName retrieves all AWSServiceCatalogAcceptedPortfolioShare items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogAcceptedPortfolioShareWithName(name string) (AWSServiceCatalogAcceptedPortfolioShare, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogAcceptedPortfolioShare: + // 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::ServiceCatalog::AcceptedPortfolioShare" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogAcceptedPortfolioShare + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogAcceptedPortfolioShare{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct.go new file mode 100644 index 000000000000..2dfdd82a9bc9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct.go @@ -0,0 +1,166 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogCloudFormationProduct AWS CloudFormation Resource (AWS::ServiceCatalog::CloudFormationProduct) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html +type AWSServiceCatalogCloudFormationProduct struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-description + Description string `json:"Description,omitempty"` + + // Distributor AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-distributor + Distributor string `json:"Distributor,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-name + Name string `json:"Name,omitempty"` + + // Owner AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-owner + Owner string `json:"Owner,omitempty"` + + // ProvisioningArtifactParameters AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-provisioningartifactparameters + ProvisioningArtifactParameters []AWSServiceCatalogCloudFormationProduct_ProvisioningArtifactProperties `json:"ProvisioningArtifactParameters,omitempty"` + + // SupportDescription AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-supportdescription + SupportDescription string `json:"SupportDescription,omitempty"` + + // SupportEmail AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-supportemail + SupportEmail string `json:"SupportEmail,omitempty"` + + // SupportUrl AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-supporturl + SupportUrl string `json:"SupportUrl,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationproduct.html#cfn-servicecatalog-cloudformationproduct-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogCloudFormationProduct) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::CloudFormationProduct" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogCloudFormationProduct) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogCloudFormationProduct) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogCloudFormationProduct + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogCloudFormationProduct) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogCloudFormationProduct + 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 = AWSServiceCatalogCloudFormationProduct(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogCloudFormationProductResources retrieves all AWSServiceCatalogCloudFormationProduct items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogCloudFormationProductResources() map[string]AWSServiceCatalogCloudFormationProduct { + results := map[string]AWSServiceCatalogCloudFormationProduct{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogCloudFormationProduct: + // 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::ServiceCatalog::CloudFormationProduct" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogCloudFormationProduct + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogCloudFormationProductWithName retrieves all AWSServiceCatalogCloudFormationProduct items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogCloudFormationProductWithName(name string) (AWSServiceCatalogCloudFormationProduct, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogCloudFormationProduct: + // 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::ServiceCatalog::CloudFormationProduct" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogCloudFormationProduct + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogCloudFormationProduct{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct_provisioningartifactproperties.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct_provisioningartifactproperties.go new file mode 100644 index 000000000000..fb968423e09a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationproduct_provisioningartifactproperties.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSServiceCatalogCloudFormationProduct_ProvisioningArtifactProperties AWS CloudFormation Resource (AWS::ServiceCatalog::CloudFormationProduct.ProvisioningArtifactProperties) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationproduct-provisioningartifactproperties.html +type AWSServiceCatalogCloudFormationProduct_ProvisioningArtifactProperties struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationproduct-provisioningartifactproperties.html#cfn-servicecatalog-cloudformationproduct-provisioningartifactproperties-description + Description string `json:"Description,omitempty"` + + // Info AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationproduct-provisioningartifactproperties.html#cfn-servicecatalog-cloudformationproduct-provisioningartifactproperties-info + Info interface{} `json:"Info,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationproduct-provisioningartifactproperties.html#cfn-servicecatalog-cloudformationproduct-provisioningartifactproperties-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogCloudFormationProduct_ProvisioningArtifactProperties) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::CloudFormationProduct.ProvisioningArtifactProperties" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogCloudFormationProduct_ProvisioningArtifactProperties) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct.go new file mode 100644 index 000000000000..5a553790d88c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct.go @@ -0,0 +1,166 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogCloudFormationProvisionedProduct AWS CloudFormation Resource (AWS::ServiceCatalog::CloudFormationProvisionedProduct) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html +type AWSServiceCatalogCloudFormationProvisionedProduct struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // NotificationArns AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-notificationarns + NotificationArns []string `json:"NotificationArns,omitempty"` + + // PathId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-pathid + PathId string `json:"PathId,omitempty"` + + // ProductId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-productid + ProductId string `json:"ProductId,omitempty"` + + // ProductName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-productname + ProductName string `json:"ProductName,omitempty"` + + // ProvisionedProductName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisionedproductname + ProvisionedProductName string `json:"ProvisionedProductName,omitempty"` + + // ProvisioningArtifactId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisioningartifactid + ProvisioningArtifactId string `json:"ProvisioningArtifactId,omitempty"` + + // ProvisioningArtifactName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisioningartifactname + ProvisioningArtifactName string `json:"ProvisioningArtifactName,omitempty"` + + // ProvisioningParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisioningparameters + ProvisioningParameters []AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningParameter `json:"ProvisioningParameters,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-cloudformationprovisionedproduct.html#cfn-servicecatalog-cloudformationprovisionedproduct-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogCloudFormationProvisionedProduct) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::CloudFormationProvisionedProduct" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogCloudFormationProvisionedProduct) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogCloudFormationProvisionedProduct) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogCloudFormationProvisionedProduct + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogCloudFormationProvisionedProduct) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogCloudFormationProvisionedProduct + 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 = AWSServiceCatalogCloudFormationProvisionedProduct(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogCloudFormationProvisionedProductResources retrieves all AWSServiceCatalogCloudFormationProvisionedProduct items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogCloudFormationProvisionedProductResources() map[string]AWSServiceCatalogCloudFormationProvisionedProduct { + results := map[string]AWSServiceCatalogCloudFormationProvisionedProduct{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogCloudFormationProvisionedProduct: + // 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::ServiceCatalog::CloudFormationProvisionedProduct" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogCloudFormationProvisionedProduct + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogCloudFormationProvisionedProductWithName retrieves all AWSServiceCatalogCloudFormationProvisionedProduct items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogCloudFormationProvisionedProductWithName(name string) (AWSServiceCatalogCloudFormationProvisionedProduct, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogCloudFormationProvisionedProduct: + // 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::ServiceCatalog::CloudFormationProvisionedProduct" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogCloudFormationProvisionedProduct + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogCloudFormationProvisionedProduct{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct_provisioningparameter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct_provisioningparameter.go new file mode 100644 index 000000000000..dd6895f0b4f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-cloudformationprovisionedproduct_provisioningparameter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningParameter AWS CloudFormation Resource (AWS::ServiceCatalog::CloudFormationProvisionedProduct.ProvisioningParameter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationprovisionedproduct-provisioningparameter.html +type AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningParameter struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationprovisionedproduct-provisioningparameter.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisioningparameter-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicecatalog-cloudformationprovisionedproduct-provisioningparameter.html#cfn-servicecatalog-cloudformationprovisionedproduct-provisioningparameter-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningParameter) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::CloudFormationProvisionedProduct.ProvisioningParameter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogCloudFormationProvisionedProduct_ProvisioningParameter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchnotificationconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchnotificationconstraint.go new file mode 100644 index 000000000000..c0e80fa83bb0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchnotificationconstraint.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogLaunchNotificationConstraint AWS CloudFormation Resource (AWS::ServiceCatalog::LaunchNotificationConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html +type AWSServiceCatalogLaunchNotificationConstraint struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html#cfn-servicecatalog-launchnotificationconstraint-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html#cfn-servicecatalog-launchnotificationconstraint-description + Description string `json:"Description,omitempty"` + + // NotificationArns AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html#cfn-servicecatalog-launchnotificationconstraint-notificationarns + NotificationArns []string `json:"NotificationArns,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html#cfn-servicecatalog-launchnotificationconstraint-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // ProductId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchnotificationconstraint.html#cfn-servicecatalog-launchnotificationconstraint-productid + ProductId string `json:"ProductId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogLaunchNotificationConstraint) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::LaunchNotificationConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogLaunchNotificationConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogLaunchNotificationConstraint) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogLaunchNotificationConstraint + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogLaunchNotificationConstraint) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogLaunchNotificationConstraint + 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 = AWSServiceCatalogLaunchNotificationConstraint(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogLaunchNotificationConstraintResources retrieves all AWSServiceCatalogLaunchNotificationConstraint items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogLaunchNotificationConstraintResources() map[string]AWSServiceCatalogLaunchNotificationConstraint { + results := map[string]AWSServiceCatalogLaunchNotificationConstraint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchNotificationConstraint: + // 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::ServiceCatalog::LaunchNotificationConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchNotificationConstraint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogLaunchNotificationConstraintWithName retrieves all AWSServiceCatalogLaunchNotificationConstraint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogLaunchNotificationConstraintWithName(name string) (AWSServiceCatalogLaunchNotificationConstraint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchNotificationConstraint: + // 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::ServiceCatalog::LaunchNotificationConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchNotificationConstraint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogLaunchNotificationConstraint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchroleconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchroleconstraint.go new file mode 100644 index 000000000000..6700323a427c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchroleconstraint.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogLaunchRoleConstraint AWS CloudFormation Resource (AWS::ServiceCatalog::LaunchRoleConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html +type AWSServiceCatalogLaunchRoleConstraint struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html#cfn-servicecatalog-launchroleconstraint-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html#cfn-servicecatalog-launchroleconstraint-description + Description string `json:"Description,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html#cfn-servicecatalog-launchroleconstraint-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // ProductId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html#cfn-servicecatalog-launchroleconstraint-productid + ProductId string `json:"ProductId,omitempty"` + + // RoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchroleconstraint.html#cfn-servicecatalog-launchroleconstraint-rolearn + RoleArn string `json:"RoleArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogLaunchRoleConstraint) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::LaunchRoleConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogLaunchRoleConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogLaunchRoleConstraint) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogLaunchRoleConstraint + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogLaunchRoleConstraint) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogLaunchRoleConstraint + 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 = AWSServiceCatalogLaunchRoleConstraint(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogLaunchRoleConstraintResources retrieves all AWSServiceCatalogLaunchRoleConstraint items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogLaunchRoleConstraintResources() map[string]AWSServiceCatalogLaunchRoleConstraint { + results := map[string]AWSServiceCatalogLaunchRoleConstraint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchRoleConstraint: + // 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::ServiceCatalog::LaunchRoleConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchRoleConstraint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogLaunchRoleConstraintWithName retrieves all AWSServiceCatalogLaunchRoleConstraint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogLaunchRoleConstraintWithName(name string) (AWSServiceCatalogLaunchRoleConstraint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchRoleConstraint: + // 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::ServiceCatalog::LaunchRoleConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchRoleConstraint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogLaunchRoleConstraint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchtemplateconstraint.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchtemplateconstraint.go new file mode 100644 index 000000000000..b0ce50348a3a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-launchtemplateconstraint.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogLaunchTemplateConstraint AWS CloudFormation Resource (AWS::ServiceCatalog::LaunchTemplateConstraint) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html +type AWSServiceCatalogLaunchTemplateConstraint struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-description + Description string `json:"Description,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // ProductId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-productid + ProductId string `json:"ProductId,omitempty"` + + // Rules AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-rules + Rules string `json:"Rules,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogLaunchTemplateConstraint) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::LaunchTemplateConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogLaunchTemplateConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogLaunchTemplateConstraint) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogLaunchTemplateConstraint + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogLaunchTemplateConstraint) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogLaunchTemplateConstraint + 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 = AWSServiceCatalogLaunchTemplateConstraint(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogLaunchTemplateConstraintResources retrieves all AWSServiceCatalogLaunchTemplateConstraint items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogLaunchTemplateConstraintResources() map[string]AWSServiceCatalogLaunchTemplateConstraint { + results := map[string]AWSServiceCatalogLaunchTemplateConstraint{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchTemplateConstraint: + // 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::ServiceCatalog::LaunchTemplateConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchTemplateConstraint + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogLaunchTemplateConstraintWithName retrieves all AWSServiceCatalogLaunchTemplateConstraint items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogLaunchTemplateConstraintWithName(name string) (AWSServiceCatalogLaunchTemplateConstraint, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogLaunchTemplateConstraint: + // 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::ServiceCatalog::LaunchTemplateConstraint" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogLaunchTemplateConstraint + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogLaunchTemplateConstraint{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolio.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolio.go new file mode 100644 index 000000000000..e8459188bb6e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolio.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogPortfolio AWS CloudFormation Resource (AWS::ServiceCatalog::Portfolio) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html +type AWSServiceCatalogPortfolio struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html#cfn-servicecatalog-portfolio-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html#cfn-servicecatalog-portfolio-description + Description string `json:"Description,omitempty"` + + // DisplayName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html#cfn-servicecatalog-portfolio-displayname + DisplayName string `json:"DisplayName,omitempty"` + + // ProviderName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html#cfn-servicecatalog-portfolio-providername + ProviderName string `json:"ProviderName,omitempty"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolio.html#cfn-servicecatalog-portfolio-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogPortfolio) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::Portfolio" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogPortfolio) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogPortfolio) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogPortfolio + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogPortfolio) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogPortfolio + 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 = AWSServiceCatalogPortfolio(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogPortfolioResources retrieves all AWSServiceCatalogPortfolio items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogPortfolioResources() map[string]AWSServiceCatalogPortfolio { + results := map[string]AWSServiceCatalogPortfolio{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolio: + // 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::ServiceCatalog::Portfolio" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolio + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogPortfolioWithName retrieves all AWSServiceCatalogPortfolio items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogPortfolioWithName(name string) (AWSServiceCatalogPortfolio, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolio: + // 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::ServiceCatalog::Portfolio" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolio + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogPortfolio{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioprincipalassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioprincipalassociation.go new file mode 100644 index 000000000000..2ae50e513ab8 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioprincipalassociation.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogPortfolioPrincipalAssociation AWS CloudFormation Resource (AWS::ServiceCatalog::PortfolioPrincipalAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioprincipalassociation.html +type AWSServiceCatalogPortfolioPrincipalAssociation struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioprincipalassociation.html#cfn-servicecatalog-portfolioprincipalassociation-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioprincipalassociation.html#cfn-servicecatalog-portfolioprincipalassociation-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // PrincipalARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioprincipalassociation.html#cfn-servicecatalog-portfolioprincipalassociation-principalarn + PrincipalARN string `json:"PrincipalARN,omitempty"` + + // PrincipalType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioprincipalassociation.html#cfn-servicecatalog-portfolioprincipalassociation-principaltype + PrincipalType string `json:"PrincipalType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogPortfolioPrincipalAssociation) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::PortfolioPrincipalAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogPortfolioPrincipalAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogPortfolioPrincipalAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogPortfolioPrincipalAssociation + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogPortfolioPrincipalAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogPortfolioPrincipalAssociation + 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 = AWSServiceCatalogPortfolioPrincipalAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogPortfolioPrincipalAssociationResources retrieves all AWSServiceCatalogPortfolioPrincipalAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogPortfolioPrincipalAssociationResources() map[string]AWSServiceCatalogPortfolioPrincipalAssociation { + results := map[string]AWSServiceCatalogPortfolioPrincipalAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioPrincipalAssociation: + // 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::ServiceCatalog::PortfolioPrincipalAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioPrincipalAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogPortfolioPrincipalAssociationWithName retrieves all AWSServiceCatalogPortfolioPrincipalAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogPortfolioPrincipalAssociationWithName(name string) (AWSServiceCatalogPortfolioPrincipalAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioPrincipalAssociation: + // 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::ServiceCatalog::PortfolioPrincipalAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioPrincipalAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogPortfolioPrincipalAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioproductassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioproductassociation.go new file mode 100644 index 000000000000..729507211d1f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioproductassociation.go @@ -0,0 +1,136 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogPortfolioProductAssociation AWS CloudFormation Resource (AWS::ServiceCatalog::PortfolioProductAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioproductassociation.html +type AWSServiceCatalogPortfolioProductAssociation struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioproductassociation.html#cfn-servicecatalog-portfolioproductassociation-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioproductassociation.html#cfn-servicecatalog-portfolioproductassociation-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // ProductId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioproductassociation.html#cfn-servicecatalog-portfolioproductassociation-productid + ProductId string `json:"ProductId,omitempty"` + + // SourcePortfolioId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioproductassociation.html#cfn-servicecatalog-portfolioproductassociation-sourceportfolioid + SourcePortfolioId string `json:"SourcePortfolioId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogPortfolioProductAssociation) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::PortfolioProductAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogPortfolioProductAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogPortfolioProductAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogPortfolioProductAssociation + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogPortfolioProductAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogPortfolioProductAssociation + 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 = AWSServiceCatalogPortfolioProductAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogPortfolioProductAssociationResources retrieves all AWSServiceCatalogPortfolioProductAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogPortfolioProductAssociationResources() map[string]AWSServiceCatalogPortfolioProductAssociation { + results := map[string]AWSServiceCatalogPortfolioProductAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioProductAssociation: + // 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::ServiceCatalog::PortfolioProductAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioProductAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogPortfolioProductAssociationWithName retrieves all AWSServiceCatalogPortfolioProductAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogPortfolioProductAssociationWithName(name string) (AWSServiceCatalogPortfolioProductAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioProductAssociation: + // 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::ServiceCatalog::PortfolioProductAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioProductAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogPortfolioProductAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioshare.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioshare.go new file mode 100644 index 000000000000..8349e3a550f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-portfolioshare.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogPortfolioShare AWS CloudFormation Resource (AWS::ServiceCatalog::PortfolioShare) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioshare.html +type AWSServiceCatalogPortfolioShare struct { + + // AcceptLanguage AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioshare.html#cfn-servicecatalog-portfolioshare-acceptlanguage + AcceptLanguage string `json:"AcceptLanguage,omitempty"` + + // AccountId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioshare.html#cfn-servicecatalog-portfolioshare-accountid + AccountId string `json:"AccountId,omitempty"` + + // PortfolioId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-portfolioshare.html#cfn-servicecatalog-portfolioshare-portfolioid + PortfolioId string `json:"PortfolioId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogPortfolioShare) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::PortfolioShare" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogPortfolioShare) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogPortfolioShare) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogPortfolioShare + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogPortfolioShare) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogPortfolioShare + 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 = AWSServiceCatalogPortfolioShare(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogPortfolioShareResources retrieves all AWSServiceCatalogPortfolioShare items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogPortfolioShareResources() map[string]AWSServiceCatalogPortfolioShare { + results := map[string]AWSServiceCatalogPortfolioShare{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioShare: + // 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::ServiceCatalog::PortfolioShare" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioShare + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogPortfolioShareWithName retrieves all AWSServiceCatalogPortfolioShare items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogPortfolioShareWithName(name string) (AWSServiceCatalogPortfolioShare, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogPortfolioShare: + // 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::ServiceCatalog::PortfolioShare" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogPortfolioShare + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogPortfolioShare{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoption.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoption.go new file mode 100644 index 000000000000..e270a89c4c6c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoption.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogTagOption AWS CloudFormation Resource (AWS::ServiceCatalog::TagOption) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoption.html +type AWSServiceCatalogTagOption struct { + + // Active AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoption.html#cfn-servicecatalog-tagoption-active + Active bool `json:"Active,omitempty"` + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoption.html#cfn-servicecatalog-tagoption-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoption.html#cfn-servicecatalog-tagoption-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogTagOption) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::TagOption" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogTagOption) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogTagOption) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogTagOption + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogTagOption) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogTagOption + 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 = AWSServiceCatalogTagOption(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogTagOptionResources retrieves all AWSServiceCatalogTagOption items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogTagOptionResources() map[string]AWSServiceCatalogTagOption { + results := map[string]AWSServiceCatalogTagOption{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogTagOption: + // 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::ServiceCatalog::TagOption" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogTagOption + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogTagOptionWithName retrieves all AWSServiceCatalogTagOption items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogTagOptionWithName(name string) (AWSServiceCatalogTagOption, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogTagOption: + // 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::ServiceCatalog::TagOption" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogTagOption + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogTagOption{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoptionassociation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoptionassociation.go new file mode 100644 index 000000000000..7b14a7940908 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicecatalog-tagoptionassociation.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceCatalogTagOptionAssociation AWS CloudFormation Resource (AWS::ServiceCatalog::TagOptionAssociation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoptionassociation.html +type AWSServiceCatalogTagOptionAssociation struct { + + // ResourceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoptionassociation.html#cfn-servicecatalog-tagoptionassociation-resourceid + ResourceId string `json:"ResourceId,omitempty"` + + // TagOptionId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-tagoptionassociation.html#cfn-servicecatalog-tagoptionassociation-tagoptionid + TagOptionId string `json:"TagOptionId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceCatalogTagOptionAssociation) AWSCloudFormationType() string { + return "AWS::ServiceCatalog::TagOptionAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceCatalogTagOptionAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceCatalogTagOptionAssociation) MarshalJSON() ([]byte, error) { + type Properties AWSServiceCatalogTagOptionAssociation + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceCatalogTagOptionAssociation) UnmarshalJSON(b []byte) error { + type Properties AWSServiceCatalogTagOptionAssociation + 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 = AWSServiceCatalogTagOptionAssociation(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceCatalogTagOptionAssociationResources retrieves all AWSServiceCatalogTagOptionAssociation items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceCatalogTagOptionAssociationResources() map[string]AWSServiceCatalogTagOptionAssociation { + results := map[string]AWSServiceCatalogTagOptionAssociation{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceCatalogTagOptionAssociation: + // 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::ServiceCatalog::TagOptionAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogTagOptionAssociation + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceCatalogTagOptionAssociationWithName retrieves all AWSServiceCatalogTagOptionAssociation items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceCatalogTagOptionAssociationWithName(name string) (AWSServiceCatalogTagOptionAssociation, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceCatalogTagOptionAssociation: + // 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::ServiceCatalog::TagOptionAssociation" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceCatalogTagOptionAssociation + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceCatalogTagOptionAssociation{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-instance.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-instance.go new file mode 100644 index 000000000000..cf94c1ca168c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-instance.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceDiscoveryInstance AWS CloudFormation Resource (AWS::ServiceDiscovery::Instance) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-instance.html +type AWSServiceDiscoveryInstance struct { + + // InstanceAttributes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-instance.html#cfn-servicediscovery-instance-instanceattributes + InstanceAttributes interface{} `json:"InstanceAttributes,omitempty"` + + // InstanceId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-instance.html#cfn-servicediscovery-instance-instanceid + InstanceId string `json:"InstanceId,omitempty"` + + // ServiceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-instance.html#cfn-servicediscovery-instance-serviceid + ServiceId string `json:"ServiceId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryInstance) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Instance" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryInstance) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceDiscoveryInstance) MarshalJSON() ([]byte, error) { + type Properties AWSServiceDiscoveryInstance + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceDiscoveryInstance) UnmarshalJSON(b []byte) error { + type Properties AWSServiceDiscoveryInstance + 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 = AWSServiceDiscoveryInstance(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceDiscoveryInstanceResources retrieves all AWSServiceDiscoveryInstance items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceDiscoveryInstanceResources() map[string]AWSServiceDiscoveryInstance { + results := map[string]AWSServiceDiscoveryInstance{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceDiscoveryInstance: + // 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::ServiceDiscovery::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryInstance + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceDiscoveryInstanceWithName retrieves all AWSServiceDiscoveryInstance items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceDiscoveryInstanceWithName(name string) (AWSServiceDiscoveryInstance, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceDiscoveryInstance: + // 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::ServiceDiscovery::Instance" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryInstance + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceDiscoveryInstance{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-privatednsnamespace.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-privatednsnamespace.go new file mode 100644 index 000000000000..b65a9170321b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-privatednsnamespace.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceDiscoveryPrivateDnsNamespace AWS CloudFormation Resource (AWS::ServiceDiscovery::PrivateDnsNamespace) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-privatednsnamespace.html +type AWSServiceDiscoveryPrivateDnsNamespace struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-privatednsnamespace.html#cfn-servicediscovery-privatednsnamespace-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-privatednsnamespace.html#cfn-servicediscovery-privatednsnamespace-name + Name string `json:"Name,omitempty"` + + // Vpc AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-privatednsnamespace.html#cfn-servicediscovery-privatednsnamespace-vpc + Vpc string `json:"Vpc,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryPrivateDnsNamespace) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::PrivateDnsNamespace" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryPrivateDnsNamespace) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceDiscoveryPrivateDnsNamespace) MarshalJSON() ([]byte, error) { + type Properties AWSServiceDiscoveryPrivateDnsNamespace + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceDiscoveryPrivateDnsNamespace) UnmarshalJSON(b []byte) error { + type Properties AWSServiceDiscoveryPrivateDnsNamespace + 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 = AWSServiceDiscoveryPrivateDnsNamespace(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceDiscoveryPrivateDnsNamespaceResources retrieves all AWSServiceDiscoveryPrivateDnsNamespace items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceDiscoveryPrivateDnsNamespaceResources() map[string]AWSServiceDiscoveryPrivateDnsNamespace { + results := map[string]AWSServiceDiscoveryPrivateDnsNamespace{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceDiscoveryPrivateDnsNamespace: + // 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::ServiceDiscovery::PrivateDnsNamespace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryPrivateDnsNamespace + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceDiscoveryPrivateDnsNamespaceWithName retrieves all AWSServiceDiscoveryPrivateDnsNamespace items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceDiscoveryPrivateDnsNamespaceWithName(name string) (AWSServiceDiscoveryPrivateDnsNamespace, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceDiscoveryPrivateDnsNamespace: + // 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::ServiceDiscovery::PrivateDnsNamespace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryPrivateDnsNamespace + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceDiscoveryPrivateDnsNamespace{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-publicdnsnamespace.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-publicdnsnamespace.go new file mode 100644 index 000000000000..63a243db5785 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-publicdnsnamespace.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceDiscoveryPublicDnsNamespace AWS CloudFormation Resource (AWS::ServiceDiscovery::PublicDnsNamespace) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-publicdnsnamespace.html +type AWSServiceDiscoveryPublicDnsNamespace struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-publicdnsnamespace.html#cfn-servicediscovery-publicdnsnamespace-description + Description string `json:"Description,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-publicdnsnamespace.html#cfn-servicediscovery-publicdnsnamespace-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryPublicDnsNamespace) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::PublicDnsNamespace" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryPublicDnsNamespace) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceDiscoveryPublicDnsNamespace) MarshalJSON() ([]byte, error) { + type Properties AWSServiceDiscoveryPublicDnsNamespace + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceDiscoveryPublicDnsNamespace) UnmarshalJSON(b []byte) error { + type Properties AWSServiceDiscoveryPublicDnsNamespace + 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 = AWSServiceDiscoveryPublicDnsNamespace(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceDiscoveryPublicDnsNamespaceResources retrieves all AWSServiceDiscoveryPublicDnsNamespace items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceDiscoveryPublicDnsNamespaceResources() map[string]AWSServiceDiscoveryPublicDnsNamespace { + results := map[string]AWSServiceDiscoveryPublicDnsNamespace{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceDiscoveryPublicDnsNamespace: + // 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::ServiceDiscovery::PublicDnsNamespace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryPublicDnsNamespace + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceDiscoveryPublicDnsNamespaceWithName retrieves all AWSServiceDiscoveryPublicDnsNamespace items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceDiscoveryPublicDnsNamespaceWithName(name string) (AWSServiceDiscoveryPublicDnsNamespace, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceDiscoveryPublicDnsNamespace: + // 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::ServiceDiscovery::PublicDnsNamespace" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryPublicDnsNamespace + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceDiscoveryPublicDnsNamespace{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service.go new file mode 100644 index 000000000000..bb460db5f90f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service.go @@ -0,0 +1,141 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSServiceDiscoveryService AWS CloudFormation Resource (AWS::ServiceDiscovery::Service) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html +type AWSServiceDiscoveryService struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#cfn-servicediscovery-service-description + Description string `json:"Description,omitempty"` + + // DnsConfig AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#cfn-servicediscovery-service-dnsconfig + DnsConfig *AWSServiceDiscoveryService_DnsConfig `json:"DnsConfig,omitempty"` + + // HealthCheckConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#cfn-servicediscovery-service-healthcheckconfig + HealthCheckConfig *AWSServiceDiscoveryService_HealthCheckConfig `json:"HealthCheckConfig,omitempty"` + + // HealthCheckCustomConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#cfn-servicediscovery-service-healthcheckcustomconfig + HealthCheckCustomConfig *AWSServiceDiscoveryService_HealthCheckCustomConfig `json:"HealthCheckCustomConfig,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#cfn-servicediscovery-service-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryService) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Service" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryService) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSServiceDiscoveryService) MarshalJSON() ([]byte, error) { + type Properties AWSServiceDiscoveryService + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSServiceDiscoveryService) UnmarshalJSON(b []byte) error { + type Properties AWSServiceDiscoveryService + 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 = AWSServiceDiscoveryService(*res.Properties) + } + + return nil +} + +// GetAllAWSServiceDiscoveryServiceResources retrieves all AWSServiceDiscoveryService items from an AWS CloudFormation template +func (t *Template) GetAllAWSServiceDiscoveryServiceResources() map[string]AWSServiceDiscoveryService { + results := map[string]AWSServiceDiscoveryService{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSServiceDiscoveryService: + // 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::ServiceDiscovery::Service" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryService + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSServiceDiscoveryServiceWithName retrieves all AWSServiceDiscoveryService items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSServiceDiscoveryServiceWithName(name string) (AWSServiceDiscoveryService, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSServiceDiscoveryService: + // 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::ServiceDiscovery::Service" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSServiceDiscoveryService + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSServiceDiscoveryService{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsconfig.go new file mode 100644 index 000000000000..b09635926528 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsconfig.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSServiceDiscoveryService_DnsConfig AWS CloudFormation Resource (AWS::ServiceDiscovery::Service.DnsConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsconfig.html +type AWSServiceDiscoveryService_DnsConfig struct { + + // DnsRecords AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsconfig.html#cfn-servicediscovery-service-dnsconfig-dnsrecords + DnsRecords []AWSServiceDiscoveryService_DnsRecord `json:"DnsRecords,omitempty"` + + // NamespaceId AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsconfig.html#cfn-servicediscovery-service-dnsconfig-namespaceid + NamespaceId string `json:"NamespaceId,omitempty"` + + // RoutingPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsconfig.html#cfn-servicediscovery-service-dnsconfig-routingpolicy + RoutingPolicy string `json:"RoutingPolicy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryService_DnsConfig) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Service.DnsConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryService_DnsConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsrecord.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsrecord.go new file mode 100644 index 000000000000..66b70c3777da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_dnsrecord.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSServiceDiscoveryService_DnsRecord AWS CloudFormation Resource (AWS::ServiceDiscovery::Service.DnsRecord) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsrecord.html +type AWSServiceDiscoveryService_DnsRecord struct { + + // TTL AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsrecord.html#cfn-servicediscovery-service-dnsrecord-ttl + TTL string `json:"TTL,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-dnsrecord.html#cfn-servicediscovery-service-dnsrecord-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryService_DnsRecord) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Service.DnsRecord" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryService_DnsRecord) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckconfig.go new file mode 100644 index 000000000000..9d2ba3a166f9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckconfig.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSServiceDiscoveryService_HealthCheckConfig AWS CloudFormation Resource (AWS::ServiceDiscovery::Service.HealthCheckConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckconfig.html +type AWSServiceDiscoveryService_HealthCheckConfig struct { + + // FailureThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckconfig.html#cfn-servicediscovery-service-healthcheckconfig-failurethreshold + FailureThreshold float64 `json:"FailureThreshold,omitempty"` + + // ResourcePath AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckconfig.html#cfn-servicediscovery-service-healthcheckconfig-resourcepath + ResourcePath string `json:"ResourcePath,omitempty"` + + // Type AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckconfig.html#cfn-servicediscovery-service-healthcheckconfig-type + Type string `json:"Type,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryService_HealthCheckConfig) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Service.HealthCheckConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryService_HealthCheckConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckcustomconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckcustomconfig.go new file mode 100644 index 000000000000..a5b85ba05640 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-servicediscovery-service_healthcheckcustomconfig.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSServiceDiscoveryService_HealthCheckCustomConfig AWS CloudFormation Resource (AWS::ServiceDiscovery::Service.HealthCheckCustomConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckcustomconfig.html +type AWSServiceDiscoveryService_HealthCheckCustomConfig struct { + + // FailureThreshold AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-servicediscovery-service-healthcheckcustomconfig.html#cfn-servicediscovery-service-healthcheckcustomconfig-failurethreshold + FailureThreshold float64 `json:"FailureThreshold,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSServiceDiscoveryService_HealthCheckCustomConfig) AWSCloudFormationType() string { + return "AWS::ServiceDiscovery::Service.HealthCheckCustomConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSServiceDiscoveryService_HealthCheckCustomConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationset.go new file mode 100644 index 000000000000..9aacaf2ba752 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationset.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESConfigurationSet AWS CloudFormation Resource (AWS::SES::ConfigurationSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-configurationset.html +type AWSSESConfigurationSet struct { + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-configurationset.html#cfn-ses-configurationset-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSet) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESConfigurationSet) MarshalJSON() ([]byte, error) { + type Properties AWSSESConfigurationSet + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESConfigurationSet) UnmarshalJSON(b []byte) error { + type Properties AWSSESConfigurationSet + 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 = AWSSESConfigurationSet(*res.Properties) + } + + return nil +} + +// GetAllAWSSESConfigurationSetResources retrieves all AWSSESConfigurationSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESConfigurationSetResources() map[string]AWSSESConfigurationSet { + results := map[string]AWSSESConfigurationSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESConfigurationSet: + // 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::SES::ConfigurationSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESConfigurationSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESConfigurationSetWithName retrieves all AWSSESConfigurationSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESConfigurationSetWithName(name string) (AWSSESConfigurationSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESConfigurationSet: + // 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::SES::ConfigurationSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESConfigurationSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESConfigurationSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination.go new file mode 100644 index 000000000000..da28f5e53837 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination.go @@ -0,0 +1,126 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESConfigurationSetEventDestination AWS CloudFormation Resource (AWS::SES::ConfigurationSetEventDestination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-configurationseteventdestination.html +type AWSSESConfigurationSetEventDestination struct { + + // ConfigurationSetName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-configurationseteventdestination.html#cfn-ses-configurationseteventdestination-configurationsetname + ConfigurationSetName string `json:"ConfigurationSetName,omitempty"` + + // EventDestination AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-configurationseteventdestination.html#cfn-ses-configurationseteventdestination-eventdestination + EventDestination *AWSSESConfigurationSetEventDestination_EventDestination `json:"EventDestination,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSetEventDestination) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSetEventDestination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSetEventDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESConfigurationSetEventDestination) MarshalJSON() ([]byte, error) { + type Properties AWSSESConfigurationSetEventDestination + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESConfigurationSetEventDestination) UnmarshalJSON(b []byte) error { + type Properties AWSSESConfigurationSetEventDestination + 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 = AWSSESConfigurationSetEventDestination(*res.Properties) + } + + return nil +} + +// GetAllAWSSESConfigurationSetEventDestinationResources retrieves all AWSSESConfigurationSetEventDestination items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESConfigurationSetEventDestinationResources() map[string]AWSSESConfigurationSetEventDestination { + results := map[string]AWSSESConfigurationSetEventDestination{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESConfigurationSetEventDestination: + // 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::SES::ConfigurationSetEventDestination" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESConfigurationSetEventDestination + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESConfigurationSetEventDestinationWithName retrieves all AWSSESConfigurationSetEventDestination items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESConfigurationSetEventDestinationWithName(name string) (AWSSESConfigurationSetEventDestination, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESConfigurationSetEventDestination: + // 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::SES::ConfigurationSetEventDestination" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESConfigurationSetEventDestination + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESConfigurationSetEventDestination{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_cloudwatchdestination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_cloudwatchdestination.go new file mode 100644 index 000000000000..cd09c009459c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_cloudwatchdestination.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSSESConfigurationSetEventDestination_CloudWatchDestination AWS CloudFormation Resource (AWS::SES::ConfigurationSetEventDestination.CloudWatchDestination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-cloudwatchdestination.html +type AWSSESConfigurationSetEventDestination_CloudWatchDestination struct { + + // DimensionConfigurations AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-cloudwatchdestination.html#cfn-ses-configurationseteventdestination-cloudwatchdestination-dimensionconfigurations + DimensionConfigurations []AWSSESConfigurationSetEventDestination_DimensionConfiguration `json:"DimensionConfigurations,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSetEventDestination_CloudWatchDestination) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSetEventDestination.CloudWatchDestination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSetEventDestination_CloudWatchDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_dimensionconfiguration.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_dimensionconfiguration.go new file mode 100644 index 000000000000..e7615864e4ef --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_dimensionconfiguration.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSESConfigurationSetEventDestination_DimensionConfiguration AWS CloudFormation Resource (AWS::SES::ConfigurationSetEventDestination.DimensionConfiguration) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-dimensionconfiguration.html +type AWSSESConfigurationSetEventDestination_DimensionConfiguration struct { + + // DefaultDimensionValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-dimensionconfiguration.html#cfn-ses-configurationseteventdestination-dimensionconfiguration-defaultdimensionvalue + DefaultDimensionValue string `json:"DefaultDimensionValue,omitempty"` + + // DimensionName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-dimensionconfiguration.html#cfn-ses-configurationseteventdestination-dimensionconfiguration-dimensionname + DimensionName string `json:"DimensionName,omitempty"` + + // DimensionValueSource AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-dimensionconfiguration.html#cfn-ses-configurationseteventdestination-dimensionconfiguration-dimensionvaluesource + DimensionValueSource string `json:"DimensionValueSource,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSetEventDestination_DimensionConfiguration) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSetEventDestination.DimensionConfiguration" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSetEventDestination_DimensionConfiguration) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_eventdestination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_eventdestination.go new file mode 100644 index 000000000000..47db81e87a64 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_eventdestination.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSSESConfigurationSetEventDestination_EventDestination AWS CloudFormation Resource (AWS::SES::ConfigurationSetEventDestination.EventDestination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html +type AWSSESConfigurationSetEventDestination_EventDestination struct { + + // CloudWatchDestination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html#cfn-ses-configurationseteventdestination-eventdestination-cloudwatchdestination + CloudWatchDestination *AWSSESConfigurationSetEventDestination_CloudWatchDestination `json:"CloudWatchDestination,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html#cfn-ses-configurationseteventdestination-eventdestination-enabled + Enabled bool `json:"Enabled,omitempty"` + + // KinesisFirehoseDestination AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html#cfn-ses-configurationseteventdestination-eventdestination-kinesisfirehosedestination + KinesisFirehoseDestination *AWSSESConfigurationSetEventDestination_KinesisFirehoseDestination `json:"KinesisFirehoseDestination,omitempty"` + + // MatchingEventTypes AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html#cfn-ses-configurationseteventdestination-eventdestination-matchingeventtypes + MatchingEventTypes []string `json:"MatchingEventTypes,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-eventdestination.html#cfn-ses-configurationseteventdestination-eventdestination-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSetEventDestination_EventDestination) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSetEventDestination.EventDestination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSetEventDestination_EventDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_kinesisfirehosedestination.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_kinesisfirehosedestination.go new file mode 100644 index 000000000000..677688562f04 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-configurationseteventdestination_kinesisfirehosedestination.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESConfigurationSetEventDestination_KinesisFirehoseDestination AWS CloudFormation Resource (AWS::SES::ConfigurationSetEventDestination.KinesisFirehoseDestination) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-kinesisfirehosedestination.html +type AWSSESConfigurationSetEventDestination_KinesisFirehoseDestination struct { + + // DeliveryStreamARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-kinesisfirehosedestination.html#cfn-ses-configurationseteventdestination-kinesisfirehosedestination-deliverystreamarn + DeliveryStreamARN string `json:"DeliveryStreamARN,omitempty"` + + // IAMRoleARN AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-configurationseteventdestination-kinesisfirehosedestination.html#cfn-ses-configurationseteventdestination-kinesisfirehosedestination-iamrolearn + IAMRoleARN string `json:"IAMRoleARN,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESConfigurationSetEventDestination_KinesisFirehoseDestination) AWSCloudFormationType() string { + return "AWS::SES::ConfigurationSetEventDestination.KinesisFirehoseDestination" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESConfigurationSetEventDestination_KinesisFirehoseDestination) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter.go new file mode 100644 index 000000000000..42f5c8db3fec --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESReceiptFilter AWS CloudFormation Resource (AWS::SES::ReceiptFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptfilter.html +type AWSSESReceiptFilter struct { + + // Filter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptfilter.html#cfn-ses-receiptfilter-filter + Filter *AWSSESReceiptFilter_Filter `json:"Filter,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptFilter) AWSCloudFormationType() string { + return "AWS::SES::ReceiptFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESReceiptFilter) MarshalJSON() ([]byte, error) { + type Properties AWSSESReceiptFilter + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESReceiptFilter) UnmarshalJSON(b []byte) error { + type Properties AWSSESReceiptFilter + 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 = AWSSESReceiptFilter(*res.Properties) + } + + return nil +} + +// GetAllAWSSESReceiptFilterResources retrieves all AWSSESReceiptFilter items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESReceiptFilterResources() map[string]AWSSESReceiptFilter { + results := map[string]AWSSESReceiptFilter{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESReceiptFilter: + // 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::SES::ReceiptFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptFilter + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESReceiptFilterWithName retrieves all AWSSESReceiptFilter items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESReceiptFilterWithName(name string) (AWSSESReceiptFilter, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESReceiptFilter: + // 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::SES::ReceiptFilter" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptFilter + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESReceiptFilter{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_filter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_filter.go new file mode 100644 index 000000000000..6e730ac3f684 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_filter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptFilter_Filter AWS CloudFormation Resource (AWS::SES::ReceiptFilter.Filter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-filter.html +type AWSSESReceiptFilter_Filter struct { + + // IpFilter AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-filter.html#cfn-ses-receiptfilter-filter-ipfilter + IpFilter *AWSSESReceiptFilter_IpFilter `json:"IpFilter,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-filter.html#cfn-ses-receiptfilter-filter-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptFilter_Filter) AWSCloudFormationType() string { + return "AWS::SES::ReceiptFilter.Filter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptFilter_Filter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_ipfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_ipfilter.go new file mode 100644 index 000000000000..a39bf5f40323 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptfilter_ipfilter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptFilter_IpFilter AWS CloudFormation Resource (AWS::SES::ReceiptFilter.IpFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-ipfilter.html +type AWSSESReceiptFilter_IpFilter struct { + + // Cidr AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-ipfilter.html#cfn-ses-receiptfilter-ipfilter-cidr + Cidr string `json:"Cidr,omitempty"` + + // Policy AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptfilter-ipfilter.html#cfn-ses-receiptfilter-ipfilter-policy + Policy string `json:"Policy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptFilter_IpFilter) AWSCloudFormationType() string { + return "AWS::SES::ReceiptFilter.IpFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptFilter_IpFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule.go new file mode 100644 index 000000000000..62cd91e6c09d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule.go @@ -0,0 +1,131 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESReceiptRule AWS CloudFormation Resource (AWS::SES::ReceiptRule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptrule.html +type AWSSESReceiptRule struct { + + // After AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptrule.html#cfn-ses-receiptrule-after + After string `json:"After,omitempty"` + + // Rule AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptrule.html#cfn-ses-receiptrule-rule + Rule *AWSSESReceiptRule_Rule `json:"Rule,omitempty"` + + // RuleSetName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptrule.html#cfn-ses-receiptrule-rulesetname + RuleSetName string `json:"RuleSetName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESReceiptRule) MarshalJSON() ([]byte, error) { + type Properties AWSSESReceiptRule + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESReceiptRule) UnmarshalJSON(b []byte) error { + type Properties AWSSESReceiptRule + 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 = AWSSESReceiptRule(*res.Properties) + } + + return nil +} + +// GetAllAWSSESReceiptRuleResources retrieves all AWSSESReceiptRule items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESReceiptRuleResources() map[string]AWSSESReceiptRule { + results := map[string]AWSSESReceiptRule{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESReceiptRule: + // 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::SES::ReceiptRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptRule + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESReceiptRuleWithName retrieves all AWSSESReceiptRule items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESReceiptRuleWithName(name string) (AWSSESReceiptRule, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESReceiptRule: + // 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::SES::ReceiptRule" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptRule + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESReceiptRule{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_action.go new file mode 100644 index 000000000000..610b04e40648 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_action.go @@ -0,0 +1,55 @@ +package cloudformation + +// AWSSESReceiptRule_Action AWS CloudFormation Resource (AWS::SES::ReceiptRule.Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html +type AWSSESReceiptRule_Action struct { + + // AddHeaderAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-addheaderaction + AddHeaderAction *AWSSESReceiptRule_AddHeaderAction `json:"AddHeaderAction,omitempty"` + + // BounceAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-bounceaction + BounceAction *AWSSESReceiptRule_BounceAction `json:"BounceAction,omitempty"` + + // LambdaAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-lambdaaction + LambdaAction *AWSSESReceiptRule_LambdaAction `json:"LambdaAction,omitempty"` + + // S3Action AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-s3action + S3Action *AWSSESReceiptRule_S3Action `json:"S3Action,omitempty"` + + // SNSAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-snsaction + SNSAction *AWSSESReceiptRule_SNSAction `json:"SNSAction,omitempty"` + + // StopAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-stopaction + StopAction *AWSSESReceiptRule_StopAction `json:"StopAction,omitempty"` + + // WorkmailAction AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-action.html#cfn-ses-receiptrule-action-workmailaction + WorkmailAction *AWSSESReceiptRule_WorkmailAction `json:"WorkmailAction,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_Action) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_addheaderaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_addheaderaction.go new file mode 100644 index 000000000000..46b333768fb6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_addheaderaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptRule_AddHeaderAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.AddHeaderAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-addheaderaction.html +type AWSSESReceiptRule_AddHeaderAction struct { + + // HeaderName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-addheaderaction.html#cfn-ses-receiptrule-addheaderaction-headername + HeaderName string `json:"HeaderName,omitempty"` + + // HeaderValue AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-addheaderaction.html#cfn-ses-receiptrule-addheaderaction-headervalue + HeaderValue string `json:"HeaderValue,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_AddHeaderAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.AddHeaderAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_AddHeaderAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_bounceaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_bounceaction.go new file mode 100644 index 000000000000..8107b5667a7d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_bounceaction.go @@ -0,0 +1,45 @@ +package cloudformation + +// AWSSESReceiptRule_BounceAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.BounceAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html +type AWSSESReceiptRule_BounceAction struct { + + // Message AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html#cfn-ses-receiptrule-bounceaction-message + Message string `json:"Message,omitempty"` + + // Sender AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html#cfn-ses-receiptrule-bounceaction-sender + Sender string `json:"Sender,omitempty"` + + // SmtpReplyCode AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html#cfn-ses-receiptrule-bounceaction-smtpreplycode + SmtpReplyCode string `json:"SmtpReplyCode,omitempty"` + + // StatusCode AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html#cfn-ses-receiptrule-bounceaction-statuscode + StatusCode string `json:"StatusCode,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-bounceaction.html#cfn-ses-receiptrule-bounceaction-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_BounceAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.BounceAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_BounceAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_lambdaaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_lambdaaction.go new file mode 100644 index 000000000000..2f436351aba3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_lambdaaction.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSESReceiptRule_LambdaAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.LambdaAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-lambdaaction.html +type AWSSESReceiptRule_LambdaAction struct { + + // FunctionArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-lambdaaction.html#cfn-ses-receiptrule-lambdaaction-functionarn + FunctionArn string `json:"FunctionArn,omitempty"` + + // InvocationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-lambdaaction.html#cfn-ses-receiptrule-lambdaaction-invocationtype + InvocationType string `json:"InvocationType,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-lambdaaction.html#cfn-ses-receiptrule-lambdaaction-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_LambdaAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.LambdaAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_LambdaAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_rule.go new file mode 100644 index 000000000000..708c6161cce6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_rule.go @@ -0,0 +1,50 @@ +package cloudformation + +// AWSSESReceiptRule_Rule AWS CloudFormation Resource (AWS::SES::ReceiptRule.Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html +type AWSSESReceiptRule_Rule struct { + + // Actions AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-actions + Actions []AWSSESReceiptRule_Action `json:"Actions,omitempty"` + + // Enabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-enabled + Enabled bool `json:"Enabled,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-name + Name string `json:"Name,omitempty"` + + // Recipients AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-recipients + Recipients []string `json:"Recipients,omitempty"` + + // ScanEnabled AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-scanenabled + ScanEnabled bool `json:"ScanEnabled,omitempty"` + + // TlsPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-rule.html#cfn-ses-receiptrule-rule-tlspolicy + TlsPolicy string `json:"TlsPolicy,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_Rule) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_Rule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_s3action.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_s3action.go new file mode 100644 index 000000000000..84ef37f61382 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_s3action.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSSESReceiptRule_S3Action AWS CloudFormation Resource (AWS::SES::ReceiptRule.S3Action) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-s3action.html +type AWSSESReceiptRule_S3Action struct { + + // BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-s3action.html#cfn-ses-receiptrule-s3action-bucketname + BucketName string `json:"BucketName,omitempty"` + + // KmsKeyArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-s3action.html#cfn-ses-receiptrule-s3action-kmskeyarn + KmsKeyArn string `json:"KmsKeyArn,omitempty"` + + // ObjectKeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-s3action.html#cfn-ses-receiptrule-s3action-objectkeyprefix + ObjectKeyPrefix string `json:"ObjectKeyPrefix,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-s3action.html#cfn-ses-receiptrule-s3action-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_S3Action) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.S3Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_S3Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_snsaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_snsaction.go new file mode 100644 index 000000000000..d12c0b751904 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_snsaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptRule_SNSAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.SNSAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-snsaction.html +type AWSSESReceiptRule_SNSAction struct { + + // Encoding AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-snsaction.html#cfn-ses-receiptrule-snsaction-encoding + Encoding string `json:"Encoding,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-snsaction.html#cfn-ses-receiptrule-snsaction-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_SNSAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.SNSAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_SNSAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_stopaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_stopaction.go new file mode 100644 index 000000000000..1b6aa60f961a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_stopaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptRule_StopAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.StopAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-stopaction.html +type AWSSESReceiptRule_StopAction struct { + + // Scope AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-stopaction.html#cfn-ses-receiptrule-stopaction-scope + Scope string `json:"Scope,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-stopaction.html#cfn-ses-receiptrule-stopaction-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_StopAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.StopAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_StopAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_workmailaction.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_workmailaction.go new file mode 100644 index 000000000000..fd0cbd3910ba --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptrule_workmailaction.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSESReceiptRule_WorkmailAction AWS CloudFormation Resource (AWS::SES::ReceiptRule.WorkmailAction) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-workmailaction.html +type AWSSESReceiptRule_WorkmailAction struct { + + // OrganizationArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-workmailaction.html#cfn-ses-receiptrule-workmailaction-organizationarn + OrganizationArn string `json:"OrganizationArn,omitempty"` + + // TopicArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-receiptrule-workmailaction.html#cfn-ses-receiptrule-workmailaction-topicarn + TopicArn string `json:"TopicArn,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRule_WorkmailAction) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRule.WorkmailAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRule_WorkmailAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptruleset.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptruleset.go new file mode 100644 index 000000000000..17849e1bf688 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-receiptruleset.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESReceiptRuleSet AWS CloudFormation Resource (AWS::SES::ReceiptRuleSet) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptruleset.html +type AWSSESReceiptRuleSet struct { + + // RuleSetName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-receiptruleset.html#cfn-ses-receiptruleset-rulesetname + RuleSetName string `json:"RuleSetName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESReceiptRuleSet) AWSCloudFormationType() string { + return "AWS::SES::ReceiptRuleSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESReceiptRuleSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESReceiptRuleSet) MarshalJSON() ([]byte, error) { + type Properties AWSSESReceiptRuleSet + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESReceiptRuleSet) UnmarshalJSON(b []byte) error { + type Properties AWSSESReceiptRuleSet + 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 = AWSSESReceiptRuleSet(*res.Properties) + } + + return nil +} + +// GetAllAWSSESReceiptRuleSetResources retrieves all AWSSESReceiptRuleSet items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESReceiptRuleSetResources() map[string]AWSSESReceiptRuleSet { + results := map[string]AWSSESReceiptRuleSet{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESReceiptRuleSet: + // 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::SES::ReceiptRuleSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptRuleSet + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESReceiptRuleSetWithName retrieves all AWSSESReceiptRuleSet items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESReceiptRuleSetWithName(name string) (AWSSESReceiptRuleSet, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESReceiptRuleSet: + // 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::SES::ReceiptRuleSet" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESReceiptRuleSet + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESReceiptRuleSet{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template.go new file mode 100644 index 000000000000..9c7e6646269b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template.go @@ -0,0 +1,121 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSESTemplate AWS CloudFormation Resource (AWS::SES::Template) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-template.html +type AWSSESTemplate struct { + + // Template AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ses-template.html#cfn-ses-template-template + Template *AWSSESTemplate_Template `json:"Template,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESTemplate) AWSCloudFormationType() string { + return "AWS::SES::Template" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESTemplate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSESTemplate) MarshalJSON() ([]byte, error) { + type Properties AWSSESTemplate + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSESTemplate) UnmarshalJSON(b []byte) error { + type Properties AWSSESTemplate + 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 = AWSSESTemplate(*res.Properties) + } + + return nil +} + +// GetAllAWSSESTemplateResources retrieves all AWSSESTemplate items from an AWS CloudFormation template +func (t *Template) GetAllAWSSESTemplateResources() map[string]AWSSESTemplate { + results := map[string]AWSSESTemplate{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSESTemplate: + // 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::SES::Template" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESTemplate + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSESTemplateWithName retrieves all AWSSESTemplate items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSESTemplateWithName(name string) (AWSSESTemplate, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSESTemplate: + // 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::SES::Template" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSESTemplate + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSESTemplate{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template_template.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template_template.go new file mode 100644 index 000000000000..551a1ab46678 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ses-template_template.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSSESTemplate_Template AWS CloudFormation Resource (AWS::SES::Template.Template) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html +type AWSSESTemplate_Template struct { + + // HtmlPart AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-htmlpart + HtmlPart string `json:"HtmlPart,omitempty"` + + // SubjectPart AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-subjectpart + SubjectPart string `json:"SubjectPart,omitempty"` + + // TemplateName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-templatename + TemplateName string `json:"TemplateName,omitempty"` + + // TextPart AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-textpart + TextPart string `json:"TextPart,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSESTemplate_Template) AWSCloudFormationType() string { + return "AWS::SES::Template.Template" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSESTemplate_Template) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0e3d6692a2d9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-subscription.go @@ -0,0 +1,151 @@ +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 { + + // DeliveryPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-deliverypolicy + DeliveryPolicy interface{} `json:"DeliveryPolicy,omitempty"` + + // 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"` + + // FilterPolicy AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-filterpolicy + FilterPolicy interface{} `json:"FilterPolicy,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"` + + // RawMessageDelivery AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-rawmessagedelivery + RawMessageDelivery bool `json:"RawMessageDelivery,omitempty"` + + // Region AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region + Region string `json:"Region,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSSubscription) AWSCloudFormationType() string { + return "AWS::SNS::Subscription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSNSSubscription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c73c0e9ff1f3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopic) AWSCloudFormationType() string { + return "AWS::SNS::Topic" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSNSTopic) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..7927777b6bd6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topic_subscription.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopic_Subscription) AWSCloudFormationType() string { + return "AWS::SNS::Topic.Subscription" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSNSTopic_Subscription) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..67e44f53c562 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sns-topicpolicy.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSNSTopicPolicy) AWSCloudFormationType() string { + return "AWS::SNS::TopicPolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSNSTopicPolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..fd9433e8d748 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queue.go @@ -0,0 +1,176 @@ +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"` + + // KmsDataKeyReusePeriodSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-kmsdatakeyreuseperiodseconds + KmsDataKeyReusePeriodSeconds int `json:"KmsDataKeyReusePeriodSeconds,omitempty"` + + // KmsMasterKeyId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-sqs-queue-kmsmasterkeyid + KmsMasterKeyId string `json:"KmsMasterKeyId,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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#cfn-sqs-queue-tags + Tags []Tag `json:"Tags,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSQSQueue) AWSCloudFormationType() string { + return "AWS::SQS::Queue" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSQSQueue) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..222c078e4347 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-sqs-queuepolicy.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSQSQueuePolicy) AWSCloudFormationType() string { + return "AWS::SQS::QueuePolicy" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSQSQueuePolicy) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..cd95ccd18747 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association.go @@ -0,0 +1,156 @@ +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 { + + // AssociationName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-associationname + AssociationName string `json:"AssociationName,omitempty"` + + // 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"` + + // OutputLocation AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-outputlocation + OutputLocation *AWSSSMAssociation_InstanceAssociationOutputLocation `json:"OutputLocation,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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation) AWSCloudFormationType() string { + return "AWS::SSM::Association" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_instanceassociationoutputlocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_instanceassociationoutputlocation.go new file mode 100644 index 000000000000..b325df34235b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_instanceassociationoutputlocation.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSSSMAssociation_InstanceAssociationOutputLocation AWS CloudFormation Resource (AWS::SSM::Association.InstanceAssociationOutputLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-instanceassociationoutputlocation.html +type AWSSSMAssociation_InstanceAssociationOutputLocation struct { + + // S3Location AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-instanceassociationoutputlocation.html#cfn-ssm-association-instanceassociationoutputlocation-s3location + S3Location *AWSSSMAssociation_S3OutputLocation `json:"S3Location,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_InstanceAssociationOutputLocation) AWSCloudFormationType() string { + return "AWS::SSM::Association.InstanceAssociationOutputLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMAssociation_InstanceAssociationOutputLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..0792fd2bbe44 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_parametervalues.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_ParameterValues) AWSCloudFormationType() string { + return "AWS::SSM::Association.ParameterValues" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMAssociation_ParameterValues) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_s3outputlocation.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_s3outputlocation.go new file mode 100644 index 000000000000..f49b4d484ef7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_s3outputlocation.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSSMAssociation_S3OutputLocation AWS CloudFormation Resource (AWS::SSM::Association.S3OutputLocation) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-s3outputlocation.html +type AWSSSMAssociation_S3OutputLocation struct { + + // OutputS3BucketName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-s3outputlocation.html#cfn-ssm-association-s3outputlocation-outputs3bucketname + OutputS3BucketName string `json:"OutputS3BucketName,omitempty"` + + // OutputS3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-s3outputlocation.html#cfn-ssm-association-s3outputlocation-outputs3keyprefix + OutputS3KeyPrefix string `json:"OutputS3KeyPrefix,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_S3OutputLocation) AWSCloudFormationType() string { + return "AWS::SSM::Association.S3OutputLocation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMAssociation_S3OutputLocation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ee95c7abed1e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-association_target.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMAssociation_Target) AWSCloudFormationType() string { + return "AWS::SSM::Association.Target" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMAssociation_Target) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..839401eeda8a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-document.go @@ -0,0 +1,131 @@ +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"` + + // Tags AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-tags + Tags []Tag `json:"Tags,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMDocument) AWSCloudFormationType() string { + return "AWS::SSM::Document" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMDocument) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-maintenancewindowtask.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask.go new file mode 100644 index 000000000000..be3701a64bf4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask.go @@ -0,0 +1,181 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMMaintenanceWindowTask AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html +type AWSSSMMaintenanceWindowTask struct { + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-description + Description string `json:"Description,omitempty"` + + // LoggingInfo AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-logginginfo + LoggingInfo *AWSSSMMaintenanceWindowTask_LoggingInfo `json:"LoggingInfo,omitempty"` + + // MaxConcurrency AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-maxconcurrency + MaxConcurrency string `json:"MaxConcurrency,omitempty"` + + // MaxErrors AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-maxerrors + MaxErrors string `json:"MaxErrors,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-name + Name string `json:"Name,omitempty"` + + // Priority AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-priority + Priority int `json:"Priority,omitempty"` + + // ServiceRoleArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-servicerolearn + ServiceRoleArn string `json:"ServiceRoleArn,omitempty"` + + // Targets AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-targets + Targets []AWSSSMMaintenanceWindowTask_Target `json:"Targets,omitempty"` + + // TaskArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-taskarn + TaskArn string `json:"TaskArn,omitempty"` + + // TaskInvocationParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters + TaskInvocationParameters *AWSSSMMaintenanceWindowTask_TaskInvocationParameters `json:"TaskInvocationParameters,omitempty"` + + // TaskParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-taskparameters + TaskParameters interface{} `json:"TaskParameters,omitempty"` + + // TaskType AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-tasktype + TaskType string `json:"TaskType,omitempty"` + + // WindowId AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-maintenancewindowtask.html#cfn-ssm-maintenancewindowtask-windowid + WindowId string `json:"WindowId,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSSMMaintenanceWindowTask) MarshalJSON() ([]byte, error) { + type Properties AWSSSMMaintenanceWindowTask + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMMaintenanceWindowTask) UnmarshalJSON(b []byte) error { + type Properties AWSSSMMaintenanceWindowTask + 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 = AWSSSMMaintenanceWindowTask(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMMaintenanceWindowTaskResources retrieves all AWSSSMMaintenanceWindowTask items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMMaintenanceWindowTaskResources() map[string]AWSSSMMaintenanceWindowTask { + results := map[string]AWSSSMMaintenanceWindowTask{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMMaintenanceWindowTask: + // 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::MaintenanceWindowTask" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMMaintenanceWindowTask + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMMaintenanceWindowTaskWithName retrieves all AWSSSMMaintenanceWindowTask items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMMaintenanceWindowTaskWithName(name string) (AWSSSMMaintenanceWindowTask, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMMaintenanceWindowTask: + // 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::MaintenanceWindowTask" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMMaintenanceWindowTask + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMMaintenanceWindowTask{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_logginginfo.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_logginginfo.go new file mode 100644 index 000000000000..9c5ddda8b0bf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_logginginfo.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_LoggingInfo AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.LoggingInfo) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-logginginfo.html +type AWSSSMMaintenanceWindowTask_LoggingInfo struct { + + // Region AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-logginginfo.html#cfn-ssm-maintenancewindowtask-logginginfo-region + Region string `json:"Region,omitempty"` + + // S3Bucket AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-logginginfo.html#cfn-ssm-maintenancewindowtask-logginginfo-s3bucket + S3Bucket string `json:"S3Bucket,omitempty"` + + // S3Prefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-logginginfo.html#cfn-ssm-maintenancewindowtask-logginginfo-s3prefix + S3Prefix string `json:"S3Prefix,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_LoggingInfo) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.LoggingInfo" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_LoggingInfo) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowautomationparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowautomationparameters.go new file mode 100644 index 000000000000..5dc499042ddf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowautomationparameters.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_MaintenanceWindowAutomationParameters AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.MaintenanceWindowAutomationParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowautomationparameters.html +type AWSSSMMaintenanceWindowTask_MaintenanceWindowAutomationParameters struct { + + // DocumentVersion AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowautomationparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowautomationparameters-documentversion + DocumentVersion string `json:"DocumentVersion,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowautomationparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowautomationparameters-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowAutomationParameters) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.MaintenanceWindowAutomationParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowAutomationParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowlambdaparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowlambdaparameters.go new file mode 100644 index 000000000000..aa0054138b3c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowlambdaparameters.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_MaintenanceWindowLambdaParameters AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.MaintenanceWindowLambdaParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowlambdaparameters.html +type AWSSSMMaintenanceWindowTask_MaintenanceWindowLambdaParameters struct { + + // ClientContext AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowlambdaparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowlambdaparameters-clientcontext + ClientContext string `json:"ClientContext,omitempty"` + + // Payload AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowlambdaparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowlambdaparameters-payload + Payload string `json:"Payload,omitempty"` + + // Qualifier AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowlambdaparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowlambdaparameters-qualifier + Qualifier string `json:"Qualifier,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowLambdaParameters) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.MaintenanceWindowLambdaParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowLambdaParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowruncommandparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowruncommandparameters.go new file mode 100644 index 000000000000..e5c60f9b8371 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowruncommandparameters.go @@ -0,0 +1,65 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_MaintenanceWindowRunCommandParameters AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.MaintenanceWindowRunCommandParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html +type AWSSSMMaintenanceWindowTask_MaintenanceWindowRunCommandParameters struct { + + // Comment AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-comment + Comment string `json:"Comment,omitempty"` + + // DocumentHash AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-documenthash + DocumentHash string `json:"DocumentHash,omitempty"` + + // DocumentHashType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-documenthashtype + DocumentHashType string `json:"DocumentHashType,omitempty"` + + // NotificationConfig AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-notificationconfig + NotificationConfig *AWSSSMMaintenanceWindowTask_NotificationConfig `json:"NotificationConfig,omitempty"` + + // OutputS3BucketName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-outputs3bucketname + OutputS3BucketName string `json:"OutputS3BucketName,omitempty"` + + // OutputS3KeyPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-outputs3keyprefix + OutputS3KeyPrefix string `json:"OutputS3KeyPrefix,omitempty"` + + // Parameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-parameters + Parameters interface{} `json:"Parameters,omitempty"` + + // ServiceRoleArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-servicerolearn + ServiceRoleArn string `json:"ServiceRoleArn,omitempty"` + + // TimeoutSeconds AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowruncommandparameters-timeoutseconds + TimeoutSeconds int `json:"TimeoutSeconds,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowRunCommandParameters) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.MaintenanceWindowRunCommandParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowRunCommandParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowstepfunctionsparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowstepfunctionsparameters.go new file mode 100644 index 000000000000..cc4f3e7ba9b9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_maintenancewindowstepfunctionsparameters.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_MaintenanceWindowStepFunctionsParameters AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.MaintenanceWindowStepFunctionsParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowstepfunctionsparameters.html +type AWSSSMMaintenanceWindowTask_MaintenanceWindowStepFunctionsParameters struct { + + // Input AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowstepfunctionsparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowstepfunctionsparameters-input + Input string `json:"Input,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowstepfunctionsparameters.html#cfn-ssm-maintenancewindowtask-maintenancewindowstepfunctionsparameters-name + Name string `json:"Name,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowStepFunctionsParameters) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.MaintenanceWindowStepFunctionsParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_MaintenanceWindowStepFunctionsParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_notificationconfig.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_notificationconfig.go new file mode 100644 index 000000000000..963bb9ea9f00 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_notificationconfig.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_NotificationConfig AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.NotificationConfig) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-notificationconfig.html +type AWSSSMMaintenanceWindowTask_NotificationConfig struct { + + // NotificationArn AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-notificationconfig.html#cfn-ssm-maintenancewindowtask-notificationconfig-notificationarn + NotificationArn string `json:"NotificationArn,omitempty"` + + // NotificationEvents AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-notificationconfig.html#cfn-ssm-maintenancewindowtask-notificationconfig-notificationevents + NotificationEvents []string `json:"NotificationEvents,omitempty"` + + // NotificationType AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-notificationconfig.html#cfn-ssm-maintenancewindowtask-notificationconfig-notificationtype + NotificationType string `json:"NotificationType,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_NotificationConfig) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.NotificationConfig" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_NotificationConfig) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_target.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_target.go new file mode 100644 index 000000000000..f95c676af0ac --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_target.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_Target AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.Target) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-target.html +type AWSSSMMaintenanceWindowTask_Target struct { + + // Key AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-target.html#cfn-ssm-maintenancewindowtask-target-key + Key string `json:"Key,omitempty"` + + // Values AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-target.html#cfn-ssm-maintenancewindowtask-target-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_Target) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.Target" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_Target) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_taskinvocationparameters.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_taskinvocationparameters.go new file mode 100644 index 000000000000..0d6b90d3299f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-maintenancewindowtask_taskinvocationparameters.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSSSMMaintenanceWindowTask_TaskInvocationParameters AWS CloudFormation Resource (AWS::SSM::MaintenanceWindowTask.TaskInvocationParameters) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html +type AWSSSMMaintenanceWindowTask_TaskInvocationParameters struct { + + // MaintenanceWindowAutomationParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters-maintenancewindowautomationparameters + MaintenanceWindowAutomationParameters *AWSSSMMaintenanceWindowTask_MaintenanceWindowAutomationParameters `json:"MaintenanceWindowAutomationParameters,omitempty"` + + // MaintenanceWindowLambdaParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters-maintenancewindowlambdaparameters + MaintenanceWindowLambdaParameters *AWSSSMMaintenanceWindowTask_MaintenanceWindowLambdaParameters `json:"MaintenanceWindowLambdaParameters,omitempty"` + + // MaintenanceWindowRunCommandParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters-maintenancewindowruncommandparameters + MaintenanceWindowRunCommandParameters *AWSSSMMaintenanceWindowTask_MaintenanceWindowRunCommandParameters `json:"MaintenanceWindowRunCommandParameters,omitempty"` + + // MaintenanceWindowStepFunctionsParameters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-taskinvocationparameters.html#cfn-ssm-maintenancewindowtask-taskinvocationparameters-maintenancewindowstepfunctionsparameters + MaintenanceWindowStepFunctionsParameters *AWSSSMMaintenanceWindowTask_MaintenanceWindowStepFunctionsParameters `json:"MaintenanceWindowStepFunctionsParameters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMMaintenanceWindowTask_TaskInvocationParameters) AWSCloudFormationType() string { + return "AWS::SSM::MaintenanceWindowTask.TaskInvocationParameters" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMMaintenanceWindowTask_TaskInvocationParameters) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..26495e1dbcb5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-parameter.go @@ -0,0 +1,141 @@ +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 { + + // AllowedPattern AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-allowedpattern + AllowedPattern string `json:"AllowedPattern,omitempty"` + + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMParameter) AWSCloudFormationType() string { + return "AWS::SSM::Parameter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMParameter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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-ssm-patchbaseline.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline.go new file mode 100644 index 000000000000..30911bf5bc47 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline.go @@ -0,0 +1,171 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMPatchBaseline AWS CloudFormation Resource (AWS::SSM::PatchBaseline) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html +type AWSSSMPatchBaseline struct { + + // ApprovalRules AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-approvalrules + ApprovalRules *AWSSSMPatchBaseline_RuleGroup `json:"ApprovalRules,omitempty"` + + // ApprovedPatches AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-approvedpatches + ApprovedPatches []string `json:"ApprovedPatches,omitempty"` + + // ApprovedPatchesComplianceLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-approvedpatchescompliancelevel + ApprovedPatchesComplianceLevel string `json:"ApprovedPatchesComplianceLevel,omitempty"` + + // ApprovedPatchesEnableNonSecurity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-approvedpatchesenablenonsecurity + ApprovedPatchesEnableNonSecurity bool `json:"ApprovedPatchesEnableNonSecurity,omitempty"` + + // Description AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-description + Description string `json:"Description,omitempty"` + + // GlobalFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-globalfilters + GlobalFilters *AWSSSMPatchBaseline_PatchFilterGroup `json:"GlobalFilters,omitempty"` + + // Name AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-name + Name string `json:"Name,omitempty"` + + // OperatingSystem AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-operatingsystem + OperatingSystem string `json:"OperatingSystem,omitempty"` + + // PatchGroups AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-patchgroups + PatchGroups []string `json:"PatchGroups,omitempty"` + + // RejectedPatches AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-rejectedpatches + RejectedPatches []string `json:"RejectedPatches,omitempty"` + + // Sources AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-patchbaseline.html#cfn-ssm-patchbaseline-sources + Sources []AWSSSMPatchBaseline_PatchSource `json:"Sources,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSSMPatchBaseline) MarshalJSON() ([]byte, error) { + type Properties AWSSSMPatchBaseline + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMPatchBaseline) UnmarshalJSON(b []byte) error { + type Properties AWSSSMPatchBaseline + 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 = AWSSSMPatchBaseline(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMPatchBaselineResources retrieves all AWSSSMPatchBaseline items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMPatchBaselineResources() map[string]AWSSSMPatchBaseline { + results := map[string]AWSSSMPatchBaseline{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMPatchBaseline: + // 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::PatchBaseline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMPatchBaseline + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMPatchBaselineWithName retrieves all AWSSSMPatchBaseline items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMPatchBaselineWithName(name string) (AWSSSMPatchBaseline, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMPatchBaseline: + // 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::PatchBaseline" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMPatchBaseline + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMPatchBaseline{}, errors.New("resource not found") +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfilter.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfilter.go new file mode 100644 index 000000000000..20788327d09b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfilter.go @@ -0,0 +1,30 @@ +package cloudformation + +// AWSSSMPatchBaseline_PatchFilter AWS CloudFormation Resource (AWS::SSM::PatchBaseline.PatchFilter) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfilter.html +type AWSSSMPatchBaseline_PatchFilter struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfilter.html#cfn-ssm-patchbaseline-patchfilter-key + Key string `json:"Key,omitempty"` + + // Values AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfilter.html#cfn-ssm-patchbaseline-patchfilter-values + Values []string `json:"Values,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_PatchFilter) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.PatchFilter" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline_PatchFilter) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfiltergroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfiltergroup.go new file mode 100644 index 000000000000..bd080e8058aa --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchfiltergroup.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSSSMPatchBaseline_PatchFilterGroup AWS CloudFormation Resource (AWS::SSM::PatchBaseline.PatchFilterGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfiltergroup.html +type AWSSSMPatchBaseline_PatchFilterGroup struct { + + // PatchFilters AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchfiltergroup.html#cfn-ssm-patchbaseline-patchfiltergroup-patchfilters + PatchFilters []AWSSSMPatchBaseline_PatchFilter `json:"PatchFilters,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_PatchFilterGroup) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.PatchFilterGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline_PatchFilterGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchgroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchgroup.go new file mode 100644 index 000000000000..97ee734dd86c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchgroup.go @@ -0,0 +1,11 @@ +package cloudformation + +// AWSSSMPatchBaseline_PatchGroup AWS CloudFormation Resource (AWS::SSM::PatchBaseline.PatchGroup) +// See: +type AWSSSMPatchBaseline_PatchGroup struct { +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_PatchGroup) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.PatchGroup" +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchsource.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchsource.go new file mode 100644 index 000000000000..ef4571bc073c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_patchsource.go @@ -0,0 +1,35 @@ +package cloudformation + +// AWSSSMPatchBaseline_PatchSource AWS CloudFormation Resource (AWS::SSM::PatchBaseline.PatchSource) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchsource.html +type AWSSSMPatchBaseline_PatchSource struct { + + // Configuration AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchsource.html#cfn-ssm-patchbaseline-patchsource-configuration + Configuration string `json:"Configuration,omitempty"` + + // Name AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchsource.html#cfn-ssm-patchbaseline-patchsource-name + Name string `json:"Name,omitempty"` + + // Products AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-patchsource.html#cfn-ssm-patchbaseline-patchsource-products + Products []string `json:"Products,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_PatchSource) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.PatchSource" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline_PatchSource) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rule.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rule.go new file mode 100644 index 000000000000..c218b33fb617 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rule.go @@ -0,0 +1,40 @@ +package cloudformation + +// AWSSSMPatchBaseline_Rule AWS CloudFormation Resource (AWS::SSM::PatchBaseline.Rule) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rule.html +type AWSSSMPatchBaseline_Rule struct { + + // ApproveAfterDays AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rule.html#cfn-ssm-patchbaseline-rule-approveafterdays + ApproveAfterDays int `json:"ApproveAfterDays,omitempty"` + + // ComplianceLevel AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rule.html#cfn-ssm-patchbaseline-rule-compliancelevel + ComplianceLevel string `json:"ComplianceLevel,omitempty"` + + // EnableNonSecurity AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rule.html#cfn-ssm-patchbaseline-rule-enablenonsecurity + EnableNonSecurity bool `json:"EnableNonSecurity,omitempty"` + + // PatchFilterGroup AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rule.html#cfn-ssm-patchbaseline-rule-patchfiltergroup + PatchFilterGroup *AWSSSMPatchBaseline_PatchFilterGroup `json:"PatchFilterGroup,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_Rule) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline_Rule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rulegroup.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rulegroup.go new file mode 100644 index 000000000000..368fd699bc70 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-patchbaseline_rulegroup.go @@ -0,0 +1,25 @@ +package cloudformation + +// AWSSSMPatchBaseline_RuleGroup AWS CloudFormation Resource (AWS::SSM::PatchBaseline.RuleGroup) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rulegroup.html +type AWSSSMPatchBaseline_RuleGroup struct { + + // PatchRules AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-patchbaseline-rulegroup.html#cfn-ssm-patchbaseline-rulegroup-patchrules + PatchRules []AWSSSMPatchBaseline_Rule `json:"PatchRules,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMPatchBaseline_RuleGroup) AWSCloudFormationType() string { + return "AWS::SSM::PatchBaseline.RuleGroup" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMPatchBaseline_RuleGroup) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-resourcedatasync.go b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-resourcedatasync.go new file mode 100644 index 000000000000..06c4ba09ef72 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-ssm-resourcedatasync.go @@ -0,0 +1,146 @@ +package cloudformation + +import ( + "encoding/json" + "errors" + "fmt" +) + +// AWSSSMResourceDataSync AWS CloudFormation Resource (AWS::SSM::ResourceDataSync) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html +type AWSSSMResourceDataSync struct { + + // BucketName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-bucketname + BucketName string `json:"BucketName,omitempty"` + + // BucketPrefix AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-bucketprefix + BucketPrefix string `json:"BucketPrefix,omitempty"` + + // BucketRegion AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-bucketregion + BucketRegion string `json:"BucketRegion,omitempty"` + + // KMSKeyArn AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-kmskeyarn + KMSKeyArn string `json:"KMSKeyArn,omitempty"` + + // SyncFormat AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-syncformat + SyncFormat string `json:"SyncFormat,omitempty"` + + // SyncName AWS CloudFormation Property + // Required: true + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-resourcedatasync.html#cfn-ssm-resourcedatasync-syncname + SyncName string `json:"SyncName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSSSMResourceDataSync) AWSCloudFormationType() string { + return "AWS::SSM::ResourceDataSync" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSSSMResourceDataSync) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 AWSSSMResourceDataSync) MarshalJSON() ([]byte, error) { + type Properties AWSSSMResourceDataSync + return json.Marshal(&struct { + Type string + Properties Properties + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// UnmarshalJSON is a custom JSON unmarshalling hook that strips the outer +// AWS CloudFormation resource object, and just keeps the 'Properties' field. +func (r *AWSSSMResourceDataSync) UnmarshalJSON(b []byte) error { + type Properties AWSSSMResourceDataSync + 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 = AWSSSMResourceDataSync(*res.Properties) + } + + return nil +} + +// GetAllAWSSSMResourceDataSyncResources retrieves all AWSSSMResourceDataSync items from an AWS CloudFormation template +func (t *Template) GetAllAWSSSMResourceDataSyncResources() map[string]AWSSSMResourceDataSync { + results := map[string]AWSSSMResourceDataSync{} + for name, untyped := range t.Resources { + switch resource := untyped.(type) { + case AWSSSMResourceDataSync: + // 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::ResourceDataSync" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMResourceDataSync + if err := json.Unmarshal(b, &result); err == nil { + results[name] = result + } + } + } + } + } + } + return results +} + +// GetAWSSSMResourceDataSyncWithName retrieves all AWSSSMResourceDataSync items from an AWS CloudFormation template +// whose logical ID matches the provided name. Returns an error if not found. +func (t *Template) GetAWSSSMResourceDataSyncWithName(name string) (AWSSSMResourceDataSync, error) { + if untyped, ok := t.Resources[name]; ok { + switch resource := untyped.(type) { + case AWSSSMResourceDataSync: + // 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::ResourceDataSync" { + // The resource is correct, unmarshal it into the results + if b, err := json.Marshal(resource); err == nil { + var result AWSSSMResourceDataSync + if err := json.Unmarshal(b, &result); err == nil { + return result, nil + } + } + } + } + } + } + return AWSSSMResourceDataSync{}, 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 000000000000..e8660a24aded --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-activity.go @@ -0,0 +1,121 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSStepFunctionsActivity) AWSCloudFormationType() string { + return "AWS::StepFunctions::Activity" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSStepFunctionsActivity) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..f450cd84f8d7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-stepfunctions-statemachine.go @@ -0,0 +1,131 @@ +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"` + + // StateMachineName AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-statemachinename + StateMachineName string `json:"StateMachineName,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSStepFunctionsStateMachine) AWSCloudFormationType() string { + return "AWS::StepFunctions::StateMachine" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSStepFunctionsStateMachine) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..497221fe0f08 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFByteMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..3398f7a962bb --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_bytematchtuple.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet_ByteMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet.ByteMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFByteMatchSet_ByteMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..d3f803ac93a1 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-bytematchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFByteMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::ByteMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFByteMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..8f8127ea7b00 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFIPSet) AWSCloudFormationType() string { + return "AWS::WAF::IPSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFIPSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..69efb9c131a7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-ipset_ipsetdescriptor.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFIPSet_IPSetDescriptor) AWSCloudFormationType() string { + return "AWS::WAF::IPSet.IPSetDescriptor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFIPSet_IPSetDescriptor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a619a1fc03b4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRule) AWSCloudFormationType() string { + return "AWS::WAF::Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..3d64145d4e99 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-rule_predicate.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRule_Predicate) AWSCloudFormationType() string { + return "AWS::WAF::Rule.Predicate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRule_Predicate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7424d5498b50 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSizeConstraintSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..e204298a959d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSizeConstraintSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f0542d405223 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sizeconstraintset_sizeconstraint.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSizeConstraintSet_SizeConstraint) AWSCloudFormationType() string { + return "AWS::WAF::SizeConstraintSet.SizeConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSizeConstraintSet_SizeConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b3fde51801c9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSqlInjectionMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..1b3221e4cb0b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSqlInjectionMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6a5ad06baaf6 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-sqlinjectionmatchset_sqlinjectionmatchtuple.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::SqlInjectionMatchSet.SqlInjectionMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFSqlInjectionMatchSet_SqlInjectionMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..660d6d3754bd --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL) AWSCloudFormationType() string { + return "AWS::WAF::WebACL" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFWebACL) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..68a095325b97 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_activatedrule.go @@ -0,0 +1,35 @@ +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: false + // 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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL_ActivatedRule) AWSCloudFormationType() string { + return "AWS::WAF::WebACL.ActivatedRule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFWebACL_ActivatedRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..30c9836d4190 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-webacl_wafaction.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFWebACL_WafAction) AWSCloudFormationType() string { + return "AWS::WAF::WebACL.WafAction" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFWebACL_WafAction) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..bff915310e83 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFXssMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..97de452e8bfc --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFXssMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..f3c0ec62a21b --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-waf-xssmatchset_xssmatchtuple.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFXssMatchSet_XssMatchTuple) AWSCloudFormationType() string { + return "AWS::WAF::XssMatchSet.XssMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFXssMatchSet_XssMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..2204a09fcdce --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalByteMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..2c7388dc1599 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_bytematchtuple.go @@ -0,0 +1,45 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet_ByteMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet.ByteMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalByteMatchSet_ByteMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..74c32995fb36 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-bytematchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalByteMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::ByteMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalByteMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..379c9e417252 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalIPSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::IPSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalIPSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..821bf4ea5f6c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-ipset_ipsetdescriptor.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalIPSet_IPSetDescriptor) AWSCloudFormationType() string { + return "AWS::WAFRegional::IPSet.IPSetDescriptor" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalIPSet_IPSetDescriptor) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..95b6797e3181 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule.go @@ -0,0 +1,131 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalRule) AWSCloudFormationType() string { + return "AWS::WAFRegional::Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalRule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..fdad404ad51d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-rule_predicate.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalRule_Predicate) AWSCloudFormationType() string { + return "AWS::WAFRegional::Rule.Predicate" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalRule_Predicate) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..a4dbca4f7a1a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSizeConstraintSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..63925059f220 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSizeConstraintSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..e078bb05440d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sizeconstraintset_sizeconstraint.go @@ -0,0 +1,40 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSizeConstraintSet_SizeConstraint) AWSCloudFormationType() string { + return "AWS::WAFRegional::SizeConstraintSet.SizeConstraint" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSizeConstraintSet_SizeConstraint) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..c40129f4f7a3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSqlInjectionMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..3f95ffad24f0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSqlInjectionMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..6d378a83df55 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-sqlinjectionmatchset_sqlinjectionmatchtuple.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::SqlInjectionMatchSet.SqlInjectionMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalSqlInjectionMatchSet_SqlInjectionMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..65fc68705a6a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl.go @@ -0,0 +1,136 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalWebACL) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d5b4b7339a6d --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_action.go @@ -0,0 +1,25 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL_Action) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL.Action" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalWebACL_Action) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..ef61107d1a3e --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webacl_rule.go @@ -0,0 +1,35 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACL_Rule) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACL.Rule" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalWebACL_Rule) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..7c28b42fe733 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-webaclassociation.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalWebACLAssociation) AWSCloudFormationType() string { + return "AWS::WAFRegional::WebACLAssociation" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalWebACLAssociation) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..d768c84189df --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset.go @@ -0,0 +1,126 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalXssMatchSet) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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 000000000000..c062828c3c92 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_fieldtomatch.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet_FieldToMatch) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet.FieldToMatch" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalXssMatchSet_FieldToMatch) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..b882ea69de17 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-wafregional-xssmatchset_xssmatchtuple.go @@ -0,0 +1,30 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWAFRegionalXssMatchSet_XssMatchTuple) AWSCloudFormationType() string { + return "AWS::WAFRegional::XssMatchSet.XssMatchTuple" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWAFRegionalXssMatchSet_XssMatchTuple) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..cbe7b88c680f --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/aws-workspaces-workspace.go @@ -0,0 +1,146 @@ +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"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *AWSWorkSpacesWorkspace) AWSCloudFormationType() string { + return "AWS::WorkSpaces::Workspace" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *AWSWorkSpacesWorkspace) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} + +// 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 + DeletionPolicy DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + DeletionPolicy: r._deletionPolicy, + }) +} + +// 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_definitionuri.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_definitionuri.go new file mode 100644 index 000000000000..460b6218370a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessapi_definitionuri.go @@ -0,0 +1,63 @@ +package cloudformation + +import ( + "encoding/json" + + "reflect" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessApi_DefinitionUri is a helper struct that can hold either a String or S3Location value +type AWSServerlessApi_DefinitionUri struct { + String *string + + S3Location *AWSServerlessApi_S3Location +} + +func (r AWSServerlessApi_DefinitionUri) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.S3Location != nil && !reflect.DeepEqual(r.S3Location, &AWSServerlessApi_S3Location{}) { + return r.S3Location + } + + if r.S3Location != nil { + return r.S3Location + } + + return nil + +} + +func (r AWSServerlessApi_DefinitionUri) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessApi_DefinitionUri) 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_codeuri.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_codeuri.go new file mode 100644 index 000000000000..305b25210280 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_codeuri.go @@ -0,0 +1,63 @@ +package cloudformation + +import ( + "encoding/json" + + "reflect" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_CodeUri is a helper struct that can hold either a String or S3Location value +type AWSServerlessFunction_CodeUri struct { + String *string + + S3Location *AWSServerlessFunction_S3Location +} + +func (r AWSServerlessFunction_CodeUri) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.S3Location != nil && !reflect.DeepEqual(r.S3Location, &AWSServerlessFunction_S3Location{}) { + return r.S3Location + } + + if r.S3Location != nil { + return r.S3Location + } + + return nil + +} + +func (r AWSServerlessFunction_CodeUri) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_CodeUri) 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_events.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_events.go new file mode 100644 index 000000000000..ac221fc498af --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_events.go @@ -0,0 +1,60 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_Events is a helper struct that can hold either a String or String value +type AWSServerlessFunction_Events struct { + String *string + + StringArray *[]string +} + +func (r AWSServerlessFunction_Events) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.StringArray != nil { + return r.StringArray + } + + return nil + +} + +func (r AWSServerlessFunction_Events) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_Events) 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_policies.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_policies.go new file mode 100644 index 000000000000..3eae426099c0 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_policies.go @@ -0,0 +1,82 @@ +package cloudformation + +import ( + "encoding/json" + + "reflect" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_Policies is a helper struct that can hold either a String, String, IAMPolicyDocument, or IAMPolicyDocument value +type AWSServerlessFunction_Policies struct { + String *string + + StringArray *[]string + + IAMPolicyDocument *AWSServerlessFunction_IAMPolicyDocument + + IAMPolicyDocumentArray *[]AWSServerlessFunction_IAMPolicyDocument +} + +func (r AWSServerlessFunction_Policies) value() interface{} { + + if r.String != nil { + return r.String + } + + if r.StringArray != nil { + return r.StringArray + } + + if r.IAMPolicyDocument != nil && !reflect.DeepEqual(r.IAMPolicyDocument, &AWSServerlessFunction_IAMPolicyDocument{}) { + return r.IAMPolicyDocument + } + + if r.IAMPolicyDocument != nil { + return r.IAMPolicyDocument + } + + if r.IAMPolicyDocumentArray != nil { + return r.IAMPolicyDocumentArray + } + + return nil + +} + +func (r AWSServerlessFunction_Policies) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_Policies) 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_properties.go b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_properties.go new file mode 100644 index 000000000000..4d221b84c44c --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/awsserverlessfunction_properties.go @@ -0,0 +1,153 @@ +package cloudformation + +import ( + "encoding/json" + + "reflect" + + "github.com/mitchellh/mapstructure" +) + +// AWSServerlessFunction_Properties is a helper struct that can hold either a S3Event, SNSEvent, SQSEvent, KinesisEvent, DynamoDBEvent, ApiEvent, ScheduleEvent, CloudWatchEventEvent, IoTRuleEvent, or AlexaSkillEvent value +type AWSServerlessFunction_Properties struct { + S3Event *AWSServerlessFunction_S3Event + SNSEvent *AWSServerlessFunction_SNSEvent + SQSEvent *AWSServerlessFunction_SQSEvent + KinesisEvent *AWSServerlessFunction_KinesisEvent + DynamoDBEvent *AWSServerlessFunction_DynamoDBEvent + ApiEvent *AWSServerlessFunction_ApiEvent + ScheduleEvent *AWSServerlessFunction_ScheduleEvent + CloudWatchEventEvent *AWSServerlessFunction_CloudWatchEventEvent + IoTRuleEvent *AWSServerlessFunction_IoTRuleEvent + AlexaSkillEvent *AWSServerlessFunction_AlexaSkillEvent +} + +func (r AWSServerlessFunction_Properties) value() interface{} { + + if r.S3Event != nil && !reflect.DeepEqual(r.S3Event, &AWSServerlessFunction_S3Event{}) { + return r.S3Event + } + + if r.SNSEvent != nil && !reflect.DeepEqual(r.SNSEvent, &AWSServerlessFunction_SNSEvent{}) { + return r.SNSEvent + } + + if r.SQSEvent != nil && !reflect.DeepEqual(r.SQSEvent, &AWSServerlessFunction_SQSEvent{}) { + return r.SQSEvent + } + + if r.KinesisEvent != nil && !reflect.DeepEqual(r.KinesisEvent, &AWSServerlessFunction_KinesisEvent{}) { + return r.KinesisEvent + } + + if r.DynamoDBEvent != nil && !reflect.DeepEqual(r.DynamoDBEvent, &AWSServerlessFunction_DynamoDBEvent{}) { + return r.DynamoDBEvent + } + + if r.ApiEvent != nil && !reflect.DeepEqual(r.ApiEvent, &AWSServerlessFunction_ApiEvent{}) { + return r.ApiEvent + } + + if r.ScheduleEvent != nil && !reflect.DeepEqual(r.ScheduleEvent, &AWSServerlessFunction_ScheduleEvent{}) { + return r.ScheduleEvent + } + + if r.CloudWatchEventEvent != nil && !reflect.DeepEqual(r.CloudWatchEventEvent, &AWSServerlessFunction_CloudWatchEventEvent{}) { + return r.CloudWatchEventEvent + } + + if r.IoTRuleEvent != nil && !reflect.DeepEqual(r.IoTRuleEvent, &AWSServerlessFunction_IoTRuleEvent{}) { + return r.IoTRuleEvent + } + + if r.AlexaSkillEvent != nil && !reflect.DeepEqual(r.AlexaSkillEvent, &AWSServerlessFunction_AlexaSkillEvent{}) { + return r.AlexaSkillEvent + } + + if r.S3Event != nil { + return r.S3Event + } + + if r.SNSEvent != nil { + return r.SNSEvent + } + + if r.SQSEvent != nil { + return r.SQSEvent + } + + 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_Properties) MarshalJSON() ([]byte, error) { + return json.Marshal(r.value()) +} + +// Hook into the marshaller +func (r *AWSServerlessFunction_Properties) 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.SQSEvent) + + 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/intrinsics.go b/vendor/github.com/awslabs/goformation/cloudformation/intrinsics.go new file mode 100644 index 000000000000..073f886b5093 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/intrinsics.go @@ -0,0 +1,92 @@ +package cloudformation + +import ( + "encoding/base64" + "strings" +) + +// Ref creates a CloudFormation Reference to another resource in the template +func Ref(logicalName string) string { + return encode(`{ "Ref": "` + logicalName + `" }`) +} + +// GetAtt returns the value of an attribute from a resource in the template. +func GetAtt(logicalName string, attribute string) string { + return encode(`{ "Fn::GetAtt": [ "` + logicalName + `", "` + attribute + `" ] }`) +} + +// ImportValue returns the value of an output exported by another stack. You typically use this function to create cross-stack references. In the following example template snippets, Stack A exports VPC security group values and Stack B imports them. +func ImportValue(name string) string { + return encode(`{ "Fn::ImportValue": "` + name + `" }`) +} + +// Base64 returns the Base64 representation of the input string. This function is typically used to pass encoded data to Amazon EC2 instances by way of the UserData property +func Base64(input string) string { + return encode(`{ "Fn::Base64": "` + input + `" }`) +} + +// CIDR returns an array of CIDR address blocks. The number of CIDR blocks returned is dependent on the count parameter. +func CIDR(ipBlock, count, cidrBits string) string { + return encode(`{ "Fn::Cidr" : [ "` + ipBlock + `", "` + count + `", "` + cidrBits + `" ] }`) +} + +// FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section. +func FindInMap(mapName, topLevelKey, secondLevelKey string) string { + return encode(`{ "Fn::FindInMap" : [ "` + mapName + `", "` + topLevelKey + `", "` + secondLevelKey + `" ] }`) +} + +// GetAZs returns an array that lists Availability Zones for a specified region. Because customers have access to different Availability Zones, the intrinsic function Fn::GetAZs enables template authors to write templates that adapt to the calling user's access. That way you don't have to hard-code a full list of Availability Zones for a specified region. +func GetAZs(region string) string { + return encode(`{ "Fn::GetAZs": "` + region + `" }`) +} + +// Join appends a set of values into a single value, separated by the specified delimiter. If a delimiter is the empty string, the set of values are concatenated with no delimiter. +func Join(delimiter string, values []string) string { + return encode(`{ "Fn::Join": [ "` + delimiter + `", [ "` + strings.Trim(strings.Join(values, `", "`), `, "`) + `" ] ] }`) +} + +// Select returns a single object from a list of objects by index. +func Select(index string, list []string) string { + return encode(`{ "Fn::Select": [ "` + index + `", [ "` + strings.Trim(strings.Join(list, `", "`), `, "`) + `" ] ] }`) +} + +// Split splits a string into a list of string values so that you can select an element from the resulting string list, use the Fn::Split intrinsic function. Specify the location of splits with a delimiter, such as , (a comma). After you split a string, use the Fn::Select function to pick a specific element. +func Split(delimiter, source string) string { + return encode(`{ "Fn::Split" : [ "` + delimiter + `", "` + source + `" ] }`) +} + +// Sub substitutes variables in an input string with values that you specify. In your templates, you can use this function to construct commands or outputs that include values that aren't available until you create or update a stack. +func Sub(value string) string { + return encode(`{ "Fn::Sub" : "` + value + `" }`) +} + +// And returns true if all the specified conditions evaluate to true, or returns false if any one of the conditions evaluates to false. Fn::And acts as an AND operator. The minimum number of conditions that you can include is 2, and the maximum is 10. +func And(conditions []string) string { + return encode(`{ "Fn::And": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`) +} + +// Equals compares if two values are equal. Returns true if the two values are equal or false if they aren't. +func Equals(value1, value2 string) string { + return encode(`{ "Fn::Equals" : [ "` + value1 + `", "` + value2 + `" ] }`) +} + +// If returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false. Currently, AWS CloudFormation supports the Fn::If intrinsic function in the metadata attribute, update policy attribute, and property values in the Resources section and Outputs sections of a template. You can use the AWS::NoValue pseudo parameter as a return value to remove the corresponding property. +func If(value, ifEqual, ifNotEqual string) string { + return encode(`{ "Fn::If" : [ "` + value + `", "` + ifEqual + `", "` + ifNotEqual + `" ] }`) +} + +// Not returns true for a condition that evaluates to false or returns false for a condition that evaluates to true. Fn::Not acts as a NOT operator. +func Not(conditions []string) string { + return encode(`{ "Fn::Not": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`) +} + +// Or returns true if any one of the specified conditions evaluate to true, or returns false if all of the conditions evaluates to false. Fn::Or acts as an OR operator. The minimum number of conditions that you can include is 2, and the maximum is 10. +func Or(conditions []string) string { + return encode(`{ "Fn::Or": [ "` + strings.Trim(strings.Join(conditions, `", "`), `, "`) + `" ] }`) +} + +// encode takes a string representation of an intrinsic function, and base64 encodes it. +// This prevents the escaping issues when nesting multiple layers of intrinsic functions. +func encode(value string) string { + return base64.StdEncoding.EncodeToString([]byte(value)) +} diff --git a/vendor/github.com/awslabs/goformation/cloudformation/policies.go b/vendor/github.com/awslabs/goformation/cloudformation/policies.go new file mode 100644 index 000000000000..e3199e6fc34a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/policies.go @@ -0,0 +1,110 @@ +package cloudformation + +// CreationPolicy prevents a resource status from reaching create complete until AWS CloudFormation receives a specified number of success signals or the timeout period is exceeded. To signal a resource, you can use the cfn-signal helper script or SignalResource API. AWS CloudFormation publishes valid signals to the stack events so that you track the number of signals sent. +type CreationPolicy struct { + + // AutoScalingCreationPolicy specifies how many instances must signal success for the update to succeed. + AutoScalingCreationPolicy *AutoScalingCreationPolicy `json:"AutoScalingCreationPolicy,omitempty"` + + // ResourcesSignal configures the number of required success signals and the length of time that AWS CloudFormation waits for those signals. + ResourcesSignal *ResourcesSignal `json:"ResourcesSignal,omitempty"` +} + +// AutoScalingCreationPolicy specifies how many instances must signal success for the update to succeed. +type AutoScalingCreationPolicy struct { + + // MinSuccessfulInstancesPercent specifies the percentage of instances in an Auto Scaling replacement update that must signal success for the update to succeed. You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent. For example, if you update five instances with a minimum successful percentage of 50, three instances must signal success. If an instance doesn't send a signal within the time specified by the Timeout property, AWS CloudFormation assumes that the instance wasn't created. + MinSuccessfulInstancesPercent float64 `json:"MinSuccessfulInstancesPercent,omitempty"` +} + +// ResourcesSignal configures the number of required success signals and the length of time that AWS CloudFormation waits for those signals. +type ResourcesSignal struct { + + // Count is the number of success signals AWS CloudFormation must receive before it sets the resource status as CREATE_COMPLETE. If the resource receives a failure signal or doesn't receive the specified number of signals before the timeout period expires, the resource creation fails and AWS CloudFormation rolls the stack back. + Count float64 `json:"Count,omitempty"` + + // Timeout is the length of time that AWS CloudFormation waits for the number of signals that was specified in the Count property. The timeout period starts after AWS CloudFormation starts creating the resource, and the timeout expires no sooner than the time you specify but can occur shortly thereafter. The maximum time that you can specify is 12 hours. + // The value must be in ISO8601 duration format, in the form: "PT#H#M#S", where each # is the number of hours, minutes, and seconds, respectively. For best results, specify a period of time that gives your instances plenty of time to get up and running. A shorter timeout can cause a rollback. + Timeout string `json:"Timeout,omitempty"` +} + +// DeletionPolicy can preserve or (in some cases) backup a resource when its stack is deleted. You specify a DeletionPolicy attribute for each resource that you want to control. If a resource has no DeletionPolicy attribute, AWS CloudFormation deletes the resource by default. +// Either "Delete", "Retain" or "Snapshot". +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +type DeletionPolicy string + +// UpdatePolicy specifies how AWS CloudFormation handles updates to the AWS::AutoScaling::AutoScalingGroup or AWS::Lambda::Alias resource. +// For AWS::AutoScaling::AutoScalingGroup resources, AWS CloudFormation invokes one of three update policies depending on the type of change you make or whether a scheduled action is associated with the Auto Scaling group. +// The AutoScalingReplacingUpdate and AutoScalingRollingUpdate policies apply only when you do one or more of the following: +// - Change the Auto Scaling group's AWS::AutoScaling::LaunchConfiguration. +// - Change the Auto Scaling group's VPCZoneIdentifier property +// - Change the Auto Scaling group's LaunchTemplate property +// - Update an Auto Scaling group that contains instances that don't match the current LaunchConfiguration. +// If both the AutoScalingReplacingUpdate and AutoScalingRollingUpdate policies are specified, setting the WillReplace property to true gives AutoScalingReplacingUpdate precedence. +// The AutoScalingScheduledAction policy applies when you update a stack that includes an Auto Scaling group with an associated scheduled action. +// For AWS::Lambda::Alias resources, AWS CloudFormation performs an AWS CodeDeploy deployment when the version changes on the alias. For more information, see CodeDeployLambdaAliasUpdate Policy. +type UpdatePolicy struct { + + // AutoScalingReplacingUpdate specifies whether AWS CloudFormation replaces an Auto Scaling group with a new one or replaces only the instances in the Auto Scaling group. + AutoScalingReplacingUpdate *AutoScalingReplacingUpdate `json:"AutoScalingReplacingUpdate,omitempty"` + + // AutoScalingRollingUpdate enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling group in batches or all at once. + AutoScalingRollingUpdate *AutoScalingRollingUpdate `json:"AutoScalingRollingUpdate,omitempty"` + + // AutoScalingScheduledAction specifies how AWS CloudFormation handles updates for the MinSize, MaxSize, and DesiredCapacity properties when the AWS::AutoScaling::AutoScalingGroup resource has an associated scheduled action. + AutoScalingScheduledAction *AutoScalingScheduledAction `json:"AutoScalingScheduledAction,omitempty"` + + // CodeDeployLambdaAliasUpdate performs an AWS CodeDeploy deployment when the version changes on an AWS::Lambda::Alias resource. + CodeDeployLambdaAliasUpdate *CodeDeployLambdaAliasUpdate `json:"CodeDeployLambdaAliasUpdate,omitempty"` +} + +// AutoScalingScheduledAction specifies how AWS CloudFormation handles updates for the MinSize, MaxSize, and DesiredCapacity properties when the AWS::AutoScaling::AutoScalingGroup resource has an associated scheduled action, use the AutoScalingScheduledAction policy. +// With scheduled actions, the group size properties of an Auto Scaling group can change at any time. When you update a stack with an Auto Scaling group and scheduled action, AWS CloudFormation always sets the group size property values of your Auto Scaling group to the values that are defined in the AWS::AutoScaling::AutoScalingGroup resource of your template, even if a scheduled action is in effect. +// If you do not want AWS CloudFormation to change any of the group size property values when you have a scheduled action in effect, use the AutoScalingScheduledAction update policy to prevent AWS CloudFormation from changing the MinSize, MaxSize, or DesiredCapacity properties unless you have modified these values in your template. +type AutoScalingScheduledAction struct { + // Specifies whether AWS CloudFormation ignores differences in group size properties between your current Auto Scaling group and the Auto Scaling group described in the AWS::AutoScaling::AutoScalingGroup resource of your template during a stack update. If you modify any of the group size property values in your template, AWS CloudFormation uses the modified values and updates your Auto Scaling group. (default: false) + IgnoreUnmodifiedGroupSizeProperties bool `json:"IgnoreUnmodifiedGroupSizeProperties,omitempty"` +} + +// AutoScalingReplacingUpdate specifies whether AWS CloudFormation replaces an Auto Scaling group with a new one or replaces only the instances in the Auto Scaling group. +type AutoScalingReplacingUpdate struct { + WillReplace bool `json:"WillReplace,omitempty"` +} + +// AutoScalingRollingUpdate enable you to specify whether AWS CloudFormation updates instances that are in an Auto Scaling group in batches or all at once. +type AutoScalingRollingUpdate struct { + + // MaxBatchSize specifies the maximum number of instances that AWS CloudFormation updates. + MaxBatchSize float64 `json:"MaxBatchSize,omitempty"` + + // MinInstancesInService specifies the minimum number of instances that must be in service within the Auto Scaling group while AWS CloudFormation updates old instances. + MinInstancesInService float64 `json:"MinInstancesInService,omitempty"` + + // MinSuccessfulInstancesPercent specifies the percentage of instances in an Auto Scaling rolling update that must signal success for an update to succeed. You can specify a value from 0 to 100. AWS CloudFormation rounds to the nearest tenth of a percent. For example, if you update five instances with a minimum successful percentage of 50, three instances must signal success. + MinSuccessfulInstancesPercent float64 `json:"MinSuccessfulInstancesPercent,omitempty"` + + // PauseTime is the amount of time that AWS CloudFormation pauses after making a change to a batch of instances to give those instances time to start software applications. For example, you might need to specify PauseTime when scaling up the number of instances in an Auto Scaling group. + PauseTime string `json:"PauseTime,omitempty"` + + // SuspendProcesses specifies the Auto Scaling processes to suspend during a stack update. Suspending processes prevents Auto Scaling from interfering with a stack update. For example, you can suspend alarming so that Amazon EC2 Auto Scaling doesn't execute scaling policies associated with an alarm. For valid values, see the ScalingProcesses.member.N parameter for the SuspendProcesses action in the Amazon EC2 Auto Scaling API Reference. + SuspendProcesses []string `json:"SuspendProcesses,omitempty"` + + // WaitOnResourceSignals specifies whether the Auto Scaling group waits on signals from new instances during an update. Use this property to ensure that instances have completed installing and configuring applications before the Auto Scaling group update proceeds. AWS CloudFormation suspends the update of an Auto Scaling group after new EC2 instances are launched into the group. AWS CloudFormation must receive a signal from each new instance within the specified PauseTime before continuing the update. To signal the Auto Scaling group, use the cfn-signal helper script or SignalResource API. + WaitOnResourceSignals bool `json:"WaitOnResourceSignals,omitempty"` +} + +// CodeDeployLambdaAliasUpdate performs an AWS CodeDeploy deployment when the version changes on an AWS::Lambda::Alias resource. +type CodeDeployLambdaAliasUpdate struct { + + // AfterAllowTrafficHook is the name of the Lambda function to run after traffic routing completes. + AfterAllowTrafficHook string `json:"AfterAllowTrafficHook,omitempty"` + + // ApplicationName is the name of the AWS CodeDeploy application. + ApplicationName string `json:"ApplicationName"` + + // BeforeAllowTrafficHook is the name of the Lambda function to run before traffic routing starts. + BeforeAllowTrafficHook string `json:"BeforeAllowTrafficHook,omitempty"` + + // DeploymentGroupName is the name of the AWS CodeDeploy deployment group. This is where the traffic-shifting policy is set. + DeploymentGroupName string `json:"DeploymentGroupName"` +} 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 000000000000..8adb3b610de3 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/tag.go @@ -0,0 +1,30 @@ +package cloudformation + +// Tag AWS CloudFormation Resource (Tag) +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-tag.html +type Tag struct { + + // Key AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-tag.html#cfn-dms-endpoint-tag-key + Key string `json:"Key,omitempty"` + + // Value AWS CloudFormation Property + // Required: false + // See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dms-endpoint-tag.html#cfn-dms-endpoint-tag-value + Value string `json:"Value,omitempty"` + + // _deletionPolicy represents a CloudFormation DeletionPolicy + _deletionPolicy DeletionPolicy +} + +// AWSCloudFormationType returns the AWS CloudFormation resource type +func (r *Tag) AWSCloudFormationType() string { + return "Tag" +} + +// SetDeletionPolicy applies an AWS CloudFormation DeletionPolicy to this resource +// see: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html +func (r *Tag) SetDeletionPolicy(policy DeletionPolicy) { + r._deletionPolicy = policy +} 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 000000000000..1627fbcf0dd5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/cloudformation/template.go @@ -0,0 +1,100 @@ +package cloudformation + +import ( + "encoding/json" + + "github.com/awslabs/goformation/intrinsics" + "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"` + Transform *Transform `json:"Transform,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"` +} + +type Transform struct { + String *string + + StringArray *[]string +} + +func (t Transform) value() interface{} { + if t.String != nil { + return t.String + } + + if t.StringArray != nil { + return t.StringArray + } + + return nil +} + +func (t *Transform) MarshalJSON() ([]byte, error) { + return json.Marshal(t.value()) +} + +func (t *Transform) UnmarshalJSON(b []byte) error { + var typecheck interface{} + if err := json.Unmarshal(b, &typecheck); err != nil { + return err + } + + switch val := typecheck.(type) { + + case string: + t.String = &val + + case []string: + t.StringArray = &val + } + + return nil +} + +// 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) { + + j, err := json.MarshalIndent(t, "", " ") + if err != nil { + return nil, err + } + + return intrinsics.ProcessJSON(j, nil) + +} + +// YAML converts an AWS CloudFormation template object to YAML +func (t *Template) YAML() ([]byte, error) { + + j, err := t.JSON() + if err != nil { + return nil, err + } + + return yaml.JSONToYAML(j) + +} diff --git a/vendor/github.com/awslabs/goformation/go.mod b/vendor/github.com/awslabs/goformation/go.mod new file mode 100644 index 000000000000..e577dd531391 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/go.mod @@ -0,0 +1,24 @@ +module github.com/awslabs/goformation + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/golang/protobuf v1.2.0 // indirect + github.com/imdario/mergo v0.3.6 + github.com/johandorland/gojsonschema v0.0.0-20180719132039-b84684d0e066 + github.com/kr/pretty v0.1.0 // indirect + github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 + github.com/onsi/ginkgo v0.0.0-20170725030731-8382b23d18db + github.com/onsi/gomega v1.2.0 + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b + github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522 + github.com/stretchr/testify v1.2.2 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20170225233418-6fe8760cad35 // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c // indirect + golang.org/x/net v0.0.0-20170809000501-1c05540f6879 // indirect + golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect + golang.org/x/sys v0.0.0-20170814044513-c84c1ab9fd18 // indirect + golang.org/x/text v0.0.0-20170814122439-e56139fd9c5b // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 // indirect +) diff --git a/vendor/github.com/awslabs/goformation/go.sum b/vendor/github.com/awslabs/goformation/go.sum new file mode 100644 index 000000000000..299fedf0b6da --- /dev/null +++ b/vendor/github.com/awslabs/goformation/go.sum @@ -0,0 +1,43 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/johandorland/gojsonschema v0.0.0-20180719132039-b84684d0e066 h1:d2QKbHdBilDdP1nyjMIbyWagRfxMFp/GIkQzVpKBLCc= +github.com/johandorland/gojsonschema v0.0.0-20180719132039-b84684d0e066/go.mod h1:1mXKyf/dupYvz1W9cGLRYOZZnUQA0ojA/LWa4/tldo8= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992 h1:W7VHAEVflA5/eTyRvQ53Lz5j8bhRd1myHZlI/IZFvbU= +github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/onsi/ginkgo v0.0.0-20170725030731-8382b23d18db h1:mKkgCNWK6fOpoK9Fjhh/++dCbxcUKHRPLUUhG+xSZbY= +github.com/onsi/ginkgo v0.0.0-20170725030731-8382b23d18db/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.2.0 h1:tQjc4uvqBp0z424R9V/S2L18penoUiwZftoY0t48IZ4= +github.com/onsi/gomega v1.2.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b h1:jUK33OXuZP/l6babJtnLo1qsGvq6G9so9KMflGAm4YA= +github.com/sanathkr/go-yaml v0.0.0-20170819195128-ed9d249f429b/go.mod h1:8458kAagoME2+LN5//WxE71ysZ3B7r22fdgb7qVmXSY= +github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522 h1:fOCp11H0yuyAt2wqlbJtbyPzSgaxHTv8uN1pMpkG1t8= +github.com/sanathkr/yaml v0.0.0-20170819201035-0056894fa522/go.mod h1:tQTYKOQgxoH3v6dEmdHiz4JG+nbxWwM5fgPQUpSZqVQ= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/xeipuuv/gojsonpointer v0.0.0-20170225233418-6fe8760cad35 h1:0TnXeVP6mx+A4CBf8cQVkQfkhyGBQCmJcT4g6zKzm7M= +github.com/xeipuuv/gojsonpointer v0.0.0-20170225233418-6fe8760cad35/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c h1:XZWnr3bsDQWAZg4Ne+cPoXRPILrNlPNQfxBuwLl43is= +github.com/xeipuuv/gojsonreference v0.0.0-20150808065054-e02fc20de94c/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +golang.org/x/net v0.0.0-20170809000501-1c05540f6879 h1:0rFa7EaCGdQPmZVbo9F7MNF65b8dyzS6EUnXjs9Cllk= +golang.org/x/net v0.0.0-20170809000501-1c05540f6879/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20170814044513-c84c1ab9fd18 h1:IoiXxANYbZRybSGnlkI5TZv53JFaYJACyByrcuQnzSk= +golang.org/x/sys v0.0.0-20170814044513-c84c1ab9fd18/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.0.0-20170814122439-e56139fd9c5b h1:9VCMGrhGmWCfBKMKtwYJ46kFshzRNQ29xaLeEajknQw= +golang.org/x/text v0.0.0-20170814122439-e56139fd9c5b/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7 h1:+t9dhfO+GNOIGJof6kPOAenx7YgrZMTdRPV+EsnPabk= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= diff --git a/vendor/github.com/awslabs/goformation/goformation.go b/vendor/github.com/awslabs/goformation/goformation.go new file mode 100644 index 000000000000..589f31ce082a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/goformation.go @@ -0,0 +1,84 @@ +package goformation + +import ( + "encoding/json" + "io/ioutil" + "strings" + + "github.com/awslabs/goformation/cloudformation" + "github.com/awslabs/goformation/intrinsics" +) + +//go:generate generate/generate.sh + +// Open and parse a AWS CloudFormation template from file. +// Works with either JSON or YAML formatted templates. +func Open(filename string) (*cloudformation.Template, error) { + return OpenWithOptions(filename, nil) +} + +// OpenWithOptions opens and parse a AWS CloudFormation template from file. +// Works with either JSON or YAML formatted templates. +// Parsing can be tweaked via the specified options. +func OpenWithOptions(filename string, options *intrinsics.ProcessorOptions) (*cloudformation.Template, error) { + + data, err := ioutil.ReadFile(filename) + if err != nil { + return nil, err + } + + if strings.HasSuffix(filename, ".yaml") || strings.HasSuffix(filename, ".yml") { + return ParseYAMLWithOptions(data, options) + } + + return ParseJSONWithOptions(data, options) + +} + +// ParseYAML an AWS CloudFormation template (expects a []byte of valid YAML) +func ParseYAML(data []byte) (*cloudformation.Template, error) { + return ParseYAMLWithOptions(data, nil) +} + +// ParseYAMLWithOptions an AWS CloudFormation template (expects a []byte of valid YAML) +// Parsing can be tweaked via the specified options. +func ParseYAMLWithOptions(data []byte, options *intrinsics.ProcessorOptions) (*cloudformation.Template, error) { + // Process all AWS CloudFormation intrinsic functions (e.g. Fn::Join) + intrinsified, err := intrinsics.ProcessYAML(data, options) + if err != nil { + return nil, err + } + + return unmarshal(intrinsified) + +} + +// ParseJSON an AWS CloudFormation template (expects a []byte of valid JSON) +func ParseJSON(data []byte) (*cloudformation.Template, error) { + return ParseJSONWithOptions(data, nil) +} + +// ParseJSONWithOptions an AWS CloudFormation template (expects a []byte of valid JSON) +// Parsing can be tweaked via the specified options. +func ParseJSONWithOptions(data []byte, options *intrinsics.ProcessorOptions) (*cloudformation.Template, error) { + + // Process all AWS CloudFormation intrinsic functions (e.g. Fn::Join) + intrinsified, err := intrinsics.ProcessJSON(data, options) + if err != nil { + return nil, err + } + + return unmarshal(intrinsified) + +} + +func unmarshal(data []byte) (*cloudformation.Template, error) { + + template := &cloudformation.Template{} + if err := json.Unmarshal(data, template); err != nil { + return nil, err + } + + return template, nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/conditions.go b/vendor/github.com/awslabs/goformation/intrinsics/conditions.go new file mode 100644 index 000000000000..65bddfdcbd37 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/conditions.go @@ -0,0 +1,65 @@ +package intrinsics + +// condition evaluates a condition +func condition(name string, input interface{}, template interface{}, options *ProcessorOptions) interface{} { + if v, ok := input.(string); ok { + + if v, ok := retrieveCondition(input, template); ok { + return v + } + + if c := getCondition(v, template); c != nil { + res := search(c, template, options) + // replace the value in the template so the value can be reused + setCondition(v, res, template) + + return res + } + } + + return nil +} + +func setCondition(name string, val interface{}, template interface{}) { + if template, ok := template.(map[string]interface{}); ok { + // Check there is a conditions section + if uconditions, ok := template["Conditions"]; ok { + // Check the conditions section is a map + if conditions, ok := uconditions.(map[string]interface{}); ok { + // Check there is a condition with the same name as the condition + if _, ok := conditions[name]; ok { + conditions[name] = val + } + } + } + } +} + +func getCondition(name string, template interface{}) interface{} { + if template, ok := template.(map[string]interface{}); ok { + // Check there is a conditions section + if uconditions, ok := template["Conditions"]; ok { + // Check the conditions section is a map + if conditions, ok := uconditions.(map[string]interface{}); ok { + // Check there is a condition with the same name as the condition + if ucondition, ok := conditions[name]; ok { + return ucondition + } + } + } + } + + return nil +} + +func retrieveCondition(cName interface{}, template interface{}) (value bool, found bool) { + + switch v := cName.(type) { + case string: + value, found = getCondition(v, template).(bool) + case bool: + value, found = v, true + } + + return +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnand.go b/vendor/github.com/awslabs/goformation/intrinsics/fnand.go new file mode 100644 index 000000000000..cc18ccc52dcf --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnand.go @@ -0,0 +1,28 @@ +package intrinsics + +// FnAnd resolves the 'Fn::And' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-and +func FnAnd(name string, input interface{}, template interface{}) interface{} { + // "Fn::And": [{condition}, ...] + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + if len(arr) < 2 || len(arr) > 10 { + return nil + } + + for _, c := range arr { + if value, ok := retrieveCondition(c, template); ok { + if !value { + return false + } + } else { + return nil + } + } + + return true + } + + return 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 000000000000..e24ecc24179d --- /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/fnequals.go b/vendor/github.com/awslabs/goformation/intrinsics/fnequals.go new file mode 100644 index 000000000000..b3c48455c2f4 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnequals.go @@ -0,0 +1,22 @@ +package intrinsics + +import ( + "reflect" +) + +// FnEquals resolves the 'Fn::Equals' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-equals +func FnEquals(name string, input interface{}, template interface{}) interface{} { + // "Fn::Equals" : ["value_1", "value_2"] + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + if len(arr) != 2 { + return nil + } + + return reflect.DeepEqual(arr[0], arr[1]) + } + + 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 000000000000..29f98a9f19e4 --- /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 000000000000..d7f64e00e357 --- /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/fngetazs.go b/vendor/github.com/awslabs/goformation/intrinsics/fngetazs.go new file mode 100644 index 000000000000..034259fc87b7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fngetazs.go @@ -0,0 +1,36 @@ +package intrinsics + +var AZs map[string][]interface{} = make(map[string][]interface{}) + +func buildAZs(region string, zones ...string) (result []interface{}) { + for _, zone := range zones { + result = append(result, region+zone) + } + return +} + +func init() { + AZs["us-east-1"] = buildAZs("us-east-1", "a", "b", "c", "d") + AZs["us-west-1"] = buildAZs("us-west-1", "a", "b") +} + +// FnGetAZs resolves the 'Fn::GetAZs' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getavailabilityzones.html +func FnGetAZs(name string, input interface{}, template interface{}) interface{} { + + // Check the input is a string + if region, ok := input.(string); ok { + if region == "" { + region = "us-east-1" + } + + if azs, ok := AZs[region]; ok { + return azs + } else { + //assume 3 AZs per region + return buildAZs(region, "a", "b", "c") + } + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnif.go b/vendor/github.com/awslabs/goformation/intrinsics/fnif.go new file mode 100644 index 000000000000..985f0b561d06 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnif.go @@ -0,0 +1,25 @@ +package intrinsics + +// FnIf resolves the 'Fn::If' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-if +func FnIf(name string, input interface{}, template interface{}) interface{} { + + // "Fn::If": [condition_name, value_if_true, value_if_false] + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + if len(arr) != 3 { + return nil + } + + if value, ok := retrieveCondition(arr[0], template); ok { + if value { + return arr[1] + } else { + return arr[2] + } + } + } + + 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 000000000000..51c915e8ca6a --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnjoin.go @@ -0,0 +1,63 @@ +package intrinsics + +import ( + "strings" +) + +// 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{} { + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + + switch len(arr) { + case 0: + return nil + case 1: + return arr[0] + default: + + // Fn::Join can be used with a delimeter and an array of parts, like so: + // "Fn::Join": ["," [ "apples", "pears" ]] + // Or it can be used without a delimiter, and just join the contents + // "Fn::Join": ["apples", "pears"] + // Check if the 2nd element of the array is an array, if so, use the first element as the delimiter + + delim := "" + parts := []string{} + for i, value := range arr { + + if i == 0 { + // If the second element is not a string (and is an array), use this first element as a delimiter + if _, ok := arr[i+1].([]interface{}); ok { + if d, ok := value.(string); ok { + delim = d + continue + } + } + } + + switch v := value.(type) { + case string: + // This element is a string; add it to the array of parts that need joining + parts = append(parts, v) + case []interface{}: + // This element is an array; check if it contains strings and add them to the array of parts that need joining + for _, subvalue := range v { + if str, ok := subvalue.(string); ok { + parts = append(parts, str) + } + } + } + + } + + return strings.Join(parts, delim) + + } + } + + return nil + +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnnot.go b/vendor/github.com/awslabs/goformation/intrinsics/fnnot.go new file mode 100644 index 000000000000..78e8e23029f2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnnot.go @@ -0,0 +1,20 @@ +package intrinsics + +// FnNot resolves the 'Fn::Not' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-not +func FnNot(name string, input interface{}, template interface{}) interface{} { + // "Fn::Not": [{condition}] + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + if len(arr) != 1 { + return nil + } + + if value, ok := retrieveCondition(arr[0], template); ok { + return !value + } + } + + return nil +} diff --git a/vendor/github.com/awslabs/goformation/intrinsics/fnor.go b/vendor/github.com/awslabs/goformation/intrinsics/fnor.go new file mode 100644 index 000000000000..3b0d505daed7 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnor.go @@ -0,0 +1,28 @@ +package intrinsics + +// FnOr resolves the 'Fn::Or' AWS CloudFormation intrinsic function. +// See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-or +func FnOr(name string, input interface{}, template interface{}) interface{} { + // "Fn::Or": [{condition}, ...] + + // Check the input is an array + if arr, ok := input.([]interface{}); ok { + if len(arr) < 2 || len(arr) > 10 { + return nil + } + + for _, c := range arr { + if value, ok := retrieveCondition(c, template); ok { + if value { + return true + } + } else { + return nil + } + } + + return false + } + + return nil +} 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 000000000000..b6c56a8db4b9 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnselect.go @@ -0,0 +1,37 @@ +package intrinsics + +import "strconv" + +// 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 + var index int + if index64, ok := arr[0].(float64); ok { + index = int(index64) + } else if indexStr, ok := arr[0].(string); ok { + if c, err := strconv.Atoi(indexStr); err == nil { + index = c + } else { + return nil + } + } else { + return nil + } + + // 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 +} 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 000000000000..64699f8a2c5c --- /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 000000000000..8e46e8e48a67 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/fnsub.go @@ -0,0 +1,73 @@ +package intrinsics + +import ( + "encoding/base64" + "regexp" + "strings" +) + +// ResolveFnSub 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 + +} + +// NewSub substitutes variables in an input string with values that you specify. In your templates, you can use this function to construct commands or outputs that include values that aren't available until you create or update a stack. +func Sub(value string) string { + i := `{ "Fn::Sub" : "` + value + `" }` + return base64.StdEncoding.EncodeToString([]byte(i)) +} 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 000000000000..bcda5910b9b5 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/intrinsics/intrinsics.go @@ -0,0 +1,295 @@ +package intrinsics + +import ( + "encoding/base64" + "encoding/json" + "fmt" + + "github.com/imdario/mergo" + 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": FnAnd, + "Fn::Equals": FnEquals, + "Fn::If": FnIf, + "Fn::Not": FnNot, + "Fn::Or": FnOr, + "Fn::FindInMap": FnFindInMap, + "Fn::GetAtt": nonResolvingHandler, + "Fn::GetAZs": FnGetAZs, + "Fn::ImportValue": nonResolvingHandler, + "Fn::Join": FnJoin, + "Fn::Select": FnSelect, + "Fn::Split": FnSplit, + "Fn::Sub": FnSub, + "Ref": Ref, + "Fn::Cidr": nonResolvingHandler, +} + +// ProcessorOptions allows customisation of the intrinsic function processor behaviour. +// Initially, this only allows overriding of the handlers for each intrinsic function type +// and overriding template paramters. +type ProcessorOptions struct { + IntrinsicHandlerOverrides map[string]IntrinsicHandler + ParameterOverrides map[string]interface{} +} + +// 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) + } + + applyGlobals(unmarshalled, options) + + overrideParameters(unmarshalled, options) + + evaluateConditions(unmarshalled, options) + + // 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 +} + +// overrideParameters replaces the default values of Parameters with the specified ones +func overrideParameters(input interface{}, options *ProcessorOptions) { + if options == nil || len(options.ParameterOverrides) == 0 { + return + } + + // Check the template is a map + if template, ok := input.(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 { + for name, value := range options.ParameterOverrides { + // 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 { + // Set the default value + parameter["Default"] = value + } + } + } + } + } + } +} + +var supportedGlobalResources = map[string]string{ + "Function": "AWS::Serverless::Function", + "Api": "AWS::Serverless::Api", +} + +// applyGlobals adds AWS SAM Globals into resources +func applyGlobals(input interface{}, options *ProcessorOptions) { + if template, ok := input.(map[string]interface{}); ok { + if uglobals, ok := template["Globals"]; ok { + if globals, ok := uglobals.(map[string]interface{}); ok { + for name, globalValues := range globals { + for supportedGlobalName, supportedGlobalType := range supportedGlobalResources { + if name == supportedGlobalName { + if uresources, ok := template["Resources"]; ok { + if resources, ok := uresources.(map[string]interface{}); ok { + for _, uresource := range resources { + if resource, ok := uresource.(map[string]interface{}); ok { + if resource["Type"] == supportedGlobalType { + properties := resource["Properties"].(map[string]interface{}) + for globalProp, globalPropValue := range globalValues.(map[string]interface{}) { + if _, ok := properties[globalProp]; !ok { + properties[globalProp] = globalPropValue + } else if gArray, ok := globalPropValue.([]interface{}); ok { + if pArray, ok := properties[globalProp].([]interface{}); ok { + properties[globalProp] = append(pArray, gArray...) + } + } else if gMap, ok := globalPropValue.(map[string]interface{}); ok { + if pMap, ok := properties[globalProp].(map[string]interface{}); ok { + mergo.Merge(&pMap, gMap) + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// evaluateConditions replaces each condition in the template with its corresponding +// value +func evaluateConditions(input interface{}, options *ProcessorOptions) { + if template, ok := input.(map[string]interface{}); ok { + // Check there is a conditions section + if uconditions, ok := template["Conditions"]; ok { + // Check the conditions section is a map + if conditions, ok := uconditions.(map[string]interface{}); ok { + for name, expr := range conditions { + conditions[name] = search(expr, input, options) + } + } + } + } +} + +// 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) + } + + if key == "Condition" { + // This can lead to infinite recursion A -> B; B -> A; + // pass state of the conditions that we're evaluating so we can detect cycles + // in case of cycle, return nil + return condition(key, search(val, template, options), template, options) + } + + // 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: + + // Check if the string can be unmarshalled into an intrinsic object + var decoded []byte + decoded, err := base64.StdEncoding.DecodeString(value) + if err != nil { + // The string value is not base64 encoded, so it's not an intrinsic so just pass it back + return value + } + + var intrinsic map[string]interface{} + if err := json.Unmarshal([]byte(decoded), &intrinsic); err != nil { + // The string value is not JSON, so it's not an intrinsic so just pass it back + return value + } + + // An intrinsic should be an object, with a single key containing a valid intrinsic name + if len(intrinsic) != 1 { + return value + } + + for key, val := range intrinsic { + // See if this is a valid intrinsic function, by comparing the name with our list of registered handlers + if _, ok := handler(key, options); ok { + return map[string]interface{}{ + key: search(val, template, options), + } + } + } + + 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 000000000000..6310efd99df1 --- /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 000000000000..e153b7aca89b --- /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/test.go b/vendor/github.com/awslabs/goformation/test.go new file mode 100644 index 000000000000..1f2eb8e7d5f2 --- /dev/null +++ b/vendor/github.com/awslabs/goformation/test.go @@ -0,0 +1 @@ +package goformation diff --git a/vendor/github.com/go-ini/ini/LICENSE b/vendor/github.com/go-ini/ini/LICENSE new file mode 100644 index 000000000000..d361bbcdf5c9 --- /dev/null +++ b/vendor/github.com/go-ini/ini/LICENSE @@ -0,0 +1,191 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor 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, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise complies +with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted +for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the terms of +any separate license agreement you may have executed with Licensor regarding +such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, +service marks, or product names of the Licensor, except as required for +reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the +Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, +including, without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are +solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise of +permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License or +out of the use or inability to use the Work (including but not limited to +damages for loss of goodwill, work stoppage, computer failure or malfunction, or +any and all other commercial damages or losses), even if such Contributor has +been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to +offer, and charge a fee for, acceptance of support, warranty, indemnity, or +other liability obligations and/or rights consistent with this License. However, +in accepting such obligations, You may act only on Your own behalf and on Your +sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + + Copyright 2014 Unknwon + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-ini/ini/Makefile b/vendor/github.com/go-ini/ini/Makefile new file mode 100644 index 000000000000..af27ff0768fa --- /dev/null +++ b/vendor/github.com/go-ini/ini/Makefile @@ -0,0 +1,15 @@ +.PHONY: build test bench vet coverage + +build: vet bench + +test: + go test -v -cover -race + +bench: + go test -v -cover -race -test.bench=. -test.benchmem + +vet: + go vet + +coverage: + go test -coverprofile=c.out && go tool cover -html=c.out && rm c.out diff --git a/vendor/github.com/go-ini/ini/README.md b/vendor/github.com/go-ini/ini/README.md new file mode 100644 index 000000000000..ae4dfc3a5a82 --- /dev/null +++ b/vendor/github.com/go-ini/ini/README.md @@ -0,0 +1,46 @@ +INI [![Build Status](https://travis-ci.org/go-ini/ini.svg?branch=master)](https://travis-ci.org/go-ini/ini) [![Sourcegraph](https://img.shields.io/badge/view%20on-Sourcegraph-brightgreen.svg)](https://sourcegraph.com/github.com/go-ini/ini) +=== + +![](https://avatars0.githubusercontent.com/u/10216035?v=3&s=200) + +Package ini provides INI file read and write functionality in Go. + +## Features + +- Load from multiple data sources(`[]byte`, file and `io.ReadCloser`) with overwrites. +- Read with recursion values. +- Read with parent-child sections. +- Read with auto-increment key names. +- Read with multiple-line values. +- Read with tons of helper methods. +- Read and convert values to Go types. +- Read and **WRITE** comments of sections and keys. +- Manipulate sections, keys and comments with ease. +- Keep sections and keys in order as you parse and save. + +## Installation + +The minimum requirement of Go is **1.6**. + +To use a tagged revision: + +```sh +$ go get gopkg.in/ini.v1 +``` + +To use with latest changes: + +```sh +$ go get github.com/go-ini/ini +``` + +Please add `-u` flag to update in the future. + +## Getting Help + +- [Getting Started](https://ini.unknwon.io/docs/intro/getting_started) +- [API Documentation](https://gowalker.org/gopkg.in/ini.v1) + +## License + +This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text. diff --git a/vendor/github.com/go-ini/ini/error.go b/vendor/github.com/go-ini/ini/error.go new file mode 100644 index 000000000000..80afe7431584 --- /dev/null +++ b/vendor/github.com/go-ini/ini/error.go @@ -0,0 +1,32 @@ +// Copyright 2016 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "fmt" +) + +type ErrDelimiterNotFound struct { + Line string +} + +func IsErrDelimiterNotFound(err error) bool { + _, ok := err.(ErrDelimiterNotFound) + return ok +} + +func (err ErrDelimiterNotFound) Error() string { + return fmt.Sprintf("key-value delimiter not found: %s", err.Line) +} diff --git a/vendor/github.com/go-ini/ini/file.go b/vendor/github.com/go-ini/ini/file.go new file mode 100644 index 000000000000..1a3186b9f231 --- /dev/null +++ b/vendor/github.com/go-ini/ini/file.go @@ -0,0 +1,414 @@ +// Copyright 2017 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "strings" + "sync" +) + +// File represents a combination of a or more INI file(s) in memory. +type File struct { + options LoadOptions + dataSources []dataSource + + // Should make things safe, but sometimes doesn't matter. + BlockMode bool + lock sync.RWMutex + + // To keep data in order. + sectionList []string + // Actual data is stored here. + sections map[string]*Section + + NameMapper + ValueMapper +} + +// newFile initializes File object with given data sources. +func newFile(dataSources []dataSource, opts LoadOptions) *File { + return &File{ + BlockMode: true, + dataSources: dataSources, + sections: make(map[string]*Section), + sectionList: make([]string, 0, 10), + options: opts, + } +} + +// Empty returns an empty file object. +func Empty() *File { + // Ignore error here, we sure our data is good. + f, _ := Load([]byte("")) + return f +} + +// NewSection creates a new section. +func (f *File) NewSection(name string) (*Section, error) { + if len(name) == 0 { + return nil, errors.New("error creating new section: empty section name") + } else if f.options.Insensitive && name != DEFAULT_SECTION { + name = strings.ToLower(name) + } + + if f.BlockMode { + f.lock.Lock() + defer f.lock.Unlock() + } + + if inSlice(name, f.sectionList) { + return f.sections[name], nil + } + + f.sectionList = append(f.sectionList, name) + f.sections[name] = newSection(f, name) + return f.sections[name], nil +} + +// NewRawSection creates a new section with an unparseable body. +func (f *File) NewRawSection(name, body string) (*Section, error) { + section, err := f.NewSection(name) + if err != nil { + return nil, err + } + + section.isRawSection = true + section.rawBody = body + return section, nil +} + +// NewSections creates a list of sections. +func (f *File) NewSections(names ...string) (err error) { + for _, name := range names { + if _, err = f.NewSection(name); err != nil { + return err + } + } + return nil +} + +// GetSection returns section by given name. +func (f *File) GetSection(name string) (*Section, error) { + if len(name) == 0 { + name = DEFAULT_SECTION + } + if f.options.Insensitive { + name = strings.ToLower(name) + } + + if f.BlockMode { + f.lock.RLock() + defer f.lock.RUnlock() + } + + sec := f.sections[name] + if sec == nil { + return nil, fmt.Errorf("section '%s' does not exist", name) + } + return sec, nil +} + +// Section assumes named section exists and returns a zero-value when not. +func (f *File) Section(name string) *Section { + sec, err := f.GetSection(name) + if err != nil { + // Note: It's OK here because the only possible error is empty section name, + // but if it's empty, this piece of code won't be executed. + sec, _ = f.NewSection(name) + return sec + } + return sec +} + +// Section returns list of Section. +func (f *File) Sections() []*Section { + if f.BlockMode { + f.lock.RLock() + defer f.lock.RUnlock() + } + + sections := make([]*Section, len(f.sectionList)) + for i, name := range f.sectionList { + sections[i] = f.sections[name] + } + return sections +} + +// ChildSections returns a list of child sections of given section name. +func (f *File) ChildSections(name string) []*Section { + return f.Section(name).ChildSections() +} + +// SectionStrings returns list of section names. +func (f *File) SectionStrings() []string { + list := make([]string, len(f.sectionList)) + copy(list, f.sectionList) + return list +} + +// DeleteSection deletes a section. +func (f *File) DeleteSection(name string) { + if f.BlockMode { + f.lock.Lock() + defer f.lock.Unlock() + } + + if len(name) == 0 { + name = DEFAULT_SECTION + } + + for i, s := range f.sectionList { + if s == name { + f.sectionList = append(f.sectionList[:i], f.sectionList[i+1:]...) + delete(f.sections, name) + return + } + } +} + +func (f *File) reload(s dataSource) error { + r, err := s.ReadCloser() + if err != nil { + return err + } + defer r.Close() + + return f.parse(r) +} + +// Reload reloads and parses all data sources. +func (f *File) Reload() (err error) { + for _, s := range f.dataSources { + if err = f.reload(s); err != nil { + // In loose mode, we create an empty default section for nonexistent files. + if os.IsNotExist(err) && f.options.Loose { + f.parse(bytes.NewBuffer(nil)) + continue + } + return err + } + } + return nil +} + +// Append appends one or more data sources and reloads automatically. +func (f *File) Append(source interface{}, others ...interface{}) error { + ds, err := parseDataSource(source) + if err != nil { + return err + } + f.dataSources = append(f.dataSources, ds) + for _, s := range others { + ds, err = parseDataSource(s) + if err != nil { + return err + } + f.dataSources = append(f.dataSources, ds) + } + return f.Reload() +} + +func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) { + equalSign := "=" + if PrettyFormat || PrettyEqual { + equalSign = " = " + } + + // Use buffer to make sure target is safe until finish encoding. + buf := bytes.NewBuffer(nil) + for i, sname := range f.sectionList { + sec := f.Section(sname) + if len(sec.Comment) > 0 { + // Support multiline comments + lines := strings.Split(sec.Comment, LineBreak) + for i := range lines { + if lines[i][0] != '#' && lines[i][0] != ';' { + lines[i] = "; " + lines[i] + } else { + lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:]) + } + + if _, err := buf.WriteString(lines[i] + LineBreak); err != nil { + return nil, err + } + } + } + + if i > 0 || DefaultHeader { + if _, err := buf.WriteString("[" + sname + "]" + LineBreak); err != nil { + return nil, err + } + } else { + // Write nothing if default section is empty + if len(sec.keyList) == 0 { + continue + } + } + + if sec.isRawSection { + if _, err := buf.WriteString(sec.rawBody); err != nil { + return nil, err + } + + if PrettySection { + // Put a line between sections + if _, err := buf.WriteString(LineBreak); err != nil { + return nil, err + } + } + continue + } + + // Count and generate alignment length and buffer spaces using the + // longest key. Keys may be modifed if they contain certain characters so + // we need to take that into account in our calculation. + alignLength := 0 + if PrettyFormat { + for _, kname := range sec.keyList { + keyLength := len(kname) + // First case will surround key by ` and second by """ + if strings.ContainsAny(kname, "\"=:") { + keyLength += 2 + } else if strings.Contains(kname, "`") { + keyLength += 6 + } + + if keyLength > alignLength { + alignLength = keyLength + } + } + } + alignSpaces := bytes.Repeat([]byte(" "), alignLength) + + KEY_LIST: + for _, kname := range sec.keyList { + key := sec.Key(kname) + if len(key.Comment) > 0 { + if len(indent) > 0 && sname != DEFAULT_SECTION { + buf.WriteString(indent) + } + + // Support multiline comments + lines := strings.Split(key.Comment, LineBreak) + for i := range lines { + if lines[i][0] != '#' && lines[i][0] != ';' { + lines[i] = "; " + lines[i] + } else { + lines[i] = lines[i][:1] + " " + strings.TrimSpace(lines[i][1:]) + } + + if _, err := buf.WriteString(lines[i] + LineBreak); err != nil { + return nil, err + } + } + } + + if len(indent) > 0 && sname != DEFAULT_SECTION { + buf.WriteString(indent) + } + + switch { + case key.isAutoIncrement: + kname = "-" + case strings.ContainsAny(kname, "\"=:"): + kname = "`" + kname + "`" + case strings.Contains(kname, "`"): + kname = `"""` + kname + `"""` + } + + for _, val := range key.ValueWithShadows() { + if _, err := buf.WriteString(kname); err != nil { + return nil, err + } + + if key.isBooleanType { + if kname != sec.keyList[len(sec.keyList)-1] { + buf.WriteString(LineBreak) + } + continue KEY_LIST + } + + // Write out alignment spaces before "=" sign + if PrettyFormat { + buf.Write(alignSpaces[:alignLength-len(kname)]) + } + + // In case key value contains "\n", "`", "\"", "#" or ";" + if strings.ContainsAny(val, "\n`") { + val = `"""` + val + `"""` + } else if !f.options.IgnoreInlineComment && strings.ContainsAny(val, "#;") { + val = "`" + val + "`" + } + if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil { + return nil, err + } + } + + for _, val := range key.nestedValues { + if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil { + return nil, err + } + } + } + + if PrettySection { + // Put a line between sections + if _, err := buf.WriteString(LineBreak); err != nil { + return nil, err + } + } + } + + return buf, nil +} + +// WriteToIndent writes content into io.Writer with given indention. +// If PrettyFormat has been set to be true, +// it will align "=" sign with spaces under each section. +func (f *File) WriteToIndent(w io.Writer, indent string) (int64, error) { + buf, err := f.writeToBuffer(indent) + if err != nil { + return 0, err + } + return buf.WriteTo(w) +} + +// WriteTo writes file content into io.Writer. +func (f *File) WriteTo(w io.Writer) (int64, error) { + return f.WriteToIndent(w, "") +} + +// SaveToIndent writes content to file system with given value indention. +func (f *File) SaveToIndent(filename, indent string) error { + // Note: Because we are truncating with os.Create, + // so it's safer to save to a temporary file location and rename afte done. + buf, err := f.writeToBuffer(indent) + if err != nil { + return err + } + + return ioutil.WriteFile(filename, buf.Bytes(), 0666) +} + +// SaveTo writes content to file system. +func (f *File) SaveTo(filename string) error { + return f.SaveToIndent(filename, "") +} diff --git a/vendor/github.com/go-ini/ini/ini.go b/vendor/github.com/go-ini/ini/ini.go new file mode 100644 index 000000000000..cb55997a3d1a --- /dev/null +++ b/vendor/github.com/go-ini/ini/ini.go @@ -0,0 +1,211 @@ +// +build go1.6 + +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +// Package ini provides INI file read and write functionality in Go. +package ini + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "os" + "regexp" + "runtime" +) + +const ( + // Name for default section. You can use this constant or the string literal. + // In most of cases, an empty string is all you need to access the section. + DEFAULT_SECTION = "DEFAULT" + + // Maximum allowed depth when recursively substituing variable names. + _DEPTH_VALUES = 99 + _VERSION = "1.38.2" +) + +// Version returns current package version literal. +func Version() string { + return _VERSION +} + +var ( + // Delimiter to determine or compose a new line. + // This variable will be changed to "\r\n" automatically on Windows + // at package init time. + LineBreak = "\n" + + // Variable regexp pattern: %(variable)s + varPattern = regexp.MustCompile(`%\(([^\)]+)\)s`) + + // Indicate whether to align "=" sign with spaces to produce pretty output + // or reduce all possible spaces for compact format. + PrettyFormat = true + + // Place spaces around "=" sign even when PrettyFormat is false + PrettyEqual = false + + // Explicitly write DEFAULT section header + DefaultHeader = false + + // Indicate whether to put a line between sections + PrettySection = true +) + +func init() { + if runtime.GOOS == "windows" { + LineBreak = "\r\n" + } +} + +func inSlice(str string, s []string) bool { + for _, v := range s { + if str == v { + return true + } + } + return false +} + +// dataSource is an interface that returns object which can be read and closed. +type dataSource interface { + ReadCloser() (io.ReadCloser, error) +} + +// sourceFile represents an object that contains content on the local file system. +type sourceFile struct { + name string +} + +func (s sourceFile) ReadCloser() (_ io.ReadCloser, err error) { + return os.Open(s.name) +} + +// sourceData represents an object that contains content in memory. +type sourceData struct { + data []byte +} + +func (s *sourceData) ReadCloser() (io.ReadCloser, error) { + return ioutil.NopCloser(bytes.NewReader(s.data)), nil +} + +// sourceReadCloser represents an input stream with Close method. +type sourceReadCloser struct { + reader io.ReadCloser +} + +func (s *sourceReadCloser) ReadCloser() (io.ReadCloser, error) { + return s.reader, nil +} + +func parseDataSource(source interface{}) (dataSource, error) { + switch s := source.(type) { + case string: + return sourceFile{s}, nil + case []byte: + return &sourceData{s}, nil + case io.ReadCloser: + return &sourceReadCloser{s}, nil + default: + return nil, fmt.Errorf("error parsing data source: unknown type '%s'", s) + } +} + +type LoadOptions struct { + // Loose indicates whether the parser should ignore nonexistent files or return error. + Loose bool + // Insensitive indicates whether the parser forces all section and key names to lowercase. + Insensitive bool + // IgnoreContinuation indicates whether to ignore continuation lines while parsing. + IgnoreContinuation bool + // IgnoreInlineComment indicates whether to ignore comments at the end of value and treat it as part of value. + IgnoreInlineComment bool + // SkipUnrecognizableLines indicates whether to skip unrecognizable lines that do not conform to key/value pairs. + SkipUnrecognizableLines bool + // AllowBooleanKeys indicates whether to allow boolean type keys or treat as value is missing. + // This type of keys are mostly used in my.cnf. + AllowBooleanKeys bool + // AllowShadows indicates whether to keep track of keys with same name under same section. + AllowShadows bool + // AllowNestedValues indicates whether to allow AWS-like nested values. + // Docs: http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#nested-values + AllowNestedValues bool + // AllowPythonMultilineValues indicates whether to allow Python-like multi-line values. + // Docs: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure + // Relevant quote: Values can also span multiple lines, as long as they are indented deeper + // than the first line of the value. + AllowPythonMultilineValues bool + // SpaceBeforeInlineComment indicates whether to allow comment symbols (\# and \;) inside value. + // Docs: https://docs.python.org/2/library/configparser.html + // Quote: Comments may appear on their own in an otherwise empty line, or may be entered in lines holding values or section names. + // In the latter case, they need to be preceded by a whitespace character to be recognized as a comment. + SpaceBeforeInlineComment bool + // UnescapeValueDoubleQuotes indicates whether to unescape double quotes inside value to regular format + // when value is surrounded by double quotes, e.g. key="a \"value\"" => key=a "value" + UnescapeValueDoubleQuotes bool + // UnescapeValueCommentSymbols indicates to unescape comment symbols (\# and \;) inside value to regular format + // when value is NOT surrounded by any quotes. + // Note: UNSTABLE, behavior might change to only unescape inside double quotes but may noy necessary at all. + UnescapeValueCommentSymbols bool + // UnparseableSections stores a list of blocks that are allowed with raw content which do not otherwise + // conform to key/value pairs. Specify the names of those blocks here. + UnparseableSections []string +} + +func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) { + sources := make([]dataSource, len(others)+1) + sources[0], err = parseDataSource(source) + if err != nil { + return nil, err + } + for i := range others { + sources[i+1], err = parseDataSource(others[i]) + if err != nil { + return nil, err + } + } + f := newFile(sources, opts) + if err = f.Reload(); err != nil { + return nil, err + } + return f, nil +} + +// Load loads and parses from INI data sources. +// Arguments can be mixed of file name with string type, or raw data in []byte. +// It will return error if list contains nonexistent files. +func Load(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{}, source, others...) +} + +// LooseLoad has exactly same functionality as Load function +// except it ignores nonexistent files instead of returning error. +func LooseLoad(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{Loose: true}, source, others...) +} + +// InsensitiveLoad has exactly same functionality as Load function +// except it forces all section and key names to be lowercased. +func InsensitiveLoad(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{Insensitive: true}, source, others...) +} + +// ShadowLoad has exactly same functionality as Load function +// except it allows have shadow keys. +func ShadowLoad(source interface{}, others ...interface{}) (*File, error) { + return LoadSources(LoadOptions{AllowShadows: true}, source, others...) +} diff --git a/vendor/github.com/go-ini/ini/key.go b/vendor/github.com/go-ini/ini/key.go new file mode 100644 index 000000000000..7c8566a1b4c1 --- /dev/null +++ b/vendor/github.com/go-ini/ini/key.go @@ -0,0 +1,751 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "bytes" + "errors" + "fmt" + "strconv" + "strings" + "time" +) + +// Key represents a key under a section. +type Key struct { + s *Section + Comment string + name string + value string + isAutoIncrement bool + isBooleanType bool + + isShadow bool + shadows []*Key + + nestedValues []string +} + +// newKey simply return a key object with given values. +func newKey(s *Section, name, val string) *Key { + return &Key{ + s: s, + name: name, + value: val, + } +} + +func (k *Key) addShadow(val string) error { + if k.isShadow { + return errors.New("cannot add shadow to another shadow key") + } else if k.isAutoIncrement || k.isBooleanType { + return errors.New("cannot add shadow to auto-increment or boolean key") + } + + shadow := newKey(k.s, k.name, val) + shadow.isShadow = true + k.shadows = append(k.shadows, shadow) + return nil +} + +// AddShadow adds a new shadow key to itself. +func (k *Key) AddShadow(val string) error { + if !k.s.f.options.AllowShadows { + return errors.New("shadow key is not allowed") + } + return k.addShadow(val) +} + +func (k *Key) addNestedValue(val string) error { + if k.isAutoIncrement || k.isBooleanType { + return errors.New("cannot add nested value to auto-increment or boolean key") + } + + k.nestedValues = append(k.nestedValues, val) + return nil +} + +func (k *Key) AddNestedValue(val string) error { + if !k.s.f.options.AllowNestedValues { + return errors.New("nested value is not allowed") + } + return k.addNestedValue(val) +} + +// ValueMapper represents a mapping function for values, e.g. os.ExpandEnv +type ValueMapper func(string) string + +// Name returns name of key. +func (k *Key) Name() string { + return k.name +} + +// Value returns raw value of key for performance purpose. +func (k *Key) Value() string { + return k.value +} + +// ValueWithShadows returns raw values of key and its shadows if any. +func (k *Key) ValueWithShadows() []string { + if len(k.shadows) == 0 { + return []string{k.value} + } + vals := make([]string, len(k.shadows)+1) + vals[0] = k.value + for i := range k.shadows { + vals[i+1] = k.shadows[i].value + } + return vals +} + +// NestedValues returns nested values stored in the key. +// It is possible returned value is nil if no nested values stored in the key. +func (k *Key) NestedValues() []string { + return k.nestedValues +} + +// transformValue takes a raw value and transforms to its final string. +func (k *Key) transformValue(val string) string { + if k.s.f.ValueMapper != nil { + val = k.s.f.ValueMapper(val) + } + + // Fail-fast if no indicate char found for recursive value + if !strings.Contains(val, "%") { + return val + } + for i := 0; i < _DEPTH_VALUES; i++ { + vr := varPattern.FindString(val) + if len(vr) == 0 { + break + } + + // Take off leading '%(' and trailing ')s'. + noption := strings.TrimLeft(vr, "%(") + noption = strings.TrimRight(noption, ")s") + + // Search in the same section. + nk, err := k.s.GetKey(noption) + if err != nil || k == nk { + // Search again in default section. + nk, _ = k.s.f.Section("").GetKey(noption) + } + + // Substitute by new value and take off leading '%(' and trailing ')s'. + val = strings.Replace(val, vr, nk.value, -1) + } + return val +} + +// String returns string representation of value. +func (k *Key) String() string { + return k.transformValue(k.value) +} + +// Validate accepts a validate function which can +// return modifed result as key value. +func (k *Key) Validate(fn func(string) string) string { + return fn(k.String()) +} + +// parseBool returns the boolean value represented by the string. +// +// It accepts 1, t, T, TRUE, true, True, YES, yes, Yes, y, ON, on, On, +// 0, f, F, FALSE, false, False, NO, no, No, n, OFF, off, Off. +// Any other value returns an error. +func parseBool(str string) (value bool, err error) { + switch str { + case "1", "t", "T", "true", "TRUE", "True", "YES", "yes", "Yes", "y", "ON", "on", "On": + return true, nil + case "0", "f", "F", "false", "FALSE", "False", "NO", "no", "No", "n", "OFF", "off", "Off": + return false, nil + } + return false, fmt.Errorf("parsing \"%s\": invalid syntax", str) +} + +// Bool returns bool type value. +func (k *Key) Bool() (bool, error) { + return parseBool(k.String()) +} + +// Float64 returns float64 type value. +func (k *Key) Float64() (float64, error) { + return strconv.ParseFloat(k.String(), 64) +} + +// Int returns int type value. +func (k *Key) Int() (int, error) { + return strconv.Atoi(k.String()) +} + +// Int64 returns int64 type value. +func (k *Key) Int64() (int64, error) { + return strconv.ParseInt(k.String(), 10, 64) +} + +// Uint returns uint type valued. +func (k *Key) Uint() (uint, error) { + u, e := strconv.ParseUint(k.String(), 10, 64) + return uint(u), e +} + +// Uint64 returns uint64 type value. +func (k *Key) Uint64() (uint64, error) { + return strconv.ParseUint(k.String(), 10, 64) +} + +// Duration returns time.Duration type value. +func (k *Key) Duration() (time.Duration, error) { + return time.ParseDuration(k.String()) +} + +// TimeFormat parses with given format and returns time.Time type value. +func (k *Key) TimeFormat(format string) (time.Time, error) { + return time.Parse(format, k.String()) +} + +// Time parses with RFC3339 format and returns time.Time type value. +func (k *Key) Time() (time.Time, error) { + return k.TimeFormat(time.RFC3339) +} + +// MustString returns default value if key value is empty. +func (k *Key) MustString(defaultVal string) string { + val := k.String() + if len(val) == 0 { + k.value = defaultVal + return defaultVal + } + return val +} + +// MustBool always returns value without error, +// it returns false if error occurs. +func (k *Key) MustBool(defaultVal ...bool) bool { + val, err := k.Bool() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatBool(defaultVal[0]) + return defaultVal[0] + } + return val +} + +// MustFloat64 always returns value without error, +// it returns 0.0 if error occurs. +func (k *Key) MustFloat64(defaultVal ...float64) float64 { + val, err := k.Float64() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatFloat(defaultVal[0], 'f', -1, 64) + return defaultVal[0] + } + return val +} + +// MustInt always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustInt(defaultVal ...int) int { + val, err := k.Int() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatInt(int64(defaultVal[0]), 10) + return defaultVal[0] + } + return val +} + +// MustInt64 always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustInt64(defaultVal ...int64) int64 { + val, err := k.Int64() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatInt(defaultVal[0], 10) + return defaultVal[0] + } + return val +} + +// MustUint always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustUint(defaultVal ...uint) uint { + val, err := k.Uint() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatUint(uint64(defaultVal[0]), 10) + return defaultVal[0] + } + return val +} + +// MustUint64 always returns value without error, +// it returns 0 if error occurs. +func (k *Key) MustUint64(defaultVal ...uint64) uint64 { + val, err := k.Uint64() + if len(defaultVal) > 0 && err != nil { + k.value = strconv.FormatUint(defaultVal[0], 10) + return defaultVal[0] + } + return val +} + +// MustDuration always returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustDuration(defaultVal ...time.Duration) time.Duration { + val, err := k.Duration() + if len(defaultVal) > 0 && err != nil { + k.value = defaultVal[0].String() + return defaultVal[0] + } + return val +} + +// MustTimeFormat always parses with given format and returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustTimeFormat(format string, defaultVal ...time.Time) time.Time { + val, err := k.TimeFormat(format) + if len(defaultVal) > 0 && err != nil { + k.value = defaultVal[0].Format(format) + return defaultVal[0] + } + return val +} + +// MustTime always parses with RFC3339 format and returns value without error, +// it returns zero value if error occurs. +func (k *Key) MustTime(defaultVal ...time.Time) time.Time { + return k.MustTimeFormat(time.RFC3339, defaultVal...) +} + +// In always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) In(defaultVal string, candidates []string) string { + val := k.String() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InFloat64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InFloat64(defaultVal float64, candidates []float64) float64 { + val := k.MustFloat64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InInt always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InInt(defaultVal int, candidates []int) int { + val := k.MustInt() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InInt64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 { + val := k.MustInt64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InUint always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InUint(defaultVal uint, candidates []uint) uint { + val := k.MustUint() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InUint64 always returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InUint64(defaultVal uint64, candidates []uint64) uint64 { + val := k.MustUint64() + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InTimeFormat always parses with given format and returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InTimeFormat(format string, defaultVal time.Time, candidates []time.Time) time.Time { + val := k.MustTimeFormat(format) + for _, cand := range candidates { + if val == cand { + return val + } + } + return defaultVal +} + +// InTime always parses with RFC3339 format and returns value without error, +// it returns default value if error occurs or doesn't fit into candidates. +func (k *Key) InTime(defaultVal time.Time, candidates []time.Time) time.Time { + return k.InTimeFormat(time.RFC3339, defaultVal, candidates) +} + +// RangeFloat64 checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeFloat64(defaultVal, min, max float64) float64 { + val := k.MustFloat64() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeInt checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeInt(defaultVal, min, max int) int { + val := k.MustInt() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeInt64 checks if value is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeInt64(defaultVal, min, max int64) int64 { + val := k.MustInt64() + if val < min || val > max { + return defaultVal + } + return val +} + +// RangeTimeFormat checks if value with given format is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeTimeFormat(format string, defaultVal, min, max time.Time) time.Time { + val := k.MustTimeFormat(format) + if val.Unix() < min.Unix() || val.Unix() > max.Unix() { + return defaultVal + } + return val +} + +// RangeTime checks if value with RFC3339 format is in given range inclusively, +// and returns default value if it's not. +func (k *Key) RangeTime(defaultVal, min, max time.Time) time.Time { + return k.RangeTimeFormat(time.RFC3339, defaultVal, min, max) +} + +// Strings returns list of string divided by given delimiter. +func (k *Key) Strings(delim string) []string { + str := k.String() + if len(str) == 0 { + return []string{} + } + + runes := []rune(str) + vals := make([]string, 0, 2) + var buf bytes.Buffer + escape := false + idx := 0 + for { + if escape { + escape = false + if runes[idx] != '\\' && !strings.HasPrefix(string(runes[idx:]), delim) { + buf.WriteRune('\\') + } + buf.WriteRune(runes[idx]) + } else { + if runes[idx] == '\\' { + escape = true + } else if strings.HasPrefix(string(runes[idx:]), delim) { + idx += len(delim) - 1 + vals = append(vals, strings.TrimSpace(buf.String())) + buf.Reset() + } else { + buf.WriteRune(runes[idx]) + } + } + idx += 1 + if idx == len(runes) { + break + } + } + + if buf.Len() > 0 { + vals = append(vals, strings.TrimSpace(buf.String())) + } + + return vals +} + +// StringsWithShadows returns list of string divided by given delimiter. +// Shadows will also be appended if any. +func (k *Key) StringsWithShadows(delim string) []string { + vals := k.ValueWithShadows() + results := make([]string, 0, len(vals)*2) + for i := range vals { + if len(vals) == 0 { + continue + } + + results = append(results, strings.Split(vals[i], delim)...) + } + + for i := range results { + results[i] = k.transformValue(strings.TrimSpace(results[i])) + } + return results +} + +// Float64s returns list of float64 divided by given delimiter. Any invalid input will be treated as zero value. +func (k *Key) Float64s(delim string) []float64 { + vals, _ := k.parseFloat64s(k.Strings(delim), true, false) + return vals +} + +// Ints returns list of int divided by given delimiter. Any invalid input will be treated as zero value. +func (k *Key) Ints(delim string) []int { + vals, _ := k.parseInts(k.Strings(delim), true, false) + return vals +} + +// Int64s returns list of int64 divided by given delimiter. Any invalid input will be treated as zero value. +func (k *Key) Int64s(delim string) []int64 { + vals, _ := k.parseInt64s(k.Strings(delim), true, false) + return vals +} + +// Uints returns list of uint divided by given delimiter. Any invalid input will be treated as zero value. +func (k *Key) Uints(delim string) []uint { + vals, _ := k.parseUints(k.Strings(delim), true, false) + return vals +} + +// Uint64s returns list of uint64 divided by given delimiter. Any invalid input will be treated as zero value. +func (k *Key) Uint64s(delim string) []uint64 { + vals, _ := k.parseUint64s(k.Strings(delim), true, false) + return vals +} + +// TimesFormat parses with given format and returns list of time.Time divided by given delimiter. +// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). +func (k *Key) TimesFormat(format, delim string) []time.Time { + vals, _ := k.parseTimesFormat(format, k.Strings(delim), true, false) + return vals +} + +// Times parses with RFC3339 format and returns list of time.Time divided by given delimiter. +// Any invalid input will be treated as zero value (0001-01-01 00:00:00 +0000 UTC). +func (k *Key) Times(delim string) []time.Time { + return k.TimesFormat(time.RFC3339, delim) +} + +// ValidFloat64s returns list of float64 divided by given delimiter. If some value is not float, then +// it will not be included to result list. +func (k *Key) ValidFloat64s(delim string) []float64 { + vals, _ := k.parseFloat64s(k.Strings(delim), false, false) + return vals +} + +// ValidInts returns list of int divided by given delimiter. If some value is not integer, then it will +// not be included to result list. +func (k *Key) ValidInts(delim string) []int { + vals, _ := k.parseInts(k.Strings(delim), false, false) + return vals +} + +// ValidInt64s returns list of int64 divided by given delimiter. If some value is not 64-bit integer, +// then it will not be included to result list. +func (k *Key) ValidInt64s(delim string) []int64 { + vals, _ := k.parseInt64s(k.Strings(delim), false, false) + return vals +} + +// ValidUints returns list of uint divided by given delimiter. If some value is not unsigned integer, +// then it will not be included to result list. +func (k *Key) ValidUints(delim string) []uint { + vals, _ := k.parseUints(k.Strings(delim), false, false) + return vals +} + +// ValidUint64s returns list of uint64 divided by given delimiter. If some value is not 64-bit unsigned +// integer, then it will not be included to result list. +func (k *Key) ValidUint64s(delim string) []uint64 { + vals, _ := k.parseUint64s(k.Strings(delim), false, false) + return vals +} + +// ValidTimesFormat parses with given format and returns list of time.Time divided by given delimiter. +func (k *Key) ValidTimesFormat(format, delim string) []time.Time { + vals, _ := k.parseTimesFormat(format, k.Strings(delim), false, false) + return vals +} + +// ValidTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter. +func (k *Key) ValidTimes(delim string) []time.Time { + return k.ValidTimesFormat(time.RFC3339, delim) +} + +// StrictFloat64s returns list of float64 divided by given delimiter or error on first invalid input. +func (k *Key) StrictFloat64s(delim string) ([]float64, error) { + return k.parseFloat64s(k.Strings(delim), false, true) +} + +// StrictInts returns list of int divided by given delimiter or error on first invalid input. +func (k *Key) StrictInts(delim string) ([]int, error) { + return k.parseInts(k.Strings(delim), false, true) +} + +// StrictInt64s returns list of int64 divided by given delimiter or error on first invalid input. +func (k *Key) StrictInt64s(delim string) ([]int64, error) { + return k.parseInt64s(k.Strings(delim), false, true) +} + +// StrictUints returns list of uint divided by given delimiter or error on first invalid input. +func (k *Key) StrictUints(delim string) ([]uint, error) { + return k.parseUints(k.Strings(delim), false, true) +} + +// StrictUint64s returns list of uint64 divided by given delimiter or error on first invalid input. +func (k *Key) StrictUint64s(delim string) ([]uint64, error) { + return k.parseUint64s(k.Strings(delim), false, true) +} + +// StrictTimesFormat parses with given format and returns list of time.Time divided by given delimiter +// or error on first invalid input. +func (k *Key) StrictTimesFormat(format, delim string) ([]time.Time, error) { + return k.parseTimesFormat(format, k.Strings(delim), false, true) +} + +// StrictTimes parses with RFC3339 format and returns list of time.Time divided by given delimiter +// or error on first invalid input. +func (k *Key) StrictTimes(delim string) ([]time.Time, error) { + return k.StrictTimesFormat(time.RFC3339, delim) +} + +// parseFloat64s transforms strings to float64s. +func (k *Key) parseFloat64s(strs []string, addInvalid, returnOnInvalid bool) ([]float64, error) { + vals := make([]float64, 0, len(strs)) + for _, str := range strs { + val, err := strconv.ParseFloat(str, 64) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, val) + } + } + return vals, nil +} + +// parseInts transforms strings to ints. +func (k *Key) parseInts(strs []string, addInvalid, returnOnInvalid bool) ([]int, error) { + vals := make([]int, 0, len(strs)) + for _, str := range strs { + val, err := strconv.Atoi(str) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, val) + } + } + return vals, nil +} + +// parseInt64s transforms strings to int64s. +func (k *Key) parseInt64s(strs []string, addInvalid, returnOnInvalid bool) ([]int64, error) { + vals := make([]int64, 0, len(strs)) + for _, str := range strs { + val, err := strconv.ParseInt(str, 10, 64) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, val) + } + } + return vals, nil +} + +// parseUints transforms strings to uints. +func (k *Key) parseUints(strs []string, addInvalid, returnOnInvalid bool) ([]uint, error) { + vals := make([]uint, 0, len(strs)) + for _, str := range strs { + val, err := strconv.ParseUint(str, 10, 0) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, uint(val)) + } + } + return vals, nil +} + +// parseUint64s transforms strings to uint64s. +func (k *Key) parseUint64s(strs []string, addInvalid, returnOnInvalid bool) ([]uint64, error) { + vals := make([]uint64, 0, len(strs)) + for _, str := range strs { + val, err := strconv.ParseUint(str, 10, 64) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, val) + } + } + return vals, nil +} + +// parseTimesFormat transforms strings to times in given format. +func (k *Key) parseTimesFormat(format string, strs []string, addInvalid, returnOnInvalid bool) ([]time.Time, error) { + vals := make([]time.Time, 0, len(strs)) + for _, str := range strs { + val, err := time.Parse(format, str) + if err != nil && returnOnInvalid { + return nil, err + } + if err == nil || addInvalid { + vals = append(vals, val) + } + } + return vals, nil +} + +// SetValue changes key value. +func (k *Key) SetValue(v string) { + if k.s.f.BlockMode { + k.s.f.lock.Lock() + defer k.s.f.lock.Unlock() + } + + k.value = v + k.s.keysHash[k.name] = v +} diff --git a/vendor/github.com/go-ini/ini/parser.go b/vendor/github.com/go-ini/ini/parser.go new file mode 100644 index 000000000000..3daf54c38a5a --- /dev/null +++ b/vendor/github.com/go-ini/ini/parser.go @@ -0,0 +1,494 @@ +// Copyright 2015 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "bufio" + "bytes" + "fmt" + "io" + "regexp" + "strconv" + "strings" + "unicode" +) + +var pythonMultiline = regexp.MustCompile("^(\\s+)([^\n]+)") + +type tokenType int + +const ( + _TOKEN_INVALID tokenType = iota + _TOKEN_COMMENT + _TOKEN_SECTION + _TOKEN_KEY +) + +type parser struct { + buf *bufio.Reader + isEOF bool + count int + comment *bytes.Buffer +} + +func newParser(r io.Reader) *parser { + return &parser{ + buf: bufio.NewReader(r), + count: 1, + comment: &bytes.Buffer{}, + } +} + +// BOM handles header of UTF-8, UTF-16 LE and UTF-16 BE's BOM format. +// http://en.wikipedia.org/wiki/Byte_order_mark#Representations_of_byte_order_marks_by_encoding +func (p *parser) BOM() error { + mask, err := p.buf.Peek(2) + if err != nil && err != io.EOF { + return err + } else if len(mask) < 2 { + return nil + } + + switch { + case mask[0] == 254 && mask[1] == 255: + fallthrough + case mask[0] == 255 && mask[1] == 254: + p.buf.Read(mask) + case mask[0] == 239 && mask[1] == 187: + mask, err := p.buf.Peek(3) + if err != nil && err != io.EOF { + return err + } else if len(mask) < 3 { + return nil + } + if mask[2] == 191 { + p.buf.Read(mask) + } + } + return nil +} + +func (p *parser) readUntil(delim byte) ([]byte, error) { + data, err := p.buf.ReadBytes(delim) + if err != nil { + if err == io.EOF { + p.isEOF = true + } else { + return nil, err + } + } + return data, nil +} + +func cleanComment(in []byte) ([]byte, bool) { + i := bytes.IndexAny(in, "#;") + if i == -1 { + return nil, false + } + return in[i:], true +} + +func readKeyName(in []byte) (string, int, error) { + line := string(in) + + // Check if key name surrounded by quotes. + var keyQuote string + if line[0] == '"' { + if len(line) > 6 && string(line[0:3]) == `"""` { + keyQuote = `"""` + } else { + keyQuote = `"` + } + } else if line[0] == '`' { + keyQuote = "`" + } + + // Get out key name + endIdx := -1 + if len(keyQuote) > 0 { + startIdx := len(keyQuote) + // FIXME: fail case -> """"""name"""=value + pos := strings.Index(line[startIdx:], keyQuote) + if pos == -1 { + return "", -1, fmt.Errorf("missing closing key quote: %s", line) + } + pos += startIdx + + // Find key-value delimiter + i := strings.IndexAny(line[pos+startIdx:], "=:") + if i < 0 { + return "", -1, ErrDelimiterNotFound{line} + } + endIdx = pos + i + return strings.TrimSpace(line[startIdx:pos]), endIdx + startIdx + 1, nil + } + + endIdx = strings.IndexAny(line, "=:") + if endIdx < 0 { + return "", -1, ErrDelimiterNotFound{line} + } + return strings.TrimSpace(line[0:endIdx]), endIdx + 1, nil +} + +func (p *parser) readMultilines(line, val, valQuote string) (string, error) { + for { + data, err := p.readUntil('\n') + if err != nil { + return "", err + } + next := string(data) + + pos := strings.LastIndex(next, valQuote) + if pos > -1 { + val += next[:pos] + + comment, has := cleanComment([]byte(next[pos:])) + if has { + p.comment.Write(bytes.TrimSpace(comment)) + } + break + } + val += next + if p.isEOF { + return "", fmt.Errorf("missing closing key quote from '%s' to '%s'", line, next) + } + } + return val, nil +} + +func (p *parser) readContinuationLines(val string) (string, error) { + for { + data, err := p.readUntil('\n') + if err != nil { + return "", err + } + next := strings.TrimSpace(string(data)) + + if len(next) == 0 { + break + } + val += next + if val[len(val)-1] != '\\' { + break + } + val = val[:len(val)-1] + } + return val, nil +} + +// hasSurroundedQuote check if and only if the first and last characters +// are quotes \" or \'. +// It returns false if any other parts also contain same kind of quotes. +func hasSurroundedQuote(in string, quote byte) bool { + return len(in) >= 2 && in[0] == quote && in[len(in)-1] == quote && + strings.IndexByte(in[1:], quote) == len(in)-2 +} + +func (p *parser) readValue(in []byte, + parserBufferSize int, + ignoreContinuation, ignoreInlineComment, unescapeValueDoubleQuotes, unescapeValueCommentSymbols, allowPythonMultilines, spaceBeforeInlineComment bool) (string, error) { + + line := strings.TrimLeftFunc(string(in), unicode.IsSpace) + if len(line) == 0 { + return "", nil + } + + var valQuote string + if len(line) > 3 && string(line[0:3]) == `"""` { + valQuote = `"""` + } else if line[0] == '`' { + valQuote = "`" + } else if unescapeValueDoubleQuotes && line[0] == '"' { + valQuote = `"` + } + + if len(valQuote) > 0 { + startIdx := len(valQuote) + pos := strings.LastIndex(line[startIdx:], valQuote) + // Check for multi-line value + if pos == -1 { + return p.readMultilines(line, line[startIdx:], valQuote) + } + + if unescapeValueDoubleQuotes && valQuote == `"` { + return strings.Replace(line[startIdx:pos+startIdx], `\"`, `"`, -1), nil + } + return line[startIdx : pos+startIdx], nil + } + + lastChar := line[len(line)-1] + // Won't be able to reach here if value only contains whitespace + line = strings.TrimSpace(line) + trimmedLastChar := line[len(line)-1] + + // Check continuation lines when desired + if !ignoreContinuation && trimmedLastChar == '\\' { + return p.readContinuationLines(line[:len(line)-1]) + } + + // Check if ignore inline comment + if !ignoreInlineComment { + var i int + if spaceBeforeInlineComment { + i = strings.Index(line, " #") + if i == -1 { + i = strings.Index(line, " ;") + } + + } else { + i = strings.IndexAny(line, "#;") + } + + if i > -1 { + p.comment.WriteString(line[i:]) + line = strings.TrimSpace(line[:i]) + } + + } + + // Trim single and double quotes + if hasSurroundedQuote(line, '\'') || + hasSurroundedQuote(line, '"') { + line = line[1 : len(line)-1] + } else if len(valQuote) == 0 && unescapeValueCommentSymbols { + if strings.Contains(line, `\;`) { + line = strings.Replace(line, `\;`, ";", -1) + } + if strings.Contains(line, `\#`) { + line = strings.Replace(line, `\#`, "#", -1) + } + } else if allowPythonMultilines && lastChar == '\n' { + parserBufferPeekResult, _ := p.buf.Peek(parserBufferSize) + peekBuffer := bytes.NewBuffer(parserBufferPeekResult) + + identSize := -1 + val := line + + for { + peekData, peekErr := peekBuffer.ReadBytes('\n') + if peekErr != nil { + if peekErr == io.EOF { + return val, nil + } + return "", peekErr + } + + peekMatches := pythonMultiline.FindStringSubmatch(string(peekData)) + if len(peekMatches) != 3 { + return val, nil + } + + currentIdentSize := len(peekMatches[1]) + // NOTE: Return if not a python-ini multi-line value. + if currentIdentSize < 0 { + return val, nil + } + identSize = currentIdentSize + + // NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer. + _, err := p.readUntil('\n') + if err != nil { + return "", err + } + + val += fmt.Sprintf("\n%s", peekMatches[2]) + } + + // NOTE: If it was a Python multi-line value, + // return the appended value. + if identSize > 0 { + return val, nil + } + } + + return line, nil +} + +// parse parses data through an io.Reader. +func (f *File) parse(reader io.Reader) (err error) { + p := newParser(reader) + if err = p.BOM(); err != nil { + return fmt.Errorf("BOM: %v", err) + } + + // Ignore error because default section name is never empty string. + name := DEFAULT_SECTION + if f.options.Insensitive { + name = strings.ToLower(DEFAULT_SECTION) + } + section, _ := f.NewSection(name) + + // This "last" is not strictly equivalent to "previous one" if current key is not the first nested key + var isLastValueEmpty bool + var lastRegularKey *Key + + var line []byte + var inUnparseableSection bool + + // NOTE: Iterate and increase `currentPeekSize` until + // the size of the parser buffer is found. + // TODO(unknwon): When Golang 1.10 is the lowest version supported, replace with `parserBufferSize := p.buf.Size()`. + parserBufferSize := 0 + // NOTE: Peek 1kb at a time. + currentPeekSize := 1024 + + if f.options.AllowPythonMultilineValues { + for { + peekBytes, _ := p.buf.Peek(currentPeekSize) + peekBytesLength := len(peekBytes) + + if parserBufferSize >= peekBytesLength { + break + } + + currentPeekSize *= 2 + parserBufferSize = peekBytesLength + } + } + + for !p.isEOF { + line, err = p.readUntil('\n') + if err != nil { + return err + } + + if f.options.AllowNestedValues && + isLastValueEmpty && len(line) > 0 { + if line[0] == ' ' || line[0] == '\t' { + lastRegularKey.addNestedValue(string(bytes.TrimSpace(line))) + continue + } + } + + line = bytes.TrimLeftFunc(line, unicode.IsSpace) + if len(line) == 0 { + continue + } + + // Comments + if line[0] == '#' || line[0] == ';' { + // Note: we do not care ending line break, + // it is needed for adding second line, + // so just clean it once at the end when set to value. + p.comment.Write(line) + continue + } + + // Section + if line[0] == '[' { + // Read to the next ']' (TODO: support quoted strings) + closeIdx := bytes.LastIndexByte(line, ']') + if closeIdx == -1 { + return fmt.Errorf("unclosed section: %s", line) + } + + name := string(line[1:closeIdx]) + section, err = f.NewSection(name) + if err != nil { + return err + } + + comment, has := cleanComment(line[closeIdx+1:]) + if has { + p.comment.Write(comment) + } + + section.Comment = strings.TrimSpace(p.comment.String()) + + // Reset aotu-counter and comments + p.comment.Reset() + p.count = 1 + + inUnparseableSection = false + for i := range f.options.UnparseableSections { + if f.options.UnparseableSections[i] == name || + (f.options.Insensitive && strings.ToLower(f.options.UnparseableSections[i]) == strings.ToLower(name)) { + inUnparseableSection = true + continue + } + } + continue + } + + if inUnparseableSection { + section.isRawSection = true + section.rawBody += string(line) + continue + } + + kname, offset, err := readKeyName(line) + if err != nil { + // Treat as boolean key when desired, and whole line is key name. + if IsErrDelimiterNotFound(err) { + switch { + case f.options.AllowBooleanKeys: + kname, err := p.readValue(line, + parserBufferSize, + f.options.IgnoreContinuation, + f.options.IgnoreInlineComment, + f.options.UnescapeValueDoubleQuotes, + f.options.UnescapeValueCommentSymbols, + f.options.AllowPythonMultilineValues, + f.options.SpaceBeforeInlineComment) + if err != nil { + return err + } + key, err := section.NewBooleanKey(kname) + if err != nil { + return err + } + key.Comment = strings.TrimSpace(p.comment.String()) + p.comment.Reset() + continue + + case f.options.SkipUnrecognizableLines: + continue + } + } + return err + } + + // Auto increment. + isAutoIncr := false + if kname == "-" { + isAutoIncr = true + kname = "#" + strconv.Itoa(p.count) + p.count++ + } + + value, err := p.readValue(line[offset:], + parserBufferSize, + f.options.IgnoreContinuation, + f.options.IgnoreInlineComment, + f.options.UnescapeValueDoubleQuotes, + f.options.UnescapeValueCommentSymbols, + f.options.AllowPythonMultilineValues, + f.options.SpaceBeforeInlineComment) + if err != nil { + return err + } + isLastValueEmpty = len(value) == 0 + + key, err := section.NewKey(kname, value) + if err != nil { + return err + } + key.isAutoIncrement = isAutoIncr + key.Comment = strings.TrimSpace(p.comment.String()) + p.comment.Reset() + lastRegularKey = key + } + return nil +} diff --git a/vendor/github.com/go-ini/ini/section.go b/vendor/github.com/go-ini/ini/section.go new file mode 100644 index 000000000000..340a1efad7fc --- /dev/null +++ b/vendor/github.com/go-ini/ini/section.go @@ -0,0 +1,258 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "errors" + "fmt" + "strings" +) + +// Section represents a config section. +type Section struct { + f *File + Comment string + name string + keys map[string]*Key + keyList []string + keysHash map[string]string + + isRawSection bool + rawBody string +} + +func newSection(f *File, name string) *Section { + return &Section{ + f: f, + name: name, + keys: make(map[string]*Key), + keyList: make([]string, 0, 10), + keysHash: make(map[string]string), + } +} + +// Name returns name of Section. +func (s *Section) Name() string { + return s.name +} + +// Body returns rawBody of Section if the section was marked as unparseable. +// It still follows the other rules of the INI format surrounding leading/trailing whitespace. +func (s *Section) Body() string { + return strings.TrimSpace(s.rawBody) +} + +// SetBody updates body content only if section is raw. +func (s *Section) SetBody(body string) { + if !s.isRawSection { + return + } + s.rawBody = body +} + +// NewKey creates a new key to given section. +func (s *Section) NewKey(name, val string) (*Key, error) { + if len(name) == 0 { + return nil, errors.New("error creating new key: empty key name") + } else if s.f.options.Insensitive { + name = strings.ToLower(name) + } + + if s.f.BlockMode { + s.f.lock.Lock() + defer s.f.lock.Unlock() + } + + if inSlice(name, s.keyList) { + if s.f.options.AllowShadows { + if err := s.keys[name].addShadow(val); err != nil { + return nil, err + } + } else { + s.keys[name].value = val + s.keysHash[name] = val + } + return s.keys[name], nil + } + + s.keyList = append(s.keyList, name) + s.keys[name] = newKey(s, name, val) + s.keysHash[name] = val + return s.keys[name], nil +} + +// NewBooleanKey creates a new boolean type key to given section. +func (s *Section) NewBooleanKey(name string) (*Key, error) { + key, err := s.NewKey(name, "true") + if err != nil { + return nil, err + } + + key.isBooleanType = true + return key, nil +} + +// GetKey returns key in section by given name. +func (s *Section) GetKey(name string) (*Key, error) { + // FIXME: change to section level lock? + if s.f.BlockMode { + s.f.lock.RLock() + } + if s.f.options.Insensitive { + name = strings.ToLower(name) + } + key := s.keys[name] + if s.f.BlockMode { + s.f.lock.RUnlock() + } + + if key == nil { + // Check if it is a child-section. + sname := s.name + for { + if i := strings.LastIndex(sname, "."); i > -1 { + sname = sname[:i] + sec, err := s.f.GetSection(sname) + if err != nil { + continue + } + return sec.GetKey(name) + } else { + break + } + } + return nil, fmt.Errorf("error when getting key of section '%s': key '%s' not exists", s.name, name) + } + return key, nil +} + +// HasKey returns true if section contains a key with given name. +func (s *Section) HasKey(name string) bool { + key, _ := s.GetKey(name) + return key != nil +} + +// Haskey is a backwards-compatible name for HasKey. +// TODO: delete me in v2 +func (s *Section) Haskey(name string) bool { + return s.HasKey(name) +} + +// HasValue returns true if section contains given raw value. +func (s *Section) HasValue(value string) bool { + if s.f.BlockMode { + s.f.lock.RLock() + defer s.f.lock.RUnlock() + } + + for _, k := range s.keys { + if value == k.value { + return true + } + } + return false +} + +// Key assumes named Key exists in section and returns a zero-value when not. +func (s *Section) Key(name string) *Key { + key, err := s.GetKey(name) + if err != nil { + // It's OK here because the only possible error is empty key name, + // but if it's empty, this piece of code won't be executed. + key, _ = s.NewKey(name, "") + return key + } + return key +} + +// Keys returns list of keys of section. +func (s *Section) Keys() []*Key { + keys := make([]*Key, len(s.keyList)) + for i := range s.keyList { + keys[i] = s.Key(s.keyList[i]) + } + return keys +} + +// ParentKeys returns list of keys of parent section. +func (s *Section) ParentKeys() []*Key { + var parentKeys []*Key + sname := s.name + for { + if i := strings.LastIndex(sname, "."); i > -1 { + sname = sname[:i] + sec, err := s.f.GetSection(sname) + if err != nil { + continue + } + parentKeys = append(parentKeys, sec.Keys()...) + } else { + break + } + + } + return parentKeys +} + +// KeyStrings returns list of key names of section. +func (s *Section) KeyStrings() []string { + list := make([]string, len(s.keyList)) + copy(list, s.keyList) + return list +} + +// KeysHash returns keys hash consisting of names and values. +func (s *Section) KeysHash() map[string]string { + if s.f.BlockMode { + s.f.lock.RLock() + defer s.f.lock.RUnlock() + } + + hash := map[string]string{} + for key, value := range s.keysHash { + hash[key] = value + } + return hash +} + +// DeleteKey deletes a key from section. +func (s *Section) DeleteKey(name string) { + if s.f.BlockMode { + s.f.lock.Lock() + defer s.f.lock.Unlock() + } + + for i, k := range s.keyList { + if k == name { + s.keyList = append(s.keyList[:i], s.keyList[i+1:]...) + delete(s.keys, name) + return + } + } +} + +// ChildSections returns a list of child sections of current section. +// For example, "[parent.child1]" and "[parent.child12]" are child sections +// of section "[parent]". +func (s *Section) ChildSections() []*Section { + prefix := s.name + "." + children := make([]*Section, 0, 3) + for _, name := range s.f.sectionList { + if strings.HasPrefix(name, prefix) { + children = append(children, s.f.sections[name]) + } + } + return children +} diff --git a/vendor/github.com/go-ini/ini/struct.go b/vendor/github.com/go-ini/ini/struct.go new file mode 100644 index 000000000000..9719dc6985a1 --- /dev/null +++ b/vendor/github.com/go-ini/ini/struct.go @@ -0,0 +1,512 @@ +// Copyright 2014 Unknwon +// +// Licensed under the Apache License, Version 2.0 (the "License"): you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +package ini + +import ( + "bytes" + "errors" + "fmt" + "reflect" + "strings" + "time" + "unicode" +) + +// NameMapper represents a ini tag name mapper. +type NameMapper func(string) string + +// Built-in name getters. +var ( + // AllCapsUnderscore converts to format ALL_CAPS_UNDERSCORE. + AllCapsUnderscore NameMapper = func(raw string) string { + newstr := make([]rune, 0, len(raw)) + for i, chr := range raw { + if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { + if i > 0 { + newstr = append(newstr, '_') + } + } + newstr = append(newstr, unicode.ToUpper(chr)) + } + return string(newstr) + } + // TitleUnderscore converts to format title_underscore. + TitleUnderscore NameMapper = func(raw string) string { + newstr := make([]rune, 0, len(raw)) + for i, chr := range raw { + if isUpper := 'A' <= chr && chr <= 'Z'; isUpper { + if i > 0 { + newstr = append(newstr, '_') + } + chr -= ('A' - 'a') + } + newstr = append(newstr, chr) + } + return string(newstr) + } +) + +func (s *Section) parseFieldName(raw, actual string) string { + if len(actual) > 0 { + return actual + } + if s.f.NameMapper != nil { + return s.f.NameMapper(raw) + } + return raw +} + +func parseDelim(actual string) string { + if len(actual) > 0 { + return actual + } + return "," +} + +var reflectTime = reflect.TypeOf(time.Now()).Kind() + +// setSliceWithProperType sets proper values to slice based on its type. +func setSliceWithProperType(key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { + var strs []string + if allowShadow { + strs = key.StringsWithShadows(delim) + } else { + strs = key.Strings(delim) + } + + numVals := len(strs) + if numVals == 0 { + return nil + } + + var vals interface{} + var err error + + sliceOf := field.Type().Elem().Kind() + switch sliceOf { + case reflect.String: + vals = strs + case reflect.Int: + vals, err = key.parseInts(strs, true, false) + case reflect.Int64: + vals, err = key.parseInt64s(strs, true, false) + case reflect.Uint: + vals, err = key.parseUints(strs, true, false) + case reflect.Uint64: + vals, err = key.parseUint64s(strs, true, false) + case reflect.Float64: + vals, err = key.parseFloat64s(strs, true, false) + case reflectTime: + vals, err = key.parseTimesFormat(time.RFC3339, strs, true, false) + default: + return fmt.Errorf("unsupported type '[]%s'", sliceOf) + } + if err != nil && isStrict { + return err + } + + slice := reflect.MakeSlice(field.Type(), numVals, numVals) + for i := 0; i < numVals; i++ { + switch sliceOf { + case reflect.String: + slice.Index(i).Set(reflect.ValueOf(vals.([]string)[i])) + case reflect.Int: + slice.Index(i).Set(reflect.ValueOf(vals.([]int)[i])) + case reflect.Int64: + slice.Index(i).Set(reflect.ValueOf(vals.([]int64)[i])) + case reflect.Uint: + slice.Index(i).Set(reflect.ValueOf(vals.([]uint)[i])) + case reflect.Uint64: + slice.Index(i).Set(reflect.ValueOf(vals.([]uint64)[i])) + case reflect.Float64: + slice.Index(i).Set(reflect.ValueOf(vals.([]float64)[i])) + case reflectTime: + slice.Index(i).Set(reflect.ValueOf(vals.([]time.Time)[i])) + } + } + field.Set(slice) + return nil +} + +func wrapStrictError(err error, isStrict bool) error { + if isStrict { + return err + } + return nil +} + +// setWithProperType sets proper value to field based on its type, +// but it does not return error for failing parsing, +// because we want to use default value that is already assigned to strcut. +func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error { + switch t.Kind() { + case reflect.String: + if len(key.String()) == 0 { + return nil + } + field.SetString(key.String()) + case reflect.Bool: + boolVal, err := key.Bool() + if err != nil { + return wrapStrictError(err, isStrict) + } + field.SetBool(boolVal) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + durationVal, err := key.Duration() + // Skip zero value + if err == nil && int64(durationVal) > 0 { + field.Set(reflect.ValueOf(durationVal)) + return nil + } + + intVal, err := key.Int64() + if err != nil { + return wrapStrictError(err, isStrict) + } + field.SetInt(intVal) + // byte is an alias for uint8, so supporting uint8 breaks support for byte + case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64: + durationVal, err := key.Duration() + // Skip zero value + if err == nil && int(durationVal) > 0 { + field.Set(reflect.ValueOf(durationVal)) + return nil + } + + uintVal, err := key.Uint64() + if err != nil { + return wrapStrictError(err, isStrict) + } + field.SetUint(uintVal) + + case reflect.Float32, reflect.Float64: + floatVal, err := key.Float64() + if err != nil { + return wrapStrictError(err, isStrict) + } + field.SetFloat(floatVal) + case reflectTime: + timeVal, err := key.Time() + if err != nil { + return wrapStrictError(err, isStrict) + } + field.Set(reflect.ValueOf(timeVal)) + case reflect.Slice: + return setSliceWithProperType(key, field, delim, allowShadow, isStrict) + default: + return fmt.Errorf("unsupported type '%s'", t) + } + return nil +} + +func parseTagOptions(tag string) (rawName string, omitEmpty bool, allowShadow bool) { + opts := strings.SplitN(tag, ",", 3) + rawName = opts[0] + if len(opts) > 1 { + omitEmpty = opts[1] == "omitempty" + } + if len(opts) > 2 { + allowShadow = opts[2] == "allowshadow" + } + return rawName, omitEmpty, allowShadow +} + +func (s *Section) mapTo(val reflect.Value, isStrict bool) error { + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + typ := val.Type() + + for i := 0; i < typ.NumField(); i++ { + field := val.Field(i) + tpField := typ.Field(i) + + tag := tpField.Tag.Get("ini") + if tag == "-" { + continue + } + + rawName, _, allowShadow := parseTagOptions(tag) + fieldName := s.parseFieldName(tpField.Name, rawName) + if len(fieldName) == 0 || !field.CanSet() { + continue + } + + isAnonymous := tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous + isStruct := tpField.Type.Kind() == reflect.Struct + if isAnonymous { + field.Set(reflect.New(tpField.Type.Elem())) + } + + if isAnonymous || isStruct { + if sec, err := s.f.GetSection(fieldName); err == nil { + if err = sec.mapTo(field, isStrict); err != nil { + return fmt.Errorf("error mapping field(%s): %v", fieldName, err) + } + continue + } + } + + if key, err := s.GetKey(fieldName); err == nil { + delim := parseDelim(tpField.Tag.Get("delim")) + if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil { + return fmt.Errorf("error mapping field(%s): %v", fieldName, err) + } + } + } + return nil +} + +// MapTo maps section to given struct. +func (s *Section) MapTo(v interface{}) error { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return errors.New("cannot map to non-pointer struct") + } + + return s.mapTo(val, false) +} + +// MapTo maps section to given struct in strict mode, +// which returns all possible error including value parsing error. +func (s *Section) StrictMapTo(v interface{}) error { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return errors.New("cannot map to non-pointer struct") + } + + return s.mapTo(val, true) +} + +// MapTo maps file to given struct. +func (f *File) MapTo(v interface{}) error { + return f.Section("").MapTo(v) +} + +// MapTo maps file to given struct in strict mode, +// which returns all possible error including value parsing error. +func (f *File) StrictMapTo(v interface{}) error { + return f.Section("").StrictMapTo(v) +} + +// MapTo maps data sources to given struct with name mapper. +func MapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { + cfg, err := Load(source, others...) + if err != nil { + return err + } + cfg.NameMapper = mapper + return cfg.MapTo(v) +} + +// StrictMapToWithMapper maps data sources to given struct with name mapper in strict mode, +// which returns all possible error including value parsing error. +func StrictMapToWithMapper(v interface{}, mapper NameMapper, source interface{}, others ...interface{}) error { + cfg, err := Load(source, others...) + if err != nil { + return err + } + cfg.NameMapper = mapper + return cfg.StrictMapTo(v) +} + +// MapTo maps data sources to given struct. +func MapTo(v, source interface{}, others ...interface{}) error { + return MapToWithMapper(v, nil, source, others...) +} + +// StrictMapTo maps data sources to given struct in strict mode, +// which returns all possible error including value parsing error. +func StrictMapTo(v, source interface{}, others ...interface{}) error { + return StrictMapToWithMapper(v, nil, source, others...) +} + +// reflectSliceWithProperType does the opposite thing as setSliceWithProperType. +func reflectSliceWithProperType(key *Key, field reflect.Value, delim string) error { + slice := field.Slice(0, field.Len()) + if field.Len() == 0 { + return nil + } + + var buf bytes.Buffer + sliceOf := field.Type().Elem().Kind() + for i := 0; i < field.Len(); i++ { + switch sliceOf { + case reflect.String: + buf.WriteString(slice.Index(i).String()) + case reflect.Int, reflect.Int64: + buf.WriteString(fmt.Sprint(slice.Index(i).Int())) + case reflect.Uint, reflect.Uint64: + buf.WriteString(fmt.Sprint(slice.Index(i).Uint())) + case reflect.Float64: + buf.WriteString(fmt.Sprint(slice.Index(i).Float())) + case reflectTime: + buf.WriteString(slice.Index(i).Interface().(time.Time).Format(time.RFC3339)) + default: + return fmt.Errorf("unsupported type '[]%s'", sliceOf) + } + buf.WriteString(delim) + } + key.SetValue(buf.String()[:buf.Len()-1]) + return nil +} + +// reflectWithProperType does the opposite thing as setWithProperType. +func reflectWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string) error { + switch t.Kind() { + case reflect.String: + key.SetValue(field.String()) + case reflect.Bool: + key.SetValue(fmt.Sprint(field.Bool())) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + key.SetValue(fmt.Sprint(field.Int())) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + key.SetValue(fmt.Sprint(field.Uint())) + case reflect.Float32, reflect.Float64: + key.SetValue(fmt.Sprint(field.Float())) + case reflectTime: + key.SetValue(fmt.Sprint(field.Interface().(time.Time).Format(time.RFC3339))) + case reflect.Slice: + return reflectSliceWithProperType(key, field, delim) + default: + return fmt.Errorf("unsupported type '%s'", t) + } + return nil +} + +// CR: copied from encoding/json/encode.go with modifications of time.Time support. +// TODO: add more test coverage. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflectTime: + t, ok := v.Interface().(time.Time) + return ok && t.IsZero() + } + return false +} + +func (s *Section) reflectFrom(val reflect.Value) error { + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + typ := val.Type() + + for i := 0; i < typ.NumField(); i++ { + field := val.Field(i) + tpField := typ.Field(i) + + tag := tpField.Tag.Get("ini") + if tag == "-" { + continue + } + + opts := strings.SplitN(tag, ",", 2) + if len(opts) == 2 && opts[1] == "omitempty" && isEmptyValue(field) { + continue + } + + fieldName := s.parseFieldName(tpField.Name, opts[0]) + if len(fieldName) == 0 || !field.CanSet() { + continue + } + + if (tpField.Type.Kind() == reflect.Ptr && tpField.Anonymous) || + (tpField.Type.Kind() == reflect.Struct && tpField.Type.Name() != "Time") { + // Note: The only error here is section doesn't exist. + sec, err := s.f.GetSection(fieldName) + if err != nil { + // Note: fieldName can never be empty here, ignore error. + sec, _ = s.f.NewSection(fieldName) + } + + // Add comment from comment tag + if len(sec.Comment) == 0 { + sec.Comment = tpField.Tag.Get("comment") + } + + if err = sec.reflectFrom(field); err != nil { + return fmt.Errorf("error reflecting field (%s): %v", fieldName, err) + } + continue + } + + // Note: Same reason as secion. + key, err := s.GetKey(fieldName) + if err != nil { + key, _ = s.NewKey(fieldName, "") + } + + // Add comment from comment tag + if len(key.Comment) == 0 { + key.Comment = tpField.Tag.Get("comment") + } + + if err = reflectWithProperType(tpField.Type, key, field, parseDelim(tpField.Tag.Get("delim"))); err != nil { + return fmt.Errorf("error reflecting field (%s): %v", fieldName, err) + } + + } + return nil +} + +// ReflectFrom reflects secion from given struct. +func (s *Section) ReflectFrom(v interface{}) error { + typ := reflect.TypeOf(v) + val := reflect.ValueOf(v) + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + val = val.Elem() + } else { + return errors.New("cannot reflect from non-pointer struct") + } + + return s.reflectFrom(val) +} + +// ReflectFrom reflects file from given struct. +func (f *File) ReflectFrom(v interface{}) error { + return f.Section("").ReflectFrom(v) +} + +// ReflectFrom reflects data sources from given struct with name mapper. +func ReflectFromWithMapper(cfg *File, v interface{}, mapper NameMapper) error { + cfg.NameMapper = mapper + return cfg.ReflectFrom(v) +} + +// ReflectFrom reflects data sources from given struct. +func ReflectFrom(cfg *File, v interface{}) error { + return ReflectFromWithMapper(cfg, v, nil) +} diff --git a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md b/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..469b44907a09 --- /dev/null +++ b/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/imdario/mergo/LICENSE b/vendor/github.com/imdario/mergo/LICENSE new file mode 100644 index 000000000000..686680298da2 --- /dev/null +++ b/vendor/github.com/imdario/mergo/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2013 Dario Castañé. All rights reserved. +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/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md new file mode 100644 index 000000000000..8b76f1fbf33a --- /dev/null +++ b/vendor/github.com/imdario/mergo/README.md @@ -0,0 +1,222 @@ +# Mergo + +A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. + +Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche. + +## Status + +It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild). + +[![GoDoc][3]][4] +[![GoCard][5]][6] +[![Build Status][1]][2] +[![Coverage Status][7]][8] +[![Sourcegraph][9]][10] + +[1]: https://travis-ci.org/imdario/mergo.png +[2]: https://travis-ci.org/imdario/mergo +[3]: https://godoc.org/github.com/imdario/mergo?status.svg +[4]: https://godoc.org/github.com/imdario/mergo +[5]: https://goreportcard.com/badge/imdario/mergo +[6]: https://goreportcard.com/report/github.com/imdario/mergo +[7]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master +[8]: https://coveralls.io/github/imdario/mergo?branch=master +[9]: https://sourcegraph.com/github.com/imdario/mergo/-/badge.svg +[10]: https://sourcegraph.com/github.com/imdario/mergo?badge + +### Latest release + +[Release v0.3.6](https://github.com/imdario/mergo/releases/tag/v0.3.6). + +### Important note + +Please keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2) Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). An optional/variadic argument has been added, so it won't break existing code. + +If you were using Mergo **before** April 6th 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause (I hope it won't!) in existing projects after the change (release 0.2.0). + +### Donations + +If Mergo is useful to you, consider buying me a coffee, a beer or making a monthly donation so I can keep building great free software. :heart_eyes: + +Buy Me a Coffee at ko-fi.com +[![Beerpay](https://beerpay.io/imdario/mergo/badge.svg)](https://beerpay.io/imdario/mergo) +[![Beerpay](https://beerpay.io/imdario/mergo/make-wish.svg)](https://beerpay.io/imdario/mergo) +Donate using Liberapay + +### Mergo in the wild + +- [moby/moby](https://github.com/moby/moby) +- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) +- [vmware/dispatch](https://github.com/vmware/dispatch) +- [Shopify/themekit](https://github.com/Shopify/themekit) +- [imdario/zas](https://github.com/imdario/zas) +- [matcornic/hermes](https://github.com/matcornic/hermes) +- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go) +- [kataras/iris](https://github.com/kataras/iris) +- [michaelsauter/crane](https://github.com/michaelsauter/crane) +- [go-task/task](https://github.com/go-task/task) +- [sensu/uchiwa](https://github.com/sensu/uchiwa) +- [ory/hydra](https://github.com/ory/hydra) +- [sisatech/vcli](https://github.com/sisatech/vcli) +- [dairycart/dairycart](https://github.com/dairycart/dairycart) +- [projectcalico/felix](https://github.com/projectcalico/felix) +- [resin-os/balena](https://github.com/resin-os/balena) +- [go-kivik/kivik](https://github.com/go-kivik/kivik) +- [Telefonica/govice](https://github.com/Telefonica/govice) +- [supergiant/supergiant](supergiant/supergiant) +- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce) +- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) +- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel) +- [EagerIO/Stout](https://github.com/EagerIO/Stout) +- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) +- [russross/canvasassignments](https://github.com/russross/canvasassignments) +- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api) +- [casualjim/exeggutor](https://github.com/casualjim/exeggutor) +- [divshot/gitling](https://github.com/divshot/gitling) +- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl) +- [andrerocker/deploy42](https://github.com/andrerocker/deploy42) +- [elwinar/rambler](https://github.com/elwinar/rambler) +- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman) +- [jfbus/impressionist](https://github.com/jfbus/impressionist) +- [Jmeyering/zealot](https://github.com/Jmeyering/zealot) +- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host) +- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go) +- [thoas/picfit](https://github.com/thoas/picfit) +- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) +- [jnuthong/item_search](https://github.com/jnuthong/item_search) +- [bukalapak/snowboard](https://github.com/bukalapak/snowboard) + +## Installation + + go get github.com/imdario/mergo + + // use in your .go code + import ( + "github.com/imdario/mergo" + ) + +## Usage + +You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as [they are not considered zero values](https://golang.org/ref/spec#The_zero_value) either. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). + +```go +if err := mergo.Merge(&dst, src); err != nil { + // ... +} +``` + +Also, you can merge overwriting values using the transformer `WithOverride`. + +```go +if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil { + // ... +} +``` + +Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field. + +```go +if err := mergo.Map(&dst, srcMap); err != nil { + // ... +} +``` + +Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as `map[string]interface{}`. They will be just assigned as values. + +More information and examples in [godoc documentation](http://godoc.org/github.com/imdario/mergo). + +### Nice example + +```go +package main + +import ( + "fmt" + "github.com/imdario/mergo" +) + +type Foo struct { + A string + B int64 +} + +func main() { + src := Foo{ + A: "one", + B: 2, + } + dest := Foo{ + A: "two", + } + mergo.Merge(&dest, src) + fmt.Println(dest) + // Will print + // {two 2} +} +``` + +Note: if test are failing due missing package, please execute: + + go get gopkg.in/yaml.v2 + +### Transformers + +Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, `time.Time` is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero `time.Time`? + +```go +package main + +import ( + "fmt" + "github.com/imdario/mergo" + "reflect" + "time" +) + +type timeTransfomer struct { +} + +func (t timeTransfomer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error { + if typ == reflect.TypeOf(time.Time{}) { + return func(dst, src reflect.Value) error { + if dst.CanSet() { + isZero := dst.MethodByName("IsZero") + result := isZero.Call([]reflect.Value{}) + if result[0].Bool() { + dst.Set(src) + } + } + return nil + } + } + return nil +} + +type Snapshot struct { + Time time.Time + // ... +} + +func main() { + src := Snapshot{time.Now()} + dest := Snapshot{} + mergo.Merge(&dest, src, mergo.WithTransformers(timeTransfomer{})) + fmt.Println(dest) + // Will print + // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } +} +``` + + +## Contact me + +If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario) + +## About + +Written by [Dario Castañé](http://dario.im). + +## License + +[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE). diff --git a/vendor/github.com/imdario/mergo/doc.go b/vendor/github.com/imdario/mergo/doc.go new file mode 100644 index 000000000000..6e9aa7baf354 --- /dev/null +++ b/vendor/github.com/imdario/mergo/doc.go @@ -0,0 +1,44 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 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 mergo merges same-type structs and maps by setting default values in zero-value fields. + +Mergo won't merge unexported (private) fields but will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). + +Usage + +From my own work-in-progress project: + + type networkConfig struct { + Protocol string + Address string + ServerType string `json: "server_type"` + Port uint16 + } + + type FssnConfig struct { + Network networkConfig + } + + var fssnDefault = FssnConfig { + networkConfig { + "tcp", + "127.0.0.1", + "http", + 31560, + }, + } + + // Inside a function [...] + + if err := mergo.Merge(&config, fssnDefault); err != nil { + log.Fatal(err) + } + + // More code [...] + +*/ +package mergo diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go new file mode 100644 index 000000000000..6ea38e636b64 --- /dev/null +++ b/vendor/github.com/imdario/mergo/map.go @@ -0,0 +1,174 @@ +// Copyright 2014 Dario Castañé. All rights reserved. +// Copyright 2009 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. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "fmt" + "reflect" + "unicode" + "unicode/utf8" +) + +func changeInitialCase(s string, mapper func(rune) rune) string { + if s == "" { + return s + } + r, n := utf8.DecodeRuneInString(s) + return string(mapper(r)) + s[n:] +} + +func isExported(field reflect.StructField) bool { + r, _ := utf8.DecodeRuneInString(field.Name) + return r >= 'A' && r <= 'Z' +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { + overwrite := config.Overwrite + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + zeroValue := reflect.Value{} + switch dst.Kind() { + case reflect.Map: + dstMap := dst.Interface().(map[string]interface{}) + for i, n := 0, src.NumField(); i < n; i++ { + srcType := src.Type() + field := srcType.Field(i) + if !isExported(field) { + continue + } + fieldName := field.Name + fieldName = changeInitialCase(fieldName, unicode.ToLower) + if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) { + dstMap[fieldName] = src.Field(i).Interface() + } + } + case reflect.Ptr: + if dst.IsNil() { + v := reflect.New(dst.Type().Elem()) + dst.Set(v) + } + dst = dst.Elem() + fallthrough + case reflect.Struct: + srcMap := src.Interface().(map[string]interface{}) + for key := range srcMap { + srcValue := srcMap[key] + fieldName := changeInitialCase(key, unicode.ToUpper) + dstElement := dst.FieldByName(fieldName) + if dstElement == zeroValue { + // We discard it because the field doesn't exist. + continue + } + srcElement := reflect.ValueOf(srcValue) + dstKind := dstElement.Kind() + srcKind := srcElement.Kind() + if srcKind == reflect.Ptr && dstKind != reflect.Ptr { + srcElement = srcElement.Elem() + srcKind = reflect.TypeOf(srcElement.Interface()).Kind() + } else if dstKind == reflect.Ptr { + // Can this work? I guess it can't. + if srcKind != reflect.Ptr && srcElement.CanAddr() { + srcPtr := srcElement.Addr() + srcElement = reflect.ValueOf(srcPtr) + srcKind = reflect.Ptr + } + } + + if !srcElement.IsValid() { + continue + } + if srcKind == dstKind { + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else if dstKind == reflect.Interface && dstElement.Kind() == reflect.Interface { + if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else if srcKind == reflect.Map { + if err = deepMap(dstElement, srcElement, visited, depth+1, config); err != nil { + return + } + } else { + return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind) + } + } + } + return +} + +// Map sets fields' values in dst from src. +// src can be a map with string keys or a struct. dst must be the opposite: +// if src is a map, dst must be a valid pointer to struct. If src is a struct, +// dst must be map[string]interface{}. +// It won't merge unexported (private) fields and will do recursively +// any exported field. +// If dst is a map, keys will be src fields' names in lower camel case. +// Missing key in src that doesn't match a field in dst will be skipped. This +// doesn't apply if dst is a map. +// This is separated method from Merge because it is cleaner and it keeps sane +// semantics: merging equal types, mapping different (restricted) types. +func Map(dst, src interface{}, opts ...func(*Config)) error { + return _map(dst, src, opts...) +} + +// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overridden by +// non-empty src attribute values. +// Deprecated: Use Map(…) with WithOverride +func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { + return _map(dst, src, append(opts, WithOverride)...) +} + +func _map(dst, src interface{}, opts ...func(*Config)) error { + var ( + vDst, vSrc reflect.Value + err error + ) + config := &Config{} + + for _, opt := range opts { + opt(config) + } + + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + // To be friction-less, we redirect equal-type arguments + // to deepMerge. Only because arguments can be anything. + if vSrc.Kind() == vDst.Kind() { + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) + } + switch vSrc.Kind() { + case reflect.Struct: + if vDst.Kind() != reflect.Map { + return ErrExpectedMapAsDestination + } + case reflect.Map: + if vDst.Kind() != reflect.Struct { + return ErrExpectedStructAsDestination + } + default: + return ErrNotSupported + } + return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, config) +} diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go new file mode 100644 index 000000000000..44f70a89d919 --- /dev/null +++ b/vendor/github.com/imdario/mergo/merge.go @@ -0,0 +1,252 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 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. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "fmt" + "reflect" +) + +func hasExportedField(dst reflect.Value) (exported bool) { + for i, n := 0, dst.NumField(); i < n; i++ { + field := dst.Type().Field(i) + if field.Anonymous && dst.Field(i).Kind() == reflect.Struct { + exported = exported || hasExportedField(dst.Field(i)) + } else { + exported = exported || len(field.PkgPath) == 0 + } + } + return +} + +type Config struct { + Overwrite bool + AppendSlice bool + Transformers Transformers +} + +type Transformers interface { + Transformer(reflect.Type) func(dst, src reflect.Value) error +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { + overwrite := config.Overwrite + + if !src.IsValid() { + return + } + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + + if config.Transformers != nil && !isEmptyValue(dst) { + if fn := config.Transformers.Transformer(dst.Type()); fn != nil { + err = fn(dst, src) + return + } + } + + switch dst.Kind() { + case reflect.Struct: + if hasExportedField(dst) { + for i, n := 0, dst.NumField(); i < n; i++ { + if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, config); err != nil { + return + } + } + } else { + if dst.CanSet() && !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } + case reflect.Map: + if dst.IsNil() && !src.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + for _, key := range src.MapKeys() { + srcElement := src.MapIndex(key) + if !srcElement.IsValid() { + continue + } + dstElement := dst.MapIndex(key) + switch srcElement.Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice: + if srcElement.IsNil() { + continue + } + fallthrough + default: + if !srcElement.CanInterface() { + continue + } + switch reflect.TypeOf(srcElement.Interface()).Kind() { + case reflect.Struct: + fallthrough + case reflect.Ptr: + fallthrough + case reflect.Map: + srcMapElm := srcElement + dstMapElm := dstElement + if srcMapElm.CanInterface() { + srcMapElm = reflect.ValueOf(srcMapElm.Interface()) + if dstMapElm.IsValid() { + dstMapElm = reflect.ValueOf(dstMapElm.Interface()) + } + } + if err = deepMerge(dstMapElm, srcMapElm, visited, depth+1, config); err != nil { + return + } + case reflect.Slice: + srcSlice := reflect.ValueOf(srcElement.Interface()) + + var dstSlice reflect.Value + if !dstElement.IsValid() || dstElement.IsNil() { + dstSlice = reflect.MakeSlice(srcSlice.Type(), 0, srcSlice.Len()) + } else { + dstSlice = reflect.ValueOf(dstElement.Interface()) + } + + if !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice { + dstSlice = srcSlice + } else if config.AppendSlice { + if srcSlice.Type() != dstSlice.Type() { + return fmt.Errorf("cannot append two slice with different type (%s, %s)", srcSlice.Type(), dstSlice.Type()) + } + dstSlice = reflect.AppendSlice(dstSlice, srcSlice) + } + dst.SetMapIndex(key, dstSlice) + } + } + if dstElement.IsValid() && reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map { + continue + } + + if srcElement.IsValid() && (overwrite || (!dstElement.IsValid() || isEmptyValue(dstElement))) { + if dst.IsNil() { + dst.Set(reflect.MakeMap(dst.Type())) + } + dst.SetMapIndex(key, srcElement) + } + } + case reflect.Slice: + if !dst.CanSet() { + break + } + if !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice { + dst.Set(src) + } else if config.AppendSlice { + if src.Type() != dst.Type() { + return fmt.Errorf("cannot append two slice with different type (%s, %s)", src.Type(), dst.Type()) + } + dst.Set(reflect.AppendSlice(dst, src)) + } + case reflect.Ptr: + fallthrough + case reflect.Interface: + if src.IsNil() { + break + } + if src.Kind() != reflect.Interface { + if dst.IsNil() || overwrite { + if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } else if src.Kind() == reflect.Ptr { + if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { + return + } + } else if dst.Elem().Type() == src.Type() { + if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil { + return + } + } else { + return ErrDifferentArgumentsTypes + } + break + } + if dst.IsNil() || overwrite { + if dst.CanSet() && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } else if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil { + return + } + default: + if dst.CanSet() && !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) { + dst.Set(src) + } + } + return +} + +// Merge will fill any empty for value type attributes on the dst struct using corresponding +// src attributes if they themselves are not empty. dst and src must be valid same-type structs +// and dst must be a pointer to struct. +// It won't merge unexported (private) fields and will do recursively any exported field. +func Merge(dst, src interface{}, opts ...func(*Config)) error { + return merge(dst, src, opts...) +} + +// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overriden by +// non-empty src attribute values. +// Deprecated: use Merge(…) with WithOverride +func MergeWithOverwrite(dst, src interface{}, opts ...func(*Config)) error { + return merge(dst, src, append(opts, WithOverride)...) +} + +// WithTransformers adds transformers to merge, allowing to customize the merging of some types. +func WithTransformers(transformers Transformers) func(*Config) { + return func(config *Config) { + config.Transformers = transformers + } +} + +// WithOverride will make merge override non-empty dst attributes with non-empty src attributes values. +func WithOverride(config *Config) { + config.Overwrite = true +} + +// WithAppendSlice will make merge append slices instead of overwriting it +func WithAppendSlice(config *Config) { + config.AppendSlice = true +} + +func merge(dst, src interface{}, opts ...func(*Config)) error { + var ( + vDst, vSrc reflect.Value + err error + ) + + config := &Config{} + + for _, opt := range opts { + opt(config) + } + + if vDst, vSrc, err = resolveValues(dst, src); err != nil { + return err + } + if vDst.Type() != vSrc.Type() { + return ErrDifferentArgumentsTypes + } + return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config) +} diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go new file mode 100644 index 000000000000..a82fea2fdccc --- /dev/null +++ b/vendor/github.com/imdario/mergo/mergo.go @@ -0,0 +1,97 @@ +// Copyright 2013 Dario Castañé. All rights reserved. +// Copyright 2009 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. + +// Based on src/pkg/reflect/deepequal.go from official +// golang's stdlib. + +package mergo + +import ( + "errors" + "reflect" +) + +// Errors reported by Mergo when it finds invalid arguments. +var ( + ErrNilArguments = errors.New("src and dst must not be nil") + ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type") + ErrNotSupported = errors.New("only structs and maps are supported") + ErrExpectedMapAsDestination = errors.New("dst was expected to be a map") + ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct") +) + +// During deepMerge, must keep track of checks that are +// in progress. The comparison algorithm assumes that all +// checks in progress are true when it reencounters them. +// Visited are stored in a map indexed by 17 * a1 + a2; +type visit struct { + ptr uintptr + typ reflect.Type + next *visit +} + +// From src/pkg/encoding/json/encode.go. +func isEmptyValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + if v.IsNil() { + return true + } + return isEmptyValue(v.Elem()) + case reflect.Func: + return v.IsNil() + case reflect.Invalid: + return true + } + return false +} + +func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) { + if dst == nil || src == nil { + err = ErrNilArguments + return + } + vDst = reflect.ValueOf(dst).Elem() + if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map { + err = ErrNotSupported + return + } + vSrc = reflect.ValueOf(src) + // We check if vSrc is a pointer to dereference it. + if vSrc.Kind() == reflect.Ptr { + vSrc = vSrc.Elem() + } + return +} + +// Traverses recursively both values, assigning src's fields values to dst. +// The map argument tracks comparisons that have already been seen, which allows +// short circuiting on recursive types. +func deeper(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) { + if dst.CanAddr() { + addr := dst.UnsafeAddr() + h := 17 * addr + seen := visited[h] + typ := dst.Type() + for p := seen; p != nil; p = p.next { + if p.ptr == addr && p.typ == typ { + return nil + } + } + // Remember, remember... + visited[h] = &visit{addr, typ, seen} + } + return // TODO refactor +} diff --git a/vendor/github.com/jmespath/go-jmespath/LICENSE b/vendor/github.com/jmespath/go-jmespath/LICENSE new file mode 100644 index 000000000000..b03310a91fde --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/LICENSE @@ -0,0 +1,13 @@ +Copyright 2015 James Saryerwinnie + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/jmespath/go-jmespath/Makefile b/vendor/github.com/jmespath/go-jmespath/Makefile new file mode 100644 index 000000000000..ad17bf0012e8 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/Makefile @@ -0,0 +1,44 @@ + +CMD = jpgo + +help: + @echo "Please use \`make ' where is one of" + @echo " test to run all the tests" + @echo " build to build the library and jp executable" + @echo " generate to run codegen" + + +generate: + go generate ./... + +build: + rm -f $(CMD) + go build ./... + rm -f cmd/$(CMD)/$(CMD) && cd cmd/$(CMD)/ && go build ./... + mv cmd/$(CMD)/$(CMD) . + +test: + go test -v ./... + +check: + go vet ./... + @echo "golint ./..." + @lint=`golint ./...`; \ + lint=`echo "$$lint" | grep -v "astnodetype_string.go" | grep -v "toktype_string.go"`; \ + echo "$$lint"; \ + if [ "$$lint" != "" ]; then exit 1; fi + +htmlc: + go test -coverprofile="/tmp/jpcov" && go tool cover -html="/tmp/jpcov" && unlink /tmp/jpcov + +buildfuzz: + go-fuzz-build github.com/jmespath/go-jmespath/fuzz + +fuzz: buildfuzz + go-fuzz -bin=./jmespath-fuzz.zip -workdir=fuzz/corpus + +bench: + go test -bench . -cpuprofile cpu.out + +pprof-cpu: + go tool pprof ./go-jmespath.test ./cpu.out diff --git a/vendor/github.com/jmespath/go-jmespath/README.md b/vendor/github.com/jmespath/go-jmespath/README.md new file mode 100644 index 000000000000..187ef676dc9c --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/README.md @@ -0,0 +1,7 @@ +# go-jmespath - A JMESPath implementation in Go + +[![Build Status](https://img.shields.io/travis/jmespath/go-jmespath.svg)](https://travis-ci.org/jmespath/go-jmespath) + + + +See http://jmespath.org for more info. diff --git a/vendor/github.com/jmespath/go-jmespath/api.go b/vendor/github.com/jmespath/go-jmespath/api.go new file mode 100644 index 000000000000..67df3fc1c878 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/api.go @@ -0,0 +1,12 @@ +package jmespath + +// Search evaluates a JMESPath expression against input data and returns the result. +func Search(expression string, data interface{}) (interface{}, error) { + intr := newInterpreter() + parser := NewParser() + ast, err := parser.Parse(expression) + if err != nil { + return nil, err + } + return intr.Execute(ast, data) +} diff --git a/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go b/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go new file mode 100644 index 000000000000..1cd2d239c969 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go @@ -0,0 +1,16 @@ +// generated by stringer -type astNodeType; DO NOT EDIT + +package jmespath + +import "fmt" + +const _astNodeType_name = "ASTEmptyASTComparatorASTCurrentNodeASTExpRefASTFunctionExpressionASTFieldASTFilterProjectionASTFlattenASTIdentityASTIndexASTIndexExpressionASTKeyValPairASTLiteralASTMultiSelectHashASTMultiSelectListASTOrExpressionASTAndExpressionASTNotExpressionASTPipeASTProjectionASTSubexpressionASTSliceASTValueProjection" + +var _astNodeType_index = [...]uint16{0, 8, 21, 35, 44, 65, 73, 92, 102, 113, 121, 139, 152, 162, 180, 198, 213, 229, 245, 252, 265, 281, 289, 307} + +func (i astNodeType) String() string { + if i < 0 || i >= astNodeType(len(_astNodeType_index)-1) { + return fmt.Sprintf("astNodeType(%d)", i) + } + return _astNodeType_name[_astNodeType_index[i]:_astNodeType_index[i+1]] +} diff --git a/vendor/github.com/jmespath/go-jmespath/functions.go b/vendor/github.com/jmespath/go-jmespath/functions.go new file mode 100644 index 000000000000..8a3f2ef0dce8 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/functions.go @@ -0,0 +1,840 @@ +package jmespath + +import ( + "encoding/json" + "errors" + "fmt" + "math" + "sort" + "strconv" + "strings" + "unicode/utf8" +) + +type jpFunction func(arguments []interface{}) (interface{}, error) + +type jpType string + +const ( + jpUnknown jpType = "unknown" + jpNumber jpType = "number" + jpString jpType = "string" + jpArray jpType = "array" + jpObject jpType = "object" + jpArrayNumber jpType = "array[number]" + jpArrayString jpType = "array[string]" + jpExpref jpType = "expref" + jpAny jpType = "any" +) + +type functionEntry struct { + name string + arguments []argSpec + handler jpFunction + hasExpRef bool +} + +type argSpec struct { + types []jpType + variadic bool +} + +type byExprString struct { + intr *treeInterpreter + node ASTNode + items []interface{} + hasError bool +} + +func (a *byExprString) Len() int { + return len(a.items) +} +func (a *byExprString) Swap(i, j int) { + a.items[i], a.items[j] = a.items[j], a.items[i] +} +func (a *byExprString) Less(i, j int) bool { + first, err := a.intr.Execute(a.node, a.items[i]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + ith, ok := first.(string) + if !ok { + a.hasError = true + return true + } + second, err := a.intr.Execute(a.node, a.items[j]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + jth, ok := second.(string) + if !ok { + a.hasError = true + return true + } + return ith < jth +} + +type byExprFloat struct { + intr *treeInterpreter + node ASTNode + items []interface{} + hasError bool +} + +func (a *byExprFloat) Len() int { + return len(a.items) +} +func (a *byExprFloat) Swap(i, j int) { + a.items[i], a.items[j] = a.items[j], a.items[i] +} +func (a *byExprFloat) Less(i, j int) bool { + first, err := a.intr.Execute(a.node, a.items[i]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + ith, ok := first.(float64) + if !ok { + a.hasError = true + return true + } + second, err := a.intr.Execute(a.node, a.items[j]) + if err != nil { + a.hasError = true + // Return a dummy value. + return true + } + jth, ok := second.(float64) + if !ok { + a.hasError = true + return true + } + return ith < jth +} + +type functionCaller struct { + functionTable map[string]functionEntry +} + +func newFunctionCaller() *functionCaller { + caller := &functionCaller{} + caller.functionTable = map[string]functionEntry{ + "length": functionEntry{ + name: "length", + arguments: []argSpec{ + argSpec{types: []jpType{jpString, jpArray, jpObject}}, + }, + handler: jpfLength, + }, + "starts_with": functionEntry{ + name: "starts_with", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpString}}, + }, + handler: jpfStartsWith, + }, + "abs": functionEntry{ + name: "abs", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfAbs, + }, + "avg": functionEntry{ + name: "avg", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber}}, + }, + handler: jpfAvg, + }, + "ceil": functionEntry{ + name: "ceil", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfCeil, + }, + "contains": functionEntry{ + name: "contains", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray, jpString}}, + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfContains, + }, + "ends_with": functionEntry{ + name: "ends_with", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpString}}, + }, + handler: jpfEndsWith, + }, + "floor": functionEntry{ + name: "floor", + arguments: []argSpec{ + argSpec{types: []jpType{jpNumber}}, + }, + handler: jpfFloor, + }, + "map": functionEntry{ + name: "amp", + arguments: []argSpec{ + argSpec{types: []jpType{jpExpref}}, + argSpec{types: []jpType{jpArray}}, + }, + handler: jpfMap, + hasExpRef: true, + }, + "max": functionEntry{ + name: "max", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber, jpArrayString}}, + }, + handler: jpfMax, + }, + "merge": functionEntry{ + name: "merge", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}, variadic: true}, + }, + handler: jpfMerge, + }, + "max_by": functionEntry{ + name: "max_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfMaxBy, + hasExpRef: true, + }, + "sum": functionEntry{ + name: "sum", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber}}, + }, + handler: jpfSum, + }, + "min": functionEntry{ + name: "min", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayNumber, jpArrayString}}, + }, + handler: jpfMin, + }, + "min_by": functionEntry{ + name: "min_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfMinBy, + hasExpRef: true, + }, + "type": functionEntry{ + name: "type", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfType, + }, + "keys": functionEntry{ + name: "keys", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}}, + }, + handler: jpfKeys, + }, + "values": functionEntry{ + name: "values", + arguments: []argSpec{ + argSpec{types: []jpType{jpObject}}, + }, + handler: jpfValues, + }, + "sort": functionEntry{ + name: "sort", + arguments: []argSpec{ + argSpec{types: []jpType{jpArrayString, jpArrayNumber}}, + }, + handler: jpfSort, + }, + "sort_by": functionEntry{ + name: "sort_by", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray}}, + argSpec{types: []jpType{jpExpref}}, + }, + handler: jpfSortBy, + hasExpRef: true, + }, + "join": functionEntry{ + name: "join", + arguments: []argSpec{ + argSpec{types: []jpType{jpString}}, + argSpec{types: []jpType{jpArrayString}}, + }, + handler: jpfJoin, + }, + "reverse": functionEntry{ + name: "reverse", + arguments: []argSpec{ + argSpec{types: []jpType{jpArray, jpString}}, + }, + handler: jpfReverse, + }, + "to_array": functionEntry{ + name: "to_array", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToArray, + }, + "to_string": functionEntry{ + name: "to_string", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToString, + }, + "to_number": functionEntry{ + name: "to_number", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}}, + }, + handler: jpfToNumber, + }, + "not_null": functionEntry{ + name: "not_null", + arguments: []argSpec{ + argSpec{types: []jpType{jpAny}, variadic: true}, + }, + handler: jpfNotNull, + }, + } + return caller +} + +func (e *functionEntry) resolveArgs(arguments []interface{}) ([]interface{}, error) { + if len(e.arguments) == 0 { + return arguments, nil + } + if !e.arguments[len(e.arguments)-1].variadic { + if len(e.arguments) != len(arguments) { + return nil, errors.New("incorrect number of args") + } + for i, spec := range e.arguments { + userArg := arguments[i] + err := spec.typeCheck(userArg) + if err != nil { + return nil, err + } + } + return arguments, nil + } + if len(arguments) < len(e.arguments) { + return nil, errors.New("Invalid arity.") + } + return arguments, nil +} + +func (a *argSpec) typeCheck(arg interface{}) error { + for _, t := range a.types { + switch t { + case jpNumber: + if _, ok := arg.(float64); ok { + return nil + } + case jpString: + if _, ok := arg.(string); ok { + return nil + } + case jpArray: + if _, ok := arg.([]interface{}); ok { + return nil + } + case jpObject: + if _, ok := arg.(map[string]interface{}); ok { + return nil + } + case jpArrayNumber: + if _, ok := toArrayNum(arg); ok { + return nil + } + case jpArrayString: + if _, ok := toArrayStr(arg); ok { + return nil + } + case jpAny: + return nil + case jpExpref: + if _, ok := arg.(expRef); ok { + return nil + } + } + } + return fmt.Errorf("Invalid type for: %v, expected: %#v", arg, a.types) +} + +func (f *functionCaller) CallFunction(name string, arguments []interface{}, intr *treeInterpreter) (interface{}, error) { + entry, ok := f.functionTable[name] + if !ok { + return nil, errors.New("unknown function: " + name) + } + resolvedArgs, err := entry.resolveArgs(arguments) + if err != nil { + return nil, err + } + if entry.hasExpRef { + var extra []interface{} + extra = append(extra, intr) + resolvedArgs = append(extra, resolvedArgs...) + } + return entry.handler(resolvedArgs) +} + +func jpfAbs(arguments []interface{}) (interface{}, error) { + num := arguments[0].(float64) + return math.Abs(num), nil +} + +func jpfLength(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if c, ok := arg.(string); ok { + return float64(utf8.RuneCountInString(c)), nil + } else if c, ok := arg.([]interface{}); ok { + return float64(len(c)), nil + } else if c, ok := arg.(map[string]interface{}); ok { + return float64(len(c)), nil + } + return nil, errors.New("could not compute length()") +} + +func jpfStartsWith(arguments []interface{}) (interface{}, error) { + search := arguments[0].(string) + prefix := arguments[1].(string) + return strings.HasPrefix(search, prefix), nil +} + +func jpfAvg(arguments []interface{}) (interface{}, error) { + // We've already type checked the value so we can safely use + // type assertions. + args := arguments[0].([]interface{}) + length := float64(len(args)) + numerator := 0.0 + for _, n := range args { + numerator += n.(float64) + } + return numerator / length, nil +} +func jpfCeil(arguments []interface{}) (interface{}, error) { + val := arguments[0].(float64) + return math.Ceil(val), nil +} +func jpfContains(arguments []interface{}) (interface{}, error) { + search := arguments[0] + el := arguments[1] + if searchStr, ok := search.(string); ok { + if elStr, ok := el.(string); ok { + return strings.Index(searchStr, elStr) != -1, nil + } + return false, nil + } + // Otherwise this is a generic contains for []interface{} + general := search.([]interface{}) + for _, item := range general { + if item == el { + return true, nil + } + } + return false, nil +} +func jpfEndsWith(arguments []interface{}) (interface{}, error) { + search := arguments[0].(string) + suffix := arguments[1].(string) + return strings.HasSuffix(search, suffix), nil +} +func jpfFloor(arguments []interface{}) (interface{}, error) { + val := arguments[0].(float64) + return math.Floor(val), nil +} +func jpfMap(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + exp := arguments[1].(expRef) + node := exp.ref + arr := arguments[2].([]interface{}) + mapped := make([]interface{}, 0, len(arr)) + for _, value := range arr { + current, err := intr.Execute(node, value) + if err != nil { + return nil, err + } + mapped = append(mapped, current) + } + return mapped, nil +} +func jpfMax(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item > best { + best = item + } + } + return best, nil + } + // Otherwise we're dealing with a max() of strings. + items, _ := toArrayStr(arguments[0]) + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item > best { + best = item + } + } + return best, nil +} +func jpfMerge(arguments []interface{}) (interface{}, error) { + final := make(map[string]interface{}) + for _, m := range arguments { + mapped := m.(map[string]interface{}) + for key, value := range mapped { + final[key] = value + } + } + return final, nil +} +func jpfMaxBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return nil, nil + } else if len(arr) == 1 { + return arr[0], nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + switch t := start.(type) { + case float64: + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(float64) + if !ok { + return nil, errors.New("invalid type, must be number") + } + if current > bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + case string: + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(string) + if !ok { + return nil, errors.New("invalid type, must be string") + } + if current > bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + default: + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfSum(arguments []interface{}) (interface{}, error) { + items, _ := toArrayNum(arguments[0]) + sum := 0.0 + for _, item := range items { + sum += item + } + return sum, nil +} + +func jpfMin(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item < best { + best = item + } + } + return best, nil + } + items, _ := toArrayStr(arguments[0]) + if len(items) == 0 { + return nil, nil + } + if len(items) == 1 { + return items[0], nil + } + best := items[0] + for _, item := range items[1:] { + if item < best { + best = item + } + } + return best, nil +} + +func jpfMinBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return nil, nil + } else if len(arr) == 1 { + return arr[0], nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + if t, ok := start.(float64); ok { + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(float64) + if !ok { + return nil, errors.New("invalid type, must be number") + } + if current < bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + } else if t, ok := start.(string); ok { + bestVal := t + bestItem := arr[0] + for _, item := range arr[1:] { + result, err := intr.Execute(node, item) + if err != nil { + return nil, err + } + current, ok := result.(string) + if !ok { + return nil, errors.New("invalid type, must be string") + } + if current < bestVal { + bestVal = current + bestItem = item + } + } + return bestItem, nil + } else { + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfType(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if _, ok := arg.(float64); ok { + return "number", nil + } + if _, ok := arg.(string); ok { + return "string", nil + } + if _, ok := arg.([]interface{}); ok { + return "array", nil + } + if _, ok := arg.(map[string]interface{}); ok { + return "object", nil + } + if arg == nil { + return "null", nil + } + if arg == true || arg == false { + return "boolean", nil + } + return nil, errors.New("unknown type") +} +func jpfKeys(arguments []interface{}) (interface{}, error) { + arg := arguments[0].(map[string]interface{}) + collected := make([]interface{}, 0, len(arg)) + for key := range arg { + collected = append(collected, key) + } + return collected, nil +} +func jpfValues(arguments []interface{}) (interface{}, error) { + arg := arguments[0].(map[string]interface{}) + collected := make([]interface{}, 0, len(arg)) + for _, value := range arg { + collected = append(collected, value) + } + return collected, nil +} +func jpfSort(arguments []interface{}) (interface{}, error) { + if items, ok := toArrayNum(arguments[0]); ok { + d := sort.Float64Slice(items) + sort.Stable(d) + final := make([]interface{}, len(d)) + for i, val := range d { + final[i] = val + } + return final, nil + } + // Otherwise we're dealing with sort()'ing strings. + items, _ := toArrayStr(arguments[0]) + d := sort.StringSlice(items) + sort.Stable(d) + final := make([]interface{}, len(d)) + for i, val := range d { + final[i] = val + } + return final, nil +} +func jpfSortBy(arguments []interface{}) (interface{}, error) { + intr := arguments[0].(*treeInterpreter) + arr := arguments[1].([]interface{}) + exp := arguments[2].(expRef) + node := exp.ref + if len(arr) == 0 { + return arr, nil + } else if len(arr) == 1 { + return arr, nil + } + start, err := intr.Execute(node, arr[0]) + if err != nil { + return nil, err + } + if _, ok := start.(float64); ok { + sortable := &byExprFloat{intr, node, arr, false} + sort.Stable(sortable) + if sortable.hasError { + return nil, errors.New("error in sort_by comparison") + } + return arr, nil + } else if _, ok := start.(string); ok { + sortable := &byExprString{intr, node, arr, false} + sort.Stable(sortable) + if sortable.hasError { + return nil, errors.New("error in sort_by comparison") + } + return arr, nil + } else { + return nil, errors.New("invalid type, must be number of string") + } +} +func jpfJoin(arguments []interface{}) (interface{}, error) { + sep := arguments[0].(string) + // We can't just do arguments[1].([]string), we have to + // manually convert each item to a string. + arrayStr := []string{} + for _, item := range arguments[1].([]interface{}) { + arrayStr = append(arrayStr, item.(string)) + } + return strings.Join(arrayStr, sep), nil +} +func jpfReverse(arguments []interface{}) (interface{}, error) { + if s, ok := arguments[0].(string); ok { + r := []rune(s) + for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 { + r[i], r[j] = r[j], r[i] + } + return string(r), nil + } + items := arguments[0].([]interface{}) + length := len(items) + reversed := make([]interface{}, length) + for i, item := range items { + reversed[length-(i+1)] = item + } + return reversed, nil +} +func jpfToArray(arguments []interface{}) (interface{}, error) { + if _, ok := arguments[0].([]interface{}); ok { + return arguments[0], nil + } + return arguments[:1:1], nil +} +func jpfToString(arguments []interface{}) (interface{}, error) { + if v, ok := arguments[0].(string); ok { + return v, nil + } + result, err := json.Marshal(arguments[0]) + if err != nil { + return nil, err + } + return string(result), nil +} +func jpfToNumber(arguments []interface{}) (interface{}, error) { + arg := arguments[0] + if v, ok := arg.(float64); ok { + return v, nil + } + if v, ok := arg.(string); ok { + conv, err := strconv.ParseFloat(v, 64) + if err != nil { + return nil, nil + } + return conv, nil + } + if _, ok := arg.([]interface{}); ok { + return nil, nil + } + if _, ok := arg.(map[string]interface{}); ok { + return nil, nil + } + if arg == nil { + return nil, nil + } + if arg == true || arg == false { + return nil, nil + } + return nil, errors.New("unknown type") +} +func jpfNotNull(arguments []interface{}) (interface{}, error) { + for _, arg := range arguments { + if arg != nil { + return arg, nil + } + } + return nil, nil +} diff --git a/vendor/github.com/jmespath/go-jmespath/interpreter.go b/vendor/github.com/jmespath/go-jmespath/interpreter.go new file mode 100644 index 000000000000..13c74604c2c8 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/interpreter.go @@ -0,0 +1,418 @@ +package jmespath + +import ( + "errors" + "reflect" + "unicode" + "unicode/utf8" +) + +/* This is a tree based interpreter. It walks the AST and directly + interprets the AST to search through a JSON document. +*/ + +type treeInterpreter struct { + fCall *functionCaller +} + +func newInterpreter() *treeInterpreter { + interpreter := treeInterpreter{} + interpreter.fCall = newFunctionCaller() + return &interpreter +} + +type expRef struct { + ref ASTNode +} + +// Execute takes an ASTNode and input data and interprets the AST directly. +// It will produce the result of applying the JMESPath expression associated +// with the ASTNode to the input data "value". +func (intr *treeInterpreter) Execute(node ASTNode, value interface{}) (interface{}, error) { + switch node.nodeType { + case ASTComparator: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + right, err := intr.Execute(node.children[1], value) + if err != nil { + return nil, err + } + switch node.value { + case tEQ: + return objsEqual(left, right), nil + case tNE: + return !objsEqual(left, right), nil + } + leftNum, ok := left.(float64) + if !ok { + return nil, nil + } + rightNum, ok := right.(float64) + if !ok { + return nil, nil + } + switch node.value { + case tGT: + return leftNum > rightNum, nil + case tGTE: + return leftNum >= rightNum, nil + case tLT: + return leftNum < rightNum, nil + case tLTE: + return leftNum <= rightNum, nil + } + case ASTExpRef: + return expRef{ref: node.children[0]}, nil + case ASTFunctionExpression: + resolvedArgs := []interface{}{} + for _, arg := range node.children { + current, err := intr.Execute(arg, value) + if err != nil { + return nil, err + } + resolvedArgs = append(resolvedArgs, current) + } + return intr.fCall.CallFunction(node.value.(string), resolvedArgs, intr) + case ASTField: + if m, ok := value.(map[string]interface{}); ok { + key := node.value.(string) + return m[key], nil + } + return intr.fieldFromStruct(node.value.(string), value) + case ASTFilterProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + sliceType, ok := left.([]interface{}) + if !ok { + if isSliceType(left) { + return intr.filterProjectionWithReflection(node, left) + } + return nil, nil + } + compareNode := node.children[2] + collected := []interface{}{} + for _, element := range sliceType { + result, err := intr.Execute(compareNode, element) + if err != nil { + return nil, err + } + if !isFalse(result) { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + } + return collected, nil + case ASTFlatten: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + sliceType, ok := left.([]interface{}) + if !ok { + // If we can't type convert to []interface{}, there's + // a chance this could still work via reflection if we're + // dealing with user provided types. + if isSliceType(left) { + return intr.flattenWithReflection(left) + } + return nil, nil + } + flattened := []interface{}{} + for _, element := range sliceType { + if elementSlice, ok := element.([]interface{}); ok { + flattened = append(flattened, elementSlice...) + } else if isSliceType(element) { + reflectFlat := []interface{}{} + v := reflect.ValueOf(element) + for i := 0; i < v.Len(); i++ { + reflectFlat = append(reflectFlat, v.Index(i).Interface()) + } + flattened = append(flattened, reflectFlat...) + } else { + flattened = append(flattened, element) + } + } + return flattened, nil + case ASTIdentity, ASTCurrentNode: + return value, nil + case ASTIndex: + if sliceType, ok := value.([]interface{}); ok { + index := node.value.(int) + if index < 0 { + index += len(sliceType) + } + if index < len(sliceType) && index >= 0 { + return sliceType[index], nil + } + return nil, nil + } + // Otherwise try via reflection. + rv := reflect.ValueOf(value) + if rv.Kind() == reflect.Slice { + index := node.value.(int) + if index < 0 { + index += rv.Len() + } + if index < rv.Len() && index >= 0 { + v := rv.Index(index) + return v.Interface(), nil + } + } + return nil, nil + case ASTKeyValPair: + return intr.Execute(node.children[0], value) + case ASTLiteral: + return node.value, nil + case ASTMultiSelectHash: + if value == nil { + return nil, nil + } + collected := make(map[string]interface{}) + for _, child := range node.children { + current, err := intr.Execute(child, value) + if err != nil { + return nil, err + } + key := child.value.(string) + collected[key] = current + } + return collected, nil + case ASTMultiSelectList: + if value == nil { + return nil, nil + } + collected := []interface{}{} + for _, child := range node.children { + current, err := intr.Execute(child, value) + if err != nil { + return nil, err + } + collected = append(collected, current) + } + return collected, nil + case ASTOrExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + matched, err = intr.Execute(node.children[1], value) + if err != nil { + return nil, err + } + } + return matched, nil + case ASTAndExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + return matched, nil + } + return intr.Execute(node.children[1], value) + case ASTNotExpression: + matched, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + if isFalse(matched) { + return true, nil + } + return false, nil + case ASTPipe: + result := value + var err error + for _, child := range node.children { + result, err = intr.Execute(child, result) + if err != nil { + return nil, err + } + } + return result, nil + case ASTProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + sliceType, ok := left.([]interface{}) + if !ok { + if isSliceType(left) { + return intr.projectWithReflection(node, left) + } + return nil, nil + } + collected := []interface{}{} + var current interface{} + for _, element := range sliceType { + current, err = intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + return collected, nil + case ASTSubexpression, ASTIndexExpression: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, err + } + return intr.Execute(node.children[1], left) + case ASTSlice: + sliceType, ok := value.([]interface{}) + if !ok { + if isSliceType(value) { + return intr.sliceWithReflection(node, value) + } + return nil, nil + } + parts := node.value.([]*int) + sliceParams := make([]sliceParam, 3) + for i, part := range parts { + if part != nil { + sliceParams[i].Specified = true + sliceParams[i].N = *part + } + } + return slice(sliceType, sliceParams) + case ASTValueProjection: + left, err := intr.Execute(node.children[0], value) + if err != nil { + return nil, nil + } + mapType, ok := left.(map[string]interface{}) + if !ok { + return nil, nil + } + values := make([]interface{}, len(mapType)) + for _, value := range mapType { + values = append(values, value) + } + collected := []interface{}{} + for _, element := range values { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + return collected, nil + } + return nil, errors.New("Unknown AST node: " + node.nodeType.String()) +} + +func (intr *treeInterpreter) fieldFromStruct(key string, value interface{}) (interface{}, error) { + rv := reflect.ValueOf(value) + first, n := utf8.DecodeRuneInString(key) + fieldName := string(unicode.ToUpper(first)) + key[n:] + if rv.Kind() == reflect.Struct { + v := rv.FieldByName(fieldName) + if !v.IsValid() { + return nil, nil + } + return v.Interface(), nil + } else if rv.Kind() == reflect.Ptr { + // Handle multiple levels of indirection? + if rv.IsNil() { + return nil, nil + } + rv = rv.Elem() + v := rv.FieldByName(fieldName) + if !v.IsValid() { + return nil, nil + } + return v.Interface(), nil + } + return nil, nil +} + +func (intr *treeInterpreter) flattenWithReflection(value interface{}) (interface{}, error) { + v := reflect.ValueOf(value) + flattened := []interface{}{} + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + if reflect.TypeOf(element).Kind() == reflect.Slice { + // Then insert the contents of the element + // slice into the flattened slice, + // i.e flattened = append(flattened, mySlice...) + elementV := reflect.ValueOf(element) + for j := 0; j < elementV.Len(); j++ { + flattened = append( + flattened, elementV.Index(j).Interface()) + } + } else { + flattened = append(flattened, element) + } + } + return flattened, nil +} + +func (intr *treeInterpreter) sliceWithReflection(node ASTNode, value interface{}) (interface{}, error) { + v := reflect.ValueOf(value) + parts := node.value.([]*int) + sliceParams := make([]sliceParam, 3) + for i, part := range parts { + if part != nil { + sliceParams[i].Specified = true + sliceParams[i].N = *part + } + } + final := []interface{}{} + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + final = append(final, element) + } + return slice(final, sliceParams) +} + +func (intr *treeInterpreter) filterProjectionWithReflection(node ASTNode, value interface{}) (interface{}, error) { + compareNode := node.children[2] + collected := []interface{}{} + v := reflect.ValueOf(value) + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + result, err := intr.Execute(compareNode, element) + if err != nil { + return nil, err + } + if !isFalse(result) { + current, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if current != nil { + collected = append(collected, current) + } + } + } + return collected, nil +} + +func (intr *treeInterpreter) projectWithReflection(node ASTNode, value interface{}) (interface{}, error) { + collected := []interface{}{} + v := reflect.ValueOf(value) + for i := 0; i < v.Len(); i++ { + element := v.Index(i).Interface() + result, err := intr.Execute(node.children[1], element) + if err != nil { + return nil, err + } + if result != nil { + collected = append(collected, result) + } + } + return collected, nil +} diff --git a/vendor/github.com/jmespath/go-jmespath/lexer.go b/vendor/github.com/jmespath/go-jmespath/lexer.go new file mode 100644 index 000000000000..817900c8f529 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/lexer.go @@ -0,0 +1,420 @@ +package jmespath + +import ( + "bytes" + "encoding/json" + "fmt" + "strconv" + "strings" + "unicode/utf8" +) + +type token struct { + tokenType tokType + value string + position int + length int +} + +type tokType int + +const eof = -1 + +// Lexer contains information about the expression being tokenized. +type Lexer struct { + expression string // The expression provided by the user. + currentPos int // The current position in the string. + lastWidth int // The width of the current rune. This + buf bytes.Buffer // Internal buffer used for building up values. +} + +// SyntaxError is the main error used whenever a lexing or parsing error occurs. +type SyntaxError struct { + msg string // Error message displayed to user + Expression string // Expression that generated a SyntaxError + Offset int // The location in the string where the error occurred +} + +func (e SyntaxError) Error() string { + // In the future, it would be good to underline the specific + // location where the error occurred. + return "SyntaxError: " + e.msg +} + +// HighlightLocation will show where the syntax error occurred. +// It will place a "^" character on a line below the expression +// at the point where the syntax error occurred. +func (e SyntaxError) HighlightLocation() string { + return e.Expression + "\n" + strings.Repeat(" ", e.Offset) + "^" +} + +//go:generate stringer -type=tokType +const ( + tUnknown tokType = iota + tStar + tDot + tFilter + tFlatten + tLparen + tRparen + tLbracket + tRbracket + tLbrace + tRbrace + tOr + tPipe + tNumber + tUnquotedIdentifier + tQuotedIdentifier + tComma + tColon + tLT + tLTE + tGT + tGTE + tEQ + tNE + tJSONLiteral + tStringLiteral + tCurrent + tExpref + tAnd + tNot + tEOF +) + +var basicTokens = map[rune]tokType{ + '.': tDot, + '*': tStar, + ',': tComma, + ':': tColon, + '{': tLbrace, + '}': tRbrace, + ']': tRbracket, // tLbracket not included because it could be "[]" + '(': tLparen, + ')': tRparen, + '@': tCurrent, +} + +// Bit mask for [a-zA-Z_] shifted down 64 bits to fit in a single uint64. +// When using this bitmask just be sure to shift the rune down 64 bits +// before checking against identifierStartBits. +const identifierStartBits uint64 = 576460745995190270 + +// Bit mask for [a-zA-Z0-9], 128 bits -> 2 uint64s. +var identifierTrailingBits = [2]uint64{287948901175001088, 576460745995190270} + +var whiteSpace = map[rune]bool{ + ' ': true, '\t': true, '\n': true, '\r': true, +} + +func (t token) String() string { + return fmt.Sprintf("Token{%+v, %s, %d, %d}", + t.tokenType, t.value, t.position, t.length) +} + +// NewLexer creates a new JMESPath lexer. +func NewLexer() *Lexer { + lexer := Lexer{} + return &lexer +} + +func (lexer *Lexer) next() rune { + if lexer.currentPos >= len(lexer.expression) { + lexer.lastWidth = 0 + return eof + } + r, w := utf8.DecodeRuneInString(lexer.expression[lexer.currentPos:]) + lexer.lastWidth = w + lexer.currentPos += w + return r +} + +func (lexer *Lexer) back() { + lexer.currentPos -= lexer.lastWidth +} + +func (lexer *Lexer) peek() rune { + t := lexer.next() + lexer.back() + return t +} + +// tokenize takes an expression and returns corresponding tokens. +func (lexer *Lexer) tokenize(expression string) ([]token, error) { + var tokens []token + lexer.expression = expression + lexer.currentPos = 0 + lexer.lastWidth = 0 +loop: + for { + r := lexer.next() + if identifierStartBits&(1<<(uint64(r)-64)) > 0 { + t := lexer.consumeUnquotedIdentifier() + tokens = append(tokens, t) + } else if val, ok := basicTokens[r]; ok { + // Basic single char token. + t := token{ + tokenType: val, + value: string(r), + position: lexer.currentPos - lexer.lastWidth, + length: 1, + } + tokens = append(tokens, t) + } else if r == '-' || (r >= '0' && r <= '9') { + t := lexer.consumeNumber() + tokens = append(tokens, t) + } else if r == '[' { + t := lexer.consumeLBracket() + tokens = append(tokens, t) + } else if r == '"' { + t, err := lexer.consumeQuotedIdentifier() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '\'' { + t, err := lexer.consumeRawStringLiteral() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '`' { + t, err := lexer.consumeLiteral() + if err != nil { + return tokens, err + } + tokens = append(tokens, t) + } else if r == '|' { + t := lexer.matchOrElse(r, '|', tOr, tPipe) + tokens = append(tokens, t) + } else if r == '<' { + t := lexer.matchOrElse(r, '=', tLTE, tLT) + tokens = append(tokens, t) + } else if r == '>' { + t := lexer.matchOrElse(r, '=', tGTE, tGT) + tokens = append(tokens, t) + } else if r == '!' { + t := lexer.matchOrElse(r, '=', tNE, tNot) + tokens = append(tokens, t) + } else if r == '=' { + t := lexer.matchOrElse(r, '=', tEQ, tUnknown) + tokens = append(tokens, t) + } else if r == '&' { + t := lexer.matchOrElse(r, '&', tAnd, tExpref) + tokens = append(tokens, t) + } else if r == eof { + break loop + } else if _, ok := whiteSpace[r]; ok { + // Ignore whitespace + } else { + return tokens, lexer.syntaxError(fmt.Sprintf("Unknown char: %s", strconv.QuoteRuneToASCII(r))) + } + } + tokens = append(tokens, token{tEOF, "", len(lexer.expression), 0}) + return tokens, nil +} + +// Consume characters until the ending rune "r" is reached. +// If the end of the expression is reached before seeing the +// terminating rune "r", then an error is returned. +// If no error occurs then the matching substring is returned. +// The returned string will not include the ending rune. +func (lexer *Lexer) consumeUntil(end rune) (string, error) { + start := lexer.currentPos + current := lexer.next() + for current != end && current != eof { + if current == '\\' && lexer.peek() != eof { + lexer.next() + } + current = lexer.next() + } + if lexer.lastWidth == 0 { + // Then we hit an EOF so we never reached the closing + // delimiter. + return "", SyntaxError{ + msg: "Unclosed delimiter: " + string(end), + Expression: lexer.expression, + Offset: len(lexer.expression), + } + } + return lexer.expression[start : lexer.currentPos-lexer.lastWidth], nil +} + +func (lexer *Lexer) consumeLiteral() (token, error) { + start := lexer.currentPos + value, err := lexer.consumeUntil('`') + if err != nil { + return token{}, err + } + value = strings.Replace(value, "\\`", "`", -1) + return token{ + tokenType: tJSONLiteral, + value: value, + position: start, + length: len(value), + }, nil +} + +func (lexer *Lexer) consumeRawStringLiteral() (token, error) { + start := lexer.currentPos + currentIndex := start + current := lexer.next() + for current != '\'' && lexer.peek() != eof { + if current == '\\' && lexer.peek() == '\'' { + chunk := lexer.expression[currentIndex : lexer.currentPos-1] + lexer.buf.WriteString(chunk) + lexer.buf.WriteString("'") + lexer.next() + currentIndex = lexer.currentPos + } + current = lexer.next() + } + if lexer.lastWidth == 0 { + // Then we hit an EOF so we never reached the closing + // delimiter. + return token{}, SyntaxError{ + msg: "Unclosed delimiter: '", + Expression: lexer.expression, + Offset: len(lexer.expression), + } + } + if currentIndex < lexer.currentPos { + lexer.buf.WriteString(lexer.expression[currentIndex : lexer.currentPos-1]) + } + value := lexer.buf.String() + // Reset the buffer so it can reused again. + lexer.buf.Reset() + return token{ + tokenType: tStringLiteral, + value: value, + position: start, + length: len(value), + }, nil +} + +func (lexer *Lexer) syntaxError(msg string) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: lexer.expression, + Offset: lexer.currentPos - 1, + } +} + +// Checks for a two char token, otherwise matches a single character +// token. This is used whenever a two char token overlaps a single +// char token, e.g. "||" -> tPipe, "|" -> tOr. +func (lexer *Lexer) matchOrElse(first rune, second rune, matchedType tokType, singleCharType tokType) token { + start := lexer.currentPos - lexer.lastWidth + nextRune := lexer.next() + var t token + if nextRune == second { + t = token{ + tokenType: matchedType, + value: string(first) + string(second), + position: start, + length: 2, + } + } else { + lexer.back() + t = token{ + tokenType: singleCharType, + value: string(first), + position: start, + length: 1, + } + } + return t +} + +func (lexer *Lexer) consumeLBracket() token { + // There's three options here: + // 1. A filter expression "[?" + // 2. A flatten operator "[]" + // 3. A bare rbracket "[" + start := lexer.currentPos - lexer.lastWidth + nextRune := lexer.next() + var t token + if nextRune == '?' { + t = token{ + tokenType: tFilter, + value: "[?", + position: start, + length: 2, + } + } else if nextRune == ']' { + t = token{ + tokenType: tFlatten, + value: "[]", + position: start, + length: 2, + } + } else { + t = token{ + tokenType: tLbracket, + value: "[", + position: start, + length: 1, + } + lexer.back() + } + return t +} + +func (lexer *Lexer) consumeQuotedIdentifier() (token, error) { + start := lexer.currentPos + value, err := lexer.consumeUntil('"') + if err != nil { + return token{}, err + } + var decoded string + asJSON := []byte("\"" + value + "\"") + if err := json.Unmarshal([]byte(asJSON), &decoded); err != nil { + return token{}, err + } + return token{ + tokenType: tQuotedIdentifier, + value: decoded, + position: start - 1, + length: len(decoded), + }, nil +} + +func (lexer *Lexer) consumeUnquotedIdentifier() token { + // Consume runes until we reach the end of an unquoted + // identifier. + start := lexer.currentPos - lexer.lastWidth + for { + r := lexer.next() + if r < 0 || r > 128 || identifierTrailingBits[uint64(r)/64]&(1<<(uint64(r)%64)) == 0 { + lexer.back() + break + } + } + value := lexer.expression[start:lexer.currentPos] + return token{ + tokenType: tUnquotedIdentifier, + value: value, + position: start, + length: lexer.currentPos - start, + } +} + +func (lexer *Lexer) consumeNumber() token { + // Consume runes until we reach something that's not a number. + start := lexer.currentPos - lexer.lastWidth + for { + r := lexer.next() + if r < '0' || r > '9' { + lexer.back() + break + } + } + value := lexer.expression[start:lexer.currentPos] + return token{ + tokenType: tNumber, + value: value, + position: start, + length: lexer.currentPos - start, + } +} diff --git a/vendor/github.com/jmespath/go-jmespath/parser.go b/vendor/github.com/jmespath/go-jmespath/parser.go new file mode 100644 index 000000000000..c8f4bcebd87d --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/parser.go @@ -0,0 +1,603 @@ +package jmespath + +import ( + "encoding/json" + "fmt" + "strconv" + "strings" +) + +type astNodeType int + +//go:generate stringer -type astNodeType +const ( + ASTEmpty astNodeType = iota + ASTComparator + ASTCurrentNode + ASTExpRef + ASTFunctionExpression + ASTField + ASTFilterProjection + ASTFlatten + ASTIdentity + ASTIndex + ASTIndexExpression + ASTKeyValPair + ASTLiteral + ASTMultiSelectHash + ASTMultiSelectList + ASTOrExpression + ASTAndExpression + ASTNotExpression + ASTPipe + ASTProjection + ASTSubexpression + ASTSlice + ASTValueProjection +) + +// ASTNode represents the abstract syntax tree of a JMESPath expression. +type ASTNode struct { + nodeType astNodeType + value interface{} + children []ASTNode +} + +func (node ASTNode) String() string { + return node.PrettyPrint(0) +} + +// PrettyPrint will pretty print the parsed AST. +// The AST is an implementation detail and this pretty print +// function is provided as a convenience method to help with +// debugging. You should not rely on its output as the internal +// structure of the AST may change at any time. +func (node ASTNode) PrettyPrint(indent int) string { + spaces := strings.Repeat(" ", indent) + output := fmt.Sprintf("%s%s {\n", spaces, node.nodeType) + nextIndent := indent + 2 + if node.value != nil { + if converted, ok := node.value.(fmt.Stringer); ok { + // Account for things like comparator nodes + // that are enums with a String() method. + output += fmt.Sprintf("%svalue: %s\n", strings.Repeat(" ", nextIndent), converted.String()) + } else { + output += fmt.Sprintf("%svalue: %#v\n", strings.Repeat(" ", nextIndent), node.value) + } + } + lastIndex := len(node.children) + if lastIndex > 0 { + output += fmt.Sprintf("%schildren: {\n", strings.Repeat(" ", nextIndent)) + childIndent := nextIndent + 2 + for _, elem := range node.children { + output += elem.PrettyPrint(childIndent) + } + } + output += fmt.Sprintf("%s}\n", spaces) + return output +} + +var bindingPowers = map[tokType]int{ + tEOF: 0, + tUnquotedIdentifier: 0, + tQuotedIdentifier: 0, + tRbracket: 0, + tRparen: 0, + tComma: 0, + tRbrace: 0, + tNumber: 0, + tCurrent: 0, + tExpref: 0, + tColon: 0, + tPipe: 1, + tOr: 2, + tAnd: 3, + tEQ: 5, + tLT: 5, + tLTE: 5, + tGT: 5, + tGTE: 5, + tNE: 5, + tFlatten: 9, + tStar: 20, + tFilter: 21, + tDot: 40, + tNot: 45, + tLbrace: 50, + tLbracket: 55, + tLparen: 60, +} + +// Parser holds state about the current expression being parsed. +type Parser struct { + expression string + tokens []token + index int +} + +// NewParser creates a new JMESPath parser. +func NewParser() *Parser { + p := Parser{} + return &p +} + +// Parse will compile a JMESPath expression. +func (p *Parser) Parse(expression string) (ASTNode, error) { + lexer := NewLexer() + p.expression = expression + p.index = 0 + tokens, err := lexer.tokenize(expression) + if err != nil { + return ASTNode{}, err + } + p.tokens = tokens + parsed, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if p.current() != tEOF { + return ASTNode{}, p.syntaxError(fmt.Sprintf( + "Unexpected token at the end of the expresssion: %s", p.current())) + } + return parsed, nil +} + +func (p *Parser) parseExpression(bindingPower int) (ASTNode, error) { + var err error + leftToken := p.lookaheadToken(0) + p.advance() + leftNode, err := p.nud(leftToken) + if err != nil { + return ASTNode{}, err + } + currentToken := p.current() + for bindingPower < bindingPowers[currentToken] { + p.advance() + leftNode, err = p.led(currentToken, leftNode) + if err != nil { + return ASTNode{}, err + } + currentToken = p.current() + } + return leftNode, nil +} + +func (p *Parser) parseIndexExpression() (ASTNode, error) { + if p.lookahead(0) == tColon || p.lookahead(1) == tColon { + return p.parseSliceExpression() + } + indexStr := p.lookaheadToken(0).value + parsedInt, err := strconv.Atoi(indexStr) + if err != nil { + return ASTNode{}, err + } + indexNode := ASTNode{nodeType: ASTIndex, value: parsedInt} + p.advance() + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + return indexNode, nil +} + +func (p *Parser) parseSliceExpression() (ASTNode, error) { + parts := []*int{nil, nil, nil} + index := 0 + current := p.current() + for current != tRbracket && index < 3 { + if current == tColon { + index++ + p.advance() + } else if current == tNumber { + parsedInt, err := strconv.Atoi(p.lookaheadToken(0).value) + if err != nil { + return ASTNode{}, err + } + parts[index] = &parsedInt + p.advance() + } else { + return ASTNode{}, p.syntaxError( + "Expected tColon or tNumber" + ", received: " + p.current().String()) + } + current = p.current() + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTSlice, + value: parts, + }, nil +} + +func (p *Parser) match(tokenType tokType) error { + if p.current() == tokenType { + p.advance() + return nil + } + return p.syntaxError("Expected " + tokenType.String() + ", received: " + p.current().String()) +} + +func (p *Parser) led(tokenType tokType, node ASTNode) (ASTNode, error) { + switch tokenType { + case tDot: + if p.current() != tStar { + right, err := p.parseDotRHS(bindingPowers[tDot]) + return ASTNode{ + nodeType: ASTSubexpression, + children: []ASTNode{node, right}, + }, err + } + p.advance() + right, err := p.parseProjectionRHS(bindingPowers[tDot]) + return ASTNode{ + nodeType: ASTValueProjection, + children: []ASTNode{node, right}, + }, err + case tPipe: + right, err := p.parseExpression(bindingPowers[tPipe]) + return ASTNode{nodeType: ASTPipe, children: []ASTNode{node, right}}, err + case tOr: + right, err := p.parseExpression(bindingPowers[tOr]) + return ASTNode{nodeType: ASTOrExpression, children: []ASTNode{node, right}}, err + case tAnd: + right, err := p.parseExpression(bindingPowers[tAnd]) + return ASTNode{nodeType: ASTAndExpression, children: []ASTNode{node, right}}, err + case tLparen: + name := node.value + var args []ASTNode + for p.current() != tRparen { + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if p.current() == tComma { + if err := p.match(tComma); err != nil { + return ASTNode{}, err + } + } + args = append(args, expression) + } + if err := p.match(tRparen); err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTFunctionExpression, + value: name, + children: args, + }, nil + case tFilter: + return p.parseFilter(node) + case tFlatten: + left := ASTNode{nodeType: ASTFlatten, children: []ASTNode{node}} + right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{left, right}, + }, err + case tEQ, tNE, tGT, tGTE, tLT, tLTE: + right, err := p.parseExpression(bindingPowers[tokenType]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTComparator, + value: tokenType, + children: []ASTNode{node, right}, + }, nil + case tLbracket: + tokenType := p.current() + var right ASTNode + var err error + if tokenType == tNumber || tokenType == tColon { + right, err = p.parseIndexExpression() + if err != nil { + return ASTNode{}, err + } + return p.projectIfSlice(node, right) + } + // Otherwise this is a projection. + if err := p.match(tStar); err != nil { + return ASTNode{}, err + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + right, err = p.parseProjectionRHS(bindingPowers[tStar]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{node, right}, + }, nil + } + return ASTNode{}, p.syntaxError("Unexpected token: " + tokenType.String()) +} + +func (p *Parser) nud(token token) (ASTNode, error) { + switch token.tokenType { + case tJSONLiteral: + var parsed interface{} + err := json.Unmarshal([]byte(token.value), &parsed) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTLiteral, value: parsed}, nil + case tStringLiteral: + return ASTNode{nodeType: ASTLiteral, value: token.value}, nil + case tUnquotedIdentifier: + return ASTNode{ + nodeType: ASTField, + value: token.value, + }, nil + case tQuotedIdentifier: + node := ASTNode{nodeType: ASTField, value: token.value} + if p.current() == tLparen { + return ASTNode{}, p.syntaxErrorToken("Can't have quoted identifier as function name.", token) + } + return node, nil + case tStar: + left := ASTNode{nodeType: ASTIdentity} + var right ASTNode + var err error + if p.current() == tRbracket { + right = ASTNode{nodeType: ASTIdentity} + } else { + right, err = p.parseProjectionRHS(bindingPowers[tStar]) + } + return ASTNode{nodeType: ASTValueProjection, children: []ASTNode{left, right}}, err + case tFilter: + return p.parseFilter(ASTNode{nodeType: ASTIdentity}) + case tLbrace: + return p.parseMultiSelectHash() + case tFlatten: + left := ASTNode{ + nodeType: ASTFlatten, + children: []ASTNode{ASTNode{nodeType: ASTIdentity}}, + } + right, err := p.parseProjectionRHS(bindingPowers[tFlatten]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTProjection, children: []ASTNode{left, right}}, nil + case tLbracket: + tokenType := p.current() + //var right ASTNode + if tokenType == tNumber || tokenType == tColon { + right, err := p.parseIndexExpression() + if err != nil { + return ASTNode{}, nil + } + return p.projectIfSlice(ASTNode{nodeType: ASTIdentity}, right) + } else if tokenType == tStar && p.lookahead(1) == tRbracket { + p.advance() + p.advance() + right, err := p.parseProjectionRHS(bindingPowers[tStar]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{ASTNode{nodeType: ASTIdentity}, right}, + }, nil + } else { + return p.parseMultiSelectList() + } + case tCurrent: + return ASTNode{nodeType: ASTCurrentNode}, nil + case tExpref: + expression, err := p.parseExpression(bindingPowers[tExpref]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTExpRef, children: []ASTNode{expression}}, nil + case tNot: + expression, err := p.parseExpression(bindingPowers[tNot]) + if err != nil { + return ASTNode{}, err + } + return ASTNode{nodeType: ASTNotExpression, children: []ASTNode{expression}}, nil + case tLparen: + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if err := p.match(tRparen); err != nil { + return ASTNode{}, err + } + return expression, nil + case tEOF: + return ASTNode{}, p.syntaxErrorToken("Incomplete expression", token) + } + + return ASTNode{}, p.syntaxErrorToken("Invalid token: "+token.tokenType.String(), token) +} + +func (p *Parser) parseMultiSelectList() (ASTNode, error) { + var expressions []ASTNode + for { + expression, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + expressions = append(expressions, expression) + if p.current() == tRbracket { + break + } + err = p.match(tComma) + if err != nil { + return ASTNode{}, err + } + } + err := p.match(tRbracket) + if err != nil { + return ASTNode{}, err + } + return ASTNode{ + nodeType: ASTMultiSelectList, + children: expressions, + }, nil +} + +func (p *Parser) parseMultiSelectHash() (ASTNode, error) { + var children []ASTNode + for { + keyToken := p.lookaheadToken(0) + if err := p.match(tUnquotedIdentifier); err != nil { + if err := p.match(tQuotedIdentifier); err != nil { + return ASTNode{}, p.syntaxError("Expected tQuotedIdentifier or tUnquotedIdentifier") + } + } + keyName := keyToken.value + err := p.match(tColon) + if err != nil { + return ASTNode{}, err + } + value, err := p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + node := ASTNode{ + nodeType: ASTKeyValPair, + value: keyName, + children: []ASTNode{value}, + } + children = append(children, node) + if p.current() == tComma { + err := p.match(tComma) + if err != nil { + return ASTNode{}, nil + } + } else if p.current() == tRbrace { + err := p.match(tRbrace) + if err != nil { + return ASTNode{}, nil + } + break + } + } + return ASTNode{ + nodeType: ASTMultiSelectHash, + children: children, + }, nil +} + +func (p *Parser) projectIfSlice(left ASTNode, right ASTNode) (ASTNode, error) { + indexExpr := ASTNode{ + nodeType: ASTIndexExpression, + children: []ASTNode{left, right}, + } + if right.nodeType == ASTSlice { + right, err := p.parseProjectionRHS(bindingPowers[tStar]) + return ASTNode{ + nodeType: ASTProjection, + children: []ASTNode{indexExpr, right}, + }, err + } + return indexExpr, nil +} +func (p *Parser) parseFilter(node ASTNode) (ASTNode, error) { + var right, condition ASTNode + var err error + condition, err = p.parseExpression(0) + if err != nil { + return ASTNode{}, err + } + if err := p.match(tRbracket); err != nil { + return ASTNode{}, err + } + if p.current() == tFlatten { + right = ASTNode{nodeType: ASTIdentity} + } else { + right, err = p.parseProjectionRHS(bindingPowers[tFilter]) + if err != nil { + return ASTNode{}, err + } + } + + return ASTNode{ + nodeType: ASTFilterProjection, + children: []ASTNode{node, right, condition}, + }, nil +} + +func (p *Parser) parseDotRHS(bindingPower int) (ASTNode, error) { + lookahead := p.current() + if tokensOneOf([]tokType{tQuotedIdentifier, tUnquotedIdentifier, tStar}, lookahead) { + return p.parseExpression(bindingPower) + } else if lookahead == tLbracket { + if err := p.match(tLbracket); err != nil { + return ASTNode{}, err + } + return p.parseMultiSelectList() + } else if lookahead == tLbrace { + if err := p.match(tLbrace); err != nil { + return ASTNode{}, err + } + return p.parseMultiSelectHash() + } + return ASTNode{}, p.syntaxError("Expected identifier, lbracket, or lbrace") +} + +func (p *Parser) parseProjectionRHS(bindingPower int) (ASTNode, error) { + current := p.current() + if bindingPowers[current] < 10 { + return ASTNode{nodeType: ASTIdentity}, nil + } else if current == tLbracket { + return p.parseExpression(bindingPower) + } else if current == tFilter { + return p.parseExpression(bindingPower) + } else if current == tDot { + err := p.match(tDot) + if err != nil { + return ASTNode{}, err + } + return p.parseDotRHS(bindingPower) + } else { + return ASTNode{}, p.syntaxError("Error") + } +} + +func (p *Parser) lookahead(number int) tokType { + return p.lookaheadToken(number).tokenType +} + +func (p *Parser) current() tokType { + return p.lookahead(0) +} + +func (p *Parser) lookaheadToken(number int) token { + return p.tokens[p.index+number] +} + +func (p *Parser) advance() { + p.index++ +} + +func tokensOneOf(elements []tokType, token tokType) bool { + for _, elem := range elements { + if elem == token { + return true + } + } + return false +} + +func (p *Parser) syntaxError(msg string) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: p.expression, + Offset: p.lookaheadToken(0).position, + } +} + +// Create a SyntaxError based on the provided token. +// This differs from syntaxError() which creates a SyntaxError +// based on the current lookahead token. +func (p *Parser) syntaxErrorToken(msg string, t token) SyntaxError { + return SyntaxError{ + msg: msg, + Expression: p.expression, + Offset: t.position, + } +} diff --git a/vendor/github.com/jmespath/go-jmespath/toktype_string.go b/vendor/github.com/jmespath/go-jmespath/toktype_string.go new file mode 100644 index 000000000000..dae79cbdf338 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/toktype_string.go @@ -0,0 +1,16 @@ +// generated by stringer -type=tokType; DO NOT EDIT + +package jmespath + +import "fmt" + +const _tokType_name = "tUnknowntStartDottFiltertFlattentLparentRparentLbrackettRbrackettLbracetRbracetOrtPipetNumbertUnquotedIdentifiertQuotedIdentifiertCommatColontLTtLTEtGTtGTEtEQtNEtJSONLiteraltStringLiteraltCurrenttExpreftAndtNottEOF" + +var _tokType_index = [...]uint8{0, 8, 13, 17, 24, 32, 39, 46, 55, 64, 71, 78, 81, 86, 93, 112, 129, 135, 141, 144, 148, 151, 155, 158, 161, 173, 187, 195, 202, 206, 210, 214} + +func (i tokType) String() string { + if i < 0 || i >= tokType(len(_tokType_index)-1) { + return fmt.Sprintf("tokType(%d)", i) + } + return _tokType_name[_tokType_index[i]:_tokType_index[i+1]] +} diff --git a/vendor/github.com/jmespath/go-jmespath/util.go b/vendor/github.com/jmespath/go-jmespath/util.go new file mode 100644 index 000000000000..ddc1b7d7d460 --- /dev/null +++ b/vendor/github.com/jmespath/go-jmespath/util.go @@ -0,0 +1,185 @@ +package jmespath + +import ( + "errors" + "reflect" +) + +// IsFalse determines if an object is false based on the JMESPath spec. +// JMESPath defines false values to be any of: +// - An empty string array, or hash. +// - The boolean value false. +// - nil +func isFalse(value interface{}) bool { + switch v := value.(type) { + case bool: + return !v + case []interface{}: + return len(v) == 0 + case map[string]interface{}: + return len(v) == 0 + case string: + return len(v) == 0 + case nil: + return true + } + // Try the reflection cases before returning false. + rv := reflect.ValueOf(value) + switch rv.Kind() { + case reflect.Struct: + // A struct type will never be false, even if + // all of its values are the zero type. + return false + case reflect.Slice, reflect.Map: + return rv.Len() == 0 + case reflect.Ptr: + if rv.IsNil() { + return true + } + // If it's a pointer type, we'll try to deref the pointer + // and evaluate the pointer value for isFalse. + element := rv.Elem() + return isFalse(element.Interface()) + } + return false +} + +// ObjsEqual is a generic object equality check. +// It will take two arbitrary objects and recursively determine +// if they are equal. +func objsEqual(left interface{}, right interface{}) bool { + return reflect.DeepEqual(left, right) +} + +// SliceParam refers to a single part of a slice. +// A slice consists of a start, a stop, and a step, similar to +// python slices. +type sliceParam struct { + N int + Specified bool +} + +// Slice supports [start:stop:step] style slicing that's supported in JMESPath. +func slice(slice []interface{}, parts []sliceParam) ([]interface{}, error) { + computed, err := computeSliceParams(len(slice), parts) + if err != nil { + return nil, err + } + start, stop, step := computed[0], computed[1], computed[2] + result := []interface{}{} + if step > 0 { + for i := start; i < stop; i += step { + result = append(result, slice[i]) + } + } else { + for i := start; i > stop; i += step { + result = append(result, slice[i]) + } + } + return result, nil +} + +func computeSliceParams(length int, parts []sliceParam) ([]int, error) { + var start, stop, step int + if !parts[2].Specified { + step = 1 + } else if parts[2].N == 0 { + return nil, errors.New("Invalid slice, step cannot be 0") + } else { + step = parts[2].N + } + var stepValueNegative bool + if step < 0 { + stepValueNegative = true + } else { + stepValueNegative = false + } + + if !parts[0].Specified { + if stepValueNegative { + start = length - 1 + } else { + start = 0 + } + } else { + start = capSlice(length, parts[0].N, step) + } + + if !parts[1].Specified { + if stepValueNegative { + stop = -1 + } else { + stop = length + } + } else { + stop = capSlice(length, parts[1].N, step) + } + return []int{start, stop, step}, nil +} + +func capSlice(length int, actual int, step int) int { + if actual < 0 { + actual += length + if actual < 0 { + if step < 0 { + actual = -1 + } else { + actual = 0 + } + } + } else if actual >= length { + if step < 0 { + actual = length - 1 + } else { + actual = length + } + } + return actual +} + +// ToArrayNum converts an empty interface type to a slice of float64. +// If any element in the array cannot be converted, then nil is returned +// along with a second value of false. +func toArrayNum(data interface{}) ([]float64, bool) { + // Is there a better way to do this with reflect? + if d, ok := data.([]interface{}); ok { + result := make([]float64, len(d)) + for i, el := range d { + item, ok := el.(float64) + if !ok { + return nil, false + } + result[i] = item + } + return result, true + } + return nil, false +} + +// ToArrayStr converts an empty interface type to a slice of strings. +// If any element in the array cannot be converted, then nil is returned +// along with a second value of false. If the input data could be entirely +// converted, then the converted data, along with a second value of true, +// will be returned. +func toArrayStr(data interface{}) ([]string, bool) { + // Is there a better way to do this with reflect? + if d, ok := data.([]interface{}); ok { + result := make([]string, len(d)) + for i, el := range d { + item, ok := el.(string) + if !ok { + return nil, false + } + result[i] = item + } + return result, true + } + return nil, false +} + +func isSliceType(v interface{}) bool { + if v == nil { + return false + } + return reflect.TypeOf(v).Kind() == reflect.Slice +} diff --git a/vendor/github.com/sanathkr/go-yaml/LICENSE b/vendor/github.com/sanathkr/go-yaml/LICENSE new file mode 100644 index 000000000000..8dada3edaf50 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor 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, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/sanathkr/go-yaml/LICENSE.libyaml b/vendor/github.com/sanathkr/go-yaml/LICENSE.libyaml new file mode 100644 index 000000000000..8da58fbf6f84 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/LICENSE.libyaml @@ -0,0 +1,31 @@ +The following files were ported to Go from C files of libyaml, and thus +are still covered by their original copyright and license: + + apic.go + emitterc.go + parserc.go + readerc.go + scannerc.go + writerc.go + yamlh.go + yamlprivateh.go + +Copyright (c) 2006 Kirill Simonov + +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/sanathkr/go-yaml/README.md b/vendor/github.com/sanathkr/go-yaml/README.md new file mode 100644 index 000000000000..7a512d67c2b9 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/README.md @@ -0,0 +1,133 @@ +# YAML support for the Go language + +Introduction +------------ + +The yaml package enables Go programs to comfortably encode and decode YAML +values. It was developed within [Canonical](https://www.canonical.com) as +part of the [juju](https://juju.ubuntu.com) project, and is based on a +pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) +C library to parse and generate YAML data quickly and reliably. + +Compatibility +------------- + +The yaml package supports most of YAML 1.1 and 1.2, including support for +anchors, tags, map merging, etc. Multi-document unmarshalling is not yet +implemented, and base-60 floats from YAML 1.1 are purposefully not +supported since they're a poor design and are gone in YAML 1.2. + +Installation and usage +---------------------- + +The import path for the package is *gopkg.in/yaml.v2*. + +To install it, run: + + go get gopkg.in/yaml.v2 + +API documentation +----------------- + +If opened in a browser, the import path itself leads to the API documentation: + + * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) + +API stability +------------- + +The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). + + +License +------- + +The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. + + +Example +------- + +Some more examples can be found in the "examples" folder. + +```Go +package main + +import ( + "fmt" + "log" + + "gopkg.in/yaml.v2" +) + +var data = ` +a: Easy! +b: + c: 2 + d: [3, 4] +` + +type T struct { + A string + B struct { + RenamedC int `yaml:"c"` + D []int `yaml:",flow"` + } +} + +func main() { + t := T{} + + err := yaml.Unmarshal([]byte(data), &t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t:\n%v\n\n", t) + + d, err := yaml.Marshal(&t) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- t dump:\n%s\n\n", string(d)) + + m := make(map[interface{}]interface{}) + + err = yaml.Unmarshal([]byte(data), &m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m:\n%v\n\n", m) + + d, err = yaml.Marshal(&m) + if err != nil { + log.Fatalf("error: %v", err) + } + fmt.Printf("--- m dump:\n%s\n\n", string(d)) +} +``` + +This example will generate the following output: + +``` +--- t: +{Easy! {2 [3 4]}} + +--- t dump: +a: Easy! +b: + c: 2 + d: [3, 4] + + +--- m: +map[a:Easy! b:map[c:2 d:[3 4]]] + +--- m dump: +a: Easy! +b: + c: 2 + d: + - 3 + - 4 +``` + diff --git a/vendor/github.com/sanathkr/go-yaml/apic.go b/vendor/github.com/sanathkr/go-yaml/apic.go new file mode 100644 index 000000000000..95ec014e8ccf --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/apic.go @@ -0,0 +1,742 @@ +package yaml + +import ( + "io" + "os" +) + +func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { + //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) + + // Check if we can move the queue at the beginning of the buffer. + if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { + if parser.tokens_head != len(parser.tokens) { + copy(parser.tokens, parser.tokens[parser.tokens_head:]) + } + parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] + parser.tokens_head = 0 + } + parser.tokens = append(parser.tokens, *token) + if pos < 0 { + return + } + copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) + parser.tokens[parser.tokens_head+pos] = *token +} + +// Create a new parser object. +func yaml_parser_initialize(parser *yaml_parser_t) bool { + *parser = yaml_parser_t{ + raw_buffer: make([]byte, 0, input_raw_buffer_size), + buffer: make([]byte, 0, input_buffer_size), + } + return true +} + +// Destroy a parser object. +func yaml_parser_delete(parser *yaml_parser_t) { + *parser = yaml_parser_t{} +} + +// String read handler. +func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + if parser.input_pos == len(parser.input) { + return 0, io.EOF + } + n = copy(buffer, parser.input[parser.input_pos:]) + parser.input_pos += n + return n, nil +} + +// File read handler. +func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + return parser.input_file.Read(buffer) +} + +// Set a string input. +func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_string_read_handler + parser.input = input + parser.input_pos = 0 +} + +// Set a file input. +func yaml_parser_set_input_file(parser *yaml_parser_t, file *os.File) { + if parser.read_handler != nil { + panic("must set the input source only once") + } + parser.read_handler = yaml_file_read_handler + parser.input_file = file +} + +// Set the source encoding. +func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { + if parser.encoding != yaml_ANY_ENCODING { + panic("must set the encoding only once") + } + parser.encoding = encoding +} + +// Create a new emitter object. +func yaml_emitter_initialize(emitter *yaml_emitter_t) bool { + *emitter = yaml_emitter_t{ + buffer: make([]byte, output_buffer_size), + raw_buffer: make([]byte, 0, output_raw_buffer_size), + states: make([]yaml_emitter_state_t, 0, initial_stack_size), + events: make([]yaml_event_t, 0, initial_queue_size), + } + return true +} + +// Destroy an emitter object. +func yaml_emitter_delete(emitter *yaml_emitter_t) { + *emitter = yaml_emitter_t{} +} + +// String write handler. +func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + *emitter.output_buffer = append(*emitter.output_buffer, buffer...) + return nil +} + +// File write handler. +func yaml_file_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_file.Write(buffer) + return err +} + +// Set a string output. +func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_string_write_handler + emitter.output_buffer = output_buffer +} + +// Set a file output. +func yaml_emitter_set_output_file(emitter *yaml_emitter_t, file io.Writer) { + if emitter.write_handler != nil { + panic("must set the output target only once") + } + emitter.write_handler = yaml_file_write_handler + emitter.output_file = file +} + +// Set the output encoding. +func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { + if emitter.encoding != yaml_ANY_ENCODING { + panic("must set the output encoding only once") + } + emitter.encoding = encoding +} + +// Set the canonical output style. +func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { + emitter.canonical = canonical +} + +//// Set the indentation increment. +func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { + if indent < 2 || indent > 9 { + indent = 2 + } + emitter.best_indent = indent +} + +// Set the preferred line width. +func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { + if width < 0 { + width = -1 + } + emitter.best_width = width +} + +// Set if unescaped non-ASCII characters are allowed. +func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { + emitter.unicode = unicode +} + +// Set the preferred line break character. +func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { + emitter.line_break = line_break +} + +///* +// * Destroy a token object. +// */ +// +//YAML_DECLARE(void) +//yaml_token_delete(yaml_token_t *token) +//{ +// assert(token); // Non-NULL token object expected. +// +// switch (token.type) +// { +// case YAML_TAG_DIRECTIVE_TOKEN: +// yaml_free(token.data.tag_directive.handle); +// yaml_free(token.data.tag_directive.prefix); +// break; +// +// case YAML_ALIAS_TOKEN: +// yaml_free(token.data.alias.value); +// break; +// +// case YAML_ANCHOR_TOKEN: +// yaml_free(token.data.anchor.value); +// break; +// +// case YAML_TAG_TOKEN: +// yaml_free(token.data.tag.handle); +// yaml_free(token.data.tag.suffix); +// break; +// +// case YAML_SCALAR_TOKEN: +// yaml_free(token.data.scalar.value); +// break; +// +// default: +// break; +// } +// +// memset(token, 0, sizeof(yaml_token_t)); +//} +// +///* +// * Check if a string is a valid UTF-8 sequence. +// * +// * Check 'reader.c' for more details on UTF-8 encoding. +// */ +// +//static int +//yaml_check_utf8(yaml_char_t *start, size_t length) +//{ +// yaml_char_t *end = start+length; +// yaml_char_t *pointer = start; +// +// while (pointer < end) { +// unsigned char octet; +// unsigned int width; +// unsigned int value; +// size_t k; +// +// octet = pointer[0]; +// width = (octet & 0x80) == 0x00 ? 1 : +// (octet & 0xE0) == 0xC0 ? 2 : +// (octet & 0xF0) == 0xE0 ? 3 : +// (octet & 0xF8) == 0xF0 ? 4 : 0; +// value = (octet & 0x80) == 0x00 ? octet & 0x7F : +// (octet & 0xE0) == 0xC0 ? octet & 0x1F : +// (octet & 0xF0) == 0xE0 ? octet & 0x0F : +// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; +// if (!width) return 0; +// if (pointer+width > end) return 0; +// for (k = 1; k < width; k ++) { +// octet = pointer[k]; +// if ((octet & 0xC0) != 0x80) return 0; +// value = (value << 6) + (octet & 0x3F); +// } +// if (!((width == 1) || +// (width == 2 && value >= 0x80) || +// (width == 3 && value >= 0x800) || +// (width == 4 && value >= 0x10000))) return 0; +// +// pointer += width; +// } +// +// return 1; +//} +// + +// Create STREAM-START. +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) bool { + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + encoding: encoding, + } + return true +} + +// Create STREAM-END. +func yaml_stream_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + } + return true +} + +// Create DOCUMENT-START. +func yaml_document_start_event_initialize(event *yaml_event_t, version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, implicit bool) bool { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: implicit, + } + return true +} + +// Create DOCUMENT-END. +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) bool { + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + implicit: implicit, + } + return true +} + +///* +// * Create ALIAS. +// */ +// +//YAML_DECLARE(int) +//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t) +//{ +// mark yaml_mark_t = { 0, 0, 0 } +// anchor_copy *yaml_char_t = NULL +// +// assert(event) // Non-NULL event object is expected. +// assert(anchor) // Non-NULL anchor is expected. +// +// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0 +// +// anchor_copy = yaml_strdup(anchor) +// if (!anchor_copy) +// return 0 +// +// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark) +// +// return 1 +//} + +// Create SCALAR. +func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + anchor: anchor, + tag: tag, + value: value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-START. +func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } + return true +} + +// Create SEQUENCE-END. +func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + } + return true +} + +// Create MAPPING-START. +func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) bool { + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(style), + } + return true +} + +// Create MAPPING-END. +func yaml_mapping_end_event_initialize(event *yaml_event_t) bool { + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + } + return true +} + +// Destroy an event object. +func yaml_event_delete(event *yaml_event_t) { + *event = yaml_event_t{} +} + +///* +// * Create a document object. +// */ +// +//YAML_DECLARE(int) +//yaml_document_initialize(document *yaml_document_t, +// version_directive *yaml_version_directive_t, +// tag_directives_start *yaml_tag_directive_t, +// tag_directives_end *yaml_tag_directive_t, +// start_implicit int, end_implicit int) +//{ +// struct { +// error yaml_error_type_t +// } context +// struct { +// start *yaml_node_t +// end *yaml_node_t +// top *yaml_node_t +// } nodes = { NULL, NULL, NULL } +// version_directive_copy *yaml_version_directive_t = NULL +// struct { +// start *yaml_tag_directive_t +// end *yaml_tag_directive_t +// top *yaml_tag_directive_t +// } tag_directives_copy = { NULL, NULL, NULL } +// value yaml_tag_directive_t = { NULL, NULL } +// mark yaml_mark_t = { 0, 0, 0 } +// +// assert(document) // Non-NULL document object is expected. +// assert((tag_directives_start && tag_directives_end) || +// (tag_directives_start == tag_directives_end)) +// // Valid tag directives are expected. +// +// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error +// +// if (version_directive) { +// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) +// if (!version_directive_copy) goto error +// version_directive_copy.major = version_directive.major +// version_directive_copy.minor = version_directive.minor +// } +// +// if (tag_directives_start != tag_directives_end) { +// tag_directive *yaml_tag_directive_t +// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) +// goto error +// for (tag_directive = tag_directives_start +// tag_directive != tag_directives_end; tag_directive ++) { +// assert(tag_directive.handle) +// assert(tag_directive.prefix) +// if (!yaml_check_utf8(tag_directive.handle, +// strlen((char *)tag_directive.handle))) +// goto error +// if (!yaml_check_utf8(tag_directive.prefix, +// strlen((char *)tag_directive.prefix))) +// goto error +// value.handle = yaml_strdup(tag_directive.handle) +// value.prefix = yaml_strdup(tag_directive.prefix) +// if (!value.handle || !value.prefix) goto error +// if (!PUSH(&context, tag_directives_copy, value)) +// goto error +// value.handle = NULL +// value.prefix = NULL +// } +// } +// +// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, +// tag_directives_copy.start, tag_directives_copy.top, +// start_implicit, end_implicit, mark, mark) +// +// return 1 +// +//error: +// STACK_DEL(&context, nodes) +// yaml_free(version_directive_copy) +// while (!STACK_EMPTY(&context, tag_directives_copy)) { +// value yaml_tag_directive_t = POP(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// } +// STACK_DEL(&context, tag_directives_copy) +// yaml_free(value.handle) +// yaml_free(value.prefix) +// +// return 0 +//} +// +///* +// * Destroy a document object. +// */ +// +//YAML_DECLARE(void) +//yaml_document_delete(document *yaml_document_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// tag_directive *yaml_tag_directive_t +// +// context.error = YAML_NO_ERROR // Eliminate a compliler warning. +// +// assert(document) // Non-NULL document object is expected. +// +// while (!STACK_EMPTY(&context, document.nodes)) { +// node yaml_node_t = POP(&context, document.nodes) +// yaml_free(node.tag) +// switch (node.type) { +// case YAML_SCALAR_NODE: +// yaml_free(node.data.scalar.value) +// break +// case YAML_SEQUENCE_NODE: +// STACK_DEL(&context, node.data.sequence.items) +// break +// case YAML_MAPPING_NODE: +// STACK_DEL(&context, node.data.mapping.pairs) +// break +// default: +// assert(0) // Should not happen. +// } +// } +// STACK_DEL(&context, document.nodes) +// +// yaml_free(document.version_directive) +// for (tag_directive = document.tag_directives.start +// tag_directive != document.tag_directives.end +// tag_directive++) { +// yaml_free(tag_directive.handle) +// yaml_free(tag_directive.prefix) +// } +// yaml_free(document.tag_directives.start) +// +// memset(document, 0, sizeof(yaml_document_t)) +//} +// +///** +// * Get a document node. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_node(document *yaml_document_t, index int) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (index > 0 && document.nodes.start + index <= document.nodes.top) { +// return document.nodes.start + index - 1 +// } +// return NULL +//} +// +///** +// * Get the root object. +// */ +// +//YAML_DECLARE(yaml_node_t *) +//yaml_document_get_root_node(document *yaml_document_t) +//{ +// assert(document) // Non-NULL document object is expected. +// +// if (document.nodes.top != document.nodes.start) { +// return document.nodes.start +// } +// return NULL +//} +// +///* +// * Add a scalar node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_scalar(document *yaml_document_t, +// tag *yaml_char_t, value *yaml_char_t, length int, +// style yaml_scalar_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// value_copy *yaml_char_t = NULL +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// assert(value) // Non-NULL value is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (length < 0) { +// length = strlen((char *)value) +// } +// +// if (!yaml_check_utf8(value, length)) goto error +// value_copy = yaml_malloc(length+1) +// if (!value_copy) goto error +// memcpy(value_copy, value, length) +// value_copy[length] = '\0' +// +// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// yaml_free(tag_copy) +// yaml_free(value_copy) +// +// return 0 +//} +// +///* +// * Add a sequence node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_sequence(document *yaml_document_t, +// tag *yaml_char_t, style yaml_sequence_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_item_t +// end *yaml_node_item_t +// top *yaml_node_item_t +// } items = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error +// +// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, items) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Add a mapping node to a document. +// */ +// +//YAML_DECLARE(int) +//yaml_document_add_mapping(document *yaml_document_t, +// tag *yaml_char_t, style yaml_mapping_style_t) +//{ +// struct { +// error yaml_error_type_t +// } context +// mark yaml_mark_t = { 0, 0, 0 } +// tag_copy *yaml_char_t = NULL +// struct { +// start *yaml_node_pair_t +// end *yaml_node_pair_t +// top *yaml_node_pair_t +// } pairs = { NULL, NULL, NULL } +// node yaml_node_t +// +// assert(document) // Non-NULL document object is expected. +// +// if (!tag) { +// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG +// } +// +// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error +// tag_copy = yaml_strdup(tag) +// if (!tag_copy) goto error +// +// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error +// +// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, +// style, mark, mark) +// if (!PUSH(&context, document.nodes, node)) goto error +// +// return document.nodes.top - document.nodes.start +// +//error: +// STACK_DEL(&context, pairs) +// yaml_free(tag_copy) +// +// return 0 +//} +// +///* +// * Append an item to a sequence node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_sequence_item(document *yaml_document_t, +// sequence int, item int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// assert(document) // Non-NULL document is required. +// assert(sequence > 0 +// && document.nodes.start + sequence <= document.nodes.top) +// // Valid sequence id is required. +// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) +// // A sequence node is required. +// assert(item > 0 && document.nodes.start + item <= document.nodes.top) +// // Valid item id is required. +// +// if (!PUSH(&context, +// document.nodes.start[sequence-1].data.sequence.items, item)) +// return 0 +// +// return 1 +//} +// +///* +// * Append a pair of a key and a value to a mapping node. +// */ +// +//YAML_DECLARE(int) +//yaml_document_append_mapping_pair(document *yaml_document_t, +// mapping int, key int, value int) +//{ +// struct { +// error yaml_error_type_t +// } context +// +// pair yaml_node_pair_t +// +// assert(document) // Non-NULL document is required. +// assert(mapping > 0 +// && document.nodes.start + mapping <= document.nodes.top) +// // Valid mapping id is required. +// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) +// // A mapping node is required. +// assert(key > 0 && document.nodes.start + key <= document.nodes.top) +// // Valid key id is required. +// assert(value > 0 && document.nodes.start + value <= document.nodes.top) +// // Valid value id is required. +// +// pair.key = key +// pair.value = value +// +// if (!PUSH(&context, +// document.nodes.start[mapping-1].data.mapping.pairs, pair)) +// return 0 +// +// return 1 +//} +// +// diff --git a/vendor/github.com/sanathkr/go-yaml/decode.go b/vendor/github.com/sanathkr/go-yaml/decode.go new file mode 100644 index 000000000000..c35932845990 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/decode.go @@ -0,0 +1,709 @@ +package yaml + +import ( + "encoding" + "encoding/base64" + "fmt" + "math" + "reflect" + "strconv" + "time" +) + +const ( + documentNode = 1 << iota + mappingNode + sequenceNode + scalarNode + aliasNode +) + +type node struct { + kind int + line, column int + tag string + value string + implicit bool + children []*node + anchors map[string]*node +} + +// ---------------------------------------------------------------------------- +// Parser, produces a node tree out of a libyaml event stream. + +type parser struct { + parser yaml_parser_t + event yaml_event_t + doc *node +} + +func newParser(b []byte) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") + } + + if len(b) == 0 { + b = []byte{'\n'} + } + + yaml_parser_set_input_string(&p.parser, b) + + p.skip() + if p.event.typ != yaml_STREAM_START_EVENT { + panic("expected stream start event, got " + strconv.Itoa(int(p.event.typ))) + } + p.skip() + return &p +} + +func (p *parser) destroy() { + if p.event.typ != yaml_NO_EVENT { + yaml_event_delete(&p.event) + } + yaml_parser_delete(&p.parser) +} + +func (p *parser) skip() { + if p.event.typ != yaml_NO_EVENT { + if p.event.typ == yaml_STREAM_END_EVENT { + failf("attempted to go past the end of stream; corrupted value?") + } + yaml_event_delete(&p.event) + } + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() + } +} + +func (p *parser) fail() { + var where string + var line int + if p.parser.problem_mark.line != 0 { + line = p.parser.problem_mark.line + } else if p.parser.context_mark.line != 0 { + line = p.parser.context_mark.line + } + if line != 0 { + where = "line " + strconv.Itoa(line) + ": " + } + var msg string + if len(p.parser.problem) > 0 { + msg = p.parser.problem + } else { + msg = "unknown problem parsing YAML content" + } + failf("%s%s", where, msg) +} + +func (p *parser) anchor(n *node, anchor []byte) { + if anchor != nil { + p.doc.anchors[string(anchor)] = n + } +} + +func (p *parser) parse() *node { + switch p.event.typ { + case yaml_SCALAR_EVENT: + return p.scalar() + case yaml_ALIAS_EVENT: + return p.alias() + case yaml_MAPPING_START_EVENT: + return p.mapping() + case yaml_SEQUENCE_START_EVENT: + return p.sequence() + case yaml_DOCUMENT_START_EVENT: + return p.document() + case yaml_STREAM_END_EVENT: + // Happens when attempting to decode an empty buffer. + return nil + default: + panic("attempted to parse unknown event: " + strconv.Itoa(int(p.event.typ))) + } +} + +func (p *parser) node(kind int) *node { + return &node{ + kind: kind, + line: p.event.start_mark.line, + column: p.event.start_mark.column, + } +} + +func (p *parser) document() *node { + n := p.node(documentNode) + n.anchors = make(map[string]*node) + p.doc = n + p.skip() + n.children = append(n.children, p.parse()) + if p.event.typ != yaml_DOCUMENT_END_EVENT { + panic("expected end of document event but got " + strconv.Itoa(int(p.event.typ))) + } + p.skip() + return n +} + +func (p *parser) alias() *node { + n := p.node(aliasNode) + n.value = string(p.event.anchor) + p.skip() + return n +} + +func (p *parser) scalar() *node { + n := p.node(scalarNode) + n.value = string(p.event.value) + n.tag = string(p.event.tag) + n.implicit = p.event.implicit + p.anchor(n, p.event.anchor) + p.skip() + return n +} + +func (p *parser) sequence() *node { + n := p.node(sequenceNode) + n.tag = string(p.event.tag) + p.anchor(n, p.event.anchor) + p.skip() + for p.event.typ != yaml_SEQUENCE_END_EVENT { + n.children = append(n.children, p.parse()) + } + p.skip() + return n +} + +func (p *parser) mapping() *node { + n := p.node(mappingNode) + n.tag = string(p.event.tag) + p.anchor(n, p.event.anchor) + p.skip() + for p.event.typ != yaml_MAPPING_END_EVENT { + n.children = append(n.children, p.parse(), p.parse()) + } + p.skip() + return n +} + +// ---------------------------------------------------------------------------- +// Decoder, unmarshals a node into a provided value. + +type decoder struct { + doc *node + aliases map[string]bool + mapType reflect.Type + terrors []string + strict bool +} + +var ( + mapItemType = reflect.TypeOf(MapItem{}) + durationType = reflect.TypeOf(time.Duration(0)) + defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) + ifaceType = defaultMapType.Elem() + tagUnmarshalers = map[string]TagUnmarshaler{} +) + +func newDecoder(strict bool) *decoder { + d := &decoder{mapType: defaultMapType, strict: strict} + d.aliases = make(map[string]bool) + return d +} + +func registerCustomTagUnmarshaler(tag string, unmarshaler TagUnmarshaler) { + tagUnmarshalers[tag] = unmarshaler +} + +func unregisterCustomTagUnmarshaler(tag string) { + if _, ok := tagUnmarshalers[tag]; ok { + delete(tagUnmarshalers, tag) + } +} + +func (d *decoder) terror(n *node, tag string, out reflect.Value) { + if n.tag != "" { + tag = n.tag + } + value := n.value + if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG { + if len(value) > 10 { + value = " `" + value[:7] + "...`" + } else { + value = " `" + value + "`" + } + } + d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type())) +} + +func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { + terrlen := len(d.terrors) + err := u.UnmarshalYAML(func(v interface{}) (err error) { + defer handleErr(&err) + d.unmarshal(n, reflect.ValueOf(v)) + if len(d.terrors) > terrlen { + issues := d.terrors[terrlen:] + d.terrors = d.terrors[:terrlen] + return &TypeError{issues} + } + return nil + }) + if e, ok := err.(*TypeError); ok { + d.terrors = append(d.terrors, e.Errors...) + return false + } + if err != nil { + fail(err) + } + return true +} + +// d.prepare initializes and dereferences pointers and calls UnmarshalYAML +// if a value is found to implement it. +// It returns the initialized and dereferenced out value, whether +// unmarshalling was already done by UnmarshalYAML, and if so whether +// its types unmarshalled appropriately. +// +// If n holds a null value, prepare returns before doing anything. +func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { + if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "" && n.implicit) { + return out, false, false + } + again := true + for again { + again = false + if out.Kind() == reflect.Ptr { + if out.IsNil() { + out.Set(reflect.New(out.Type().Elem())) + } + out = out.Elem() + again = true + } + if out.CanAddr() { + if u, ok := out.Addr().Interface().(Unmarshaler); ok { + good = d.callUnmarshaler(n, u) + return out, true, good + } + } + } + return out, false, false +} + +func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { + switch n.kind { + case documentNode: + return d.document(n, out) + case aliasNode: + return d.alias(n, out) + } + out, unmarshaled, good := d.prepare(n, out) + if unmarshaled { + return good + } + switch n.kind { + case scalarNode: + good = d.scalar(n, out) + case mappingNode: + good = d.mapping(n, out) + case sequenceNode: + good = d.sequence(n, out) + default: + panic("internal error: unknown node kind: " + strconv.Itoa(n.kind)) + } + + // If the node has a tag, and a custom tag unmarshaler is registered, + // then call it to unmarshal rest of the tree + if good && len(n.tag) > 0 { + if unmarshaller, found := tagUnmarshalers[n.tag]; found { + tagSuffix := n.tag[1:] // Remove starting ! from tag + newOutput := unmarshaller.UnmarshalYAMLTag(tagSuffix, out) + out.Set(newOutput) + } + } + + return good +} + +func (d *decoder) document(n *node, out reflect.Value) (good bool) { + if len(n.children) == 1 { + d.doc = n + d.unmarshal(n.children[0], out) + return true + } + return false +} + +func (d *decoder) alias(n *node, out reflect.Value) (good bool) { + an, ok := d.doc.anchors[n.value] + if !ok { + failf("unknown anchor '%s' referenced", n.value) + } + if d.aliases[n.value] { + failf("anchor '%s' value contains itself", n.value) + } + d.aliases[n.value] = true + good = d.unmarshal(an, out) + delete(d.aliases, n.value) + return good +} + +var zeroValue reflect.Value + +func resetMap(out reflect.Value) { + for _, k := range out.MapKeys() { + out.SetMapIndex(k, zeroValue) + } +} + +func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { + var tag string + var resolved interface{} + if n.tag == "" && !n.implicit { + tag = yaml_STR_TAG + resolved = n.value + } else { + tag, resolved = resolve(n.tag, n.value) + if tag == yaml_BINARY_TAG { + data, err := base64.StdEncoding.DecodeString(resolved.(string)) + if err != nil { + failf("!!binary value contains invalid base64 data") + } + resolved = string(data) + } + } + if resolved == nil { + if out.Kind() == reflect.Map && !out.CanAddr() { + resetMap(out) + } else { + out.Set(reflect.Zero(out.Type())) + } + return true + } + if s, ok := resolved.(string); ok && out.CanAddr() { + if u, ok := out.Addr().Interface().(encoding.TextUnmarshaler); ok { + err := u.UnmarshalText([]byte(s)) + if err != nil { + fail(err) + } + return true + } + } + switch out.Kind() { + case reflect.String: + if tag == yaml_BINARY_TAG { + out.SetString(resolved.(string)) + good = true + } else if resolved != nil { + out.SetString(n.value) + good = true + } + case reflect.Interface: + if resolved == nil { + out.Set(reflect.Zero(out.Type())) + } else { + out.Set(reflect.ValueOf(resolved)) + } + good = true + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + switch resolved := resolved.(type) { + case int: + if !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + good = true + } + case int64: + if !out.OverflowInt(resolved) { + out.SetInt(resolved) + good = true + } + case uint64: + if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + good = true + } + case float64: + if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { + out.SetInt(int64(resolved)) + good = true + } + case string: + if out.Type() == durationType { + d, err := time.ParseDuration(resolved) + if err == nil { + out.SetInt(int64(d)) + good = true + } + } + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + switch resolved := resolved.(type) { + case int: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + good = true + } + case int64: + if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + good = true + } + case uint64: + if !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + good = true + } + case float64: + if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { + out.SetUint(uint64(resolved)) + good = true + } + } + case reflect.Bool: + switch resolved := resolved.(type) { + case bool: + out.SetBool(resolved) + good = true + } + case reflect.Float32, reflect.Float64: + switch resolved := resolved.(type) { + case int: + out.SetFloat(float64(resolved)) + good = true + case int64: + out.SetFloat(float64(resolved)) + good = true + case uint64: + out.SetFloat(float64(resolved)) + good = true + case float64: + out.SetFloat(resolved) + good = true + } + case reflect.Ptr: + if out.Type().Elem() == reflect.TypeOf(resolved) { + // TODO DOes this make sense? When is out a Ptr except when decoding a nil value? + elem := reflect.New(out.Type().Elem()) + elem.Elem().Set(reflect.ValueOf(resolved)) + out.Set(elem) + good = true + } + } + if !good { + d.terror(n, tag, out) + } + return good +} + +func settableValueOf(i interface{}) reflect.Value { + v := reflect.ValueOf(i) + sv := reflect.New(v.Type()).Elem() + sv.Set(v) + return sv +} + +func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { + l := len(n.children) + + var iface reflect.Value + switch out.Kind() { + case reflect.Slice: + out.Set(reflect.MakeSlice(out.Type(), l, l)) + case reflect.Interface: + // No type hints. Will have to use a generic sequence. + iface = out + out = settableValueOf(make([]interface{}, l)) + default: + d.terror(n, yaml_SEQ_TAG, out) + return false + } + et := out.Type().Elem() + + j := 0 + for i := 0; i < l; i++ { + e := reflect.New(et).Elem() + if ok := d.unmarshal(n.children[i], e); ok { + out.Index(j).Set(e) + j++ + } + } + out.Set(out.Slice(0, j)) + if iface.IsValid() { + iface.Set(out) + } + return true +} + +func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { + switch out.Kind() { + case reflect.Struct: + return d.mappingStruct(n, out) + case reflect.Slice: + return d.mappingSlice(n, out) + case reflect.Map: + // okay + case reflect.Interface: + if d.mapType.Kind() == reflect.Map { + iface := out + out = reflect.MakeMap(d.mapType) + iface.Set(out) + } else { + slicev := reflect.New(d.mapType).Elem() + if !d.mappingSlice(n, slicev) { + return false + } + out.Set(slicev) + return true + } + default: + d.terror(n, yaml_MAP_TAG, out) + return false + } + outt := out.Type() + kt := outt.Key() + et := outt.Elem() + + mapType := d.mapType + if outt.Key() == ifaceType && outt.Elem() == ifaceType { + d.mapType = outt + } + + if out.IsNil() { + out.Set(reflect.MakeMap(outt)) + } + l := len(n.children) + for i := 0; i < l; i += 2 { + if isMerge(n.children[i]) { + d.merge(n.children[i+1], out) + continue + } + k := reflect.New(kt).Elem() + if d.unmarshal(n.children[i], k) { + kkind := k.Kind() + if kkind == reflect.Interface { + kkind = k.Elem().Kind() + } + if kkind == reflect.Map || kkind == reflect.Slice { + failf("invalid map key: %#v", k.Interface()) + } + e := reflect.New(et).Elem() + if d.unmarshal(n.children[i+1], e) { + out.SetMapIndex(k, e) + } + } + } + d.mapType = mapType + return true +} + +func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { + outt := out.Type() + if outt.Elem() != mapItemType { + d.terror(n, yaml_MAP_TAG, out) + return false + } + + mapType := d.mapType + d.mapType = outt + + var slice []MapItem + var l = len(n.children) + for i := 0; i < l; i += 2 { + if isMerge(n.children[i]) { + d.merge(n.children[i+1], out) + continue + } + item := MapItem{} + k := reflect.ValueOf(&item.Key).Elem() + if d.unmarshal(n.children[i], k) { + v := reflect.ValueOf(&item.Value).Elem() + if d.unmarshal(n.children[i+1], v) { + slice = append(slice, item) + } + } + } + out.Set(reflect.ValueOf(slice)) + d.mapType = mapType + return true +} + +func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { + sinfo, err := getStructInfo(out.Type()) + if err != nil { + panic(err) + } + name := settableValueOf("") + l := len(n.children) + + var inlineMap reflect.Value + var elemType reflect.Type + if sinfo.InlineMap != -1 { + inlineMap = out.Field(sinfo.InlineMap) + inlineMap.Set(reflect.New(inlineMap.Type()).Elem()) + elemType = inlineMap.Type().Elem() + } + + for i := 0; i < l; i += 2 { + ni := n.children[i] + if isMerge(ni) { + d.merge(n.children[i+1], out) + continue + } + if !d.unmarshal(ni, name) { + continue + } + if info, ok := sinfo.FieldsMap[name.String()]; ok { + var field reflect.Value + if info.Inline == nil { + field = out.Field(info.Num) + } else { + field = out.FieldByIndex(info.Inline) + } + d.unmarshal(n.children[i+1], field) + } else if sinfo.InlineMap != -1 { + if inlineMap.IsNil() { + inlineMap.Set(reflect.MakeMap(inlineMap.Type())) + } + value := reflect.New(elemType).Elem() + d.unmarshal(n.children[i+1], value) + inlineMap.SetMapIndex(name, value) + } else if d.strict { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in struct %s", n.line+1, name.String(), out.Type())) + } + } + return true +} + +func failWantMap() { + failf("map merge requires map or sequence of maps as the value") +} + +func (d *decoder) merge(n *node, out reflect.Value) { + switch n.kind { + case mappingNode: + d.unmarshal(n, out) + case aliasNode: + an, ok := d.doc.anchors[n.value] + if ok && an.kind != mappingNode { + failWantMap() + } + d.unmarshal(n, out) + case sequenceNode: + // Step backwards as earlier nodes take precedence. + for i := len(n.children) - 1; i >= 0; i-- { + ni := n.children[i] + if ni.kind == aliasNode { + an, ok := d.doc.anchors[ni.value] + if ok && an.kind != mappingNode { + failWantMap() + } + } else if ni.kind != mappingNode { + failWantMap() + } + d.unmarshal(ni, out) + } + default: + failWantMap() + } +} + +func isMerge(n *node) bool { + return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG) +} diff --git a/vendor/github.com/sanathkr/go-yaml/emitterc.go b/vendor/github.com/sanathkr/go-yaml/emitterc.go new file mode 100644 index 000000000000..41de8b856c2f --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/emitterc.go @@ -0,0 +1,1684 @@ +package yaml + +import ( + "bytes" +) + +// Flush the buffer if needed. +func flush(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) { + return yaml_emitter_flush(emitter) + } + return true +} + +// Put a character to the output buffer. +func put(emitter *yaml_emitter_t, value byte) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + emitter.buffer[emitter.buffer_pos] = value + emitter.buffer_pos++ + emitter.column++ + return true +} + +// Put a line break to the output buffer. +func put_break(emitter *yaml_emitter_t) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + switch emitter.line_break { + case yaml_CR_BREAK: + emitter.buffer[emitter.buffer_pos] = '\r' + emitter.buffer_pos += 1 + case yaml_LN_BREAK: + emitter.buffer[emitter.buffer_pos] = '\n' + emitter.buffer_pos += 1 + case yaml_CRLN_BREAK: + emitter.buffer[emitter.buffer_pos+0] = '\r' + emitter.buffer[emitter.buffer_pos+1] = '\n' + emitter.buffer_pos += 2 + default: + panic("unknown line break setting") + } + emitter.column = 0 + emitter.line++ + return true +} + +// Copy a character from a string into buffer. +func write(emitter *yaml_emitter_t, s []byte, i *int) bool { + if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { + return false + } + p := emitter.buffer_pos + w := width(s[*i]) + switch w { + case 4: + emitter.buffer[p+3] = s[*i+3] + fallthrough + case 3: + emitter.buffer[p+2] = s[*i+2] + fallthrough + case 2: + emitter.buffer[p+1] = s[*i+1] + fallthrough + case 1: + emitter.buffer[p+0] = s[*i+0] + default: + panic("unknown character width") + } + emitter.column++ + emitter.buffer_pos += w + *i += w + return true +} + +// Write a whole string into buffer. +func write_all(emitter *yaml_emitter_t, s []byte) bool { + for i := 0; i < len(s); { + if !write(emitter, s, &i) { + return false + } + } + return true +} + +// Copy a line break character from a string into buffer. +func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { + if s[*i] == '\n' { + if !put_break(emitter) { + return false + } + *i++ + } else { + if !write(emitter, s, i) { + return false + } + emitter.column = 0 + emitter.line++ + } + return true +} + +// Set an emitter error and return false. +func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_EMITTER_ERROR + emitter.problem = problem + return false +} + +// Emit an event. +func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.events = append(emitter.events, *event) + for !yaml_emitter_need_more_events(emitter) { + event := &emitter.events[emitter.events_head] + if !yaml_emitter_analyze_event(emitter, event) { + return false + } + if !yaml_emitter_state_machine(emitter, event) { + return false + } + yaml_event_delete(event) + emitter.events_head++ + } + return true +} + +// Check if we need to accumulate more events before emitting. +// +// We accumulate extra +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START +// +func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { + if emitter.events_head == len(emitter.events) { + return true + } + var accumulate int + switch emitter.events[emitter.events_head].typ { + case yaml_DOCUMENT_START_EVENT: + accumulate = 1 + break + case yaml_SEQUENCE_START_EVENT: + accumulate = 2 + break + case yaml_MAPPING_START_EVENT: + accumulate = 3 + break + default: + return false + } + if len(emitter.events)-emitter.events_head > accumulate { + return false + } + var level int + for i := emitter.events_head; i < len(emitter.events); i++ { + switch emitter.events[i].typ { + case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: + level++ + case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: + level-- + } + if level == 0 { + return false + } + } + return true +} + +// Append a directive to the directives stack. +func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { + for i := 0; i < len(emitter.tag_directives); i++ { + if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") + } + } + + // [Go] Do we actually need to copy this given garbage collection + // and the lack of deallocating destructors? + tag_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(tag_copy.handle, value.handle) + copy(tag_copy.prefix, value.prefix) + emitter.tag_directives = append(emitter.tag_directives, tag_copy) + return true +} + +// Increase the indentation level. +func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { + emitter.indents = append(emitter.indents, emitter.indent) + if emitter.indent < 0 { + if flow { + emitter.indent = emitter.best_indent + } else { + emitter.indent = 0 + } + } else if !indentless { + emitter.indent += emitter.best_indent + } + return true +} + +// State dispatcher. +func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { + switch emitter.state { + default: + case yaml_EMIT_STREAM_START_STATE: + return yaml_emitter_emit_stream_start(emitter, event) + + case yaml_EMIT_FIRST_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, true) + + case yaml_EMIT_DOCUMENT_START_STATE: + return yaml_emitter_emit_document_start(emitter, event, false) + + case yaml_EMIT_DOCUMENT_CONTENT_STATE: + return yaml_emitter_emit_document_content(emitter, event) + + case yaml_EMIT_DOCUMENT_END_STATE: + return yaml_emitter_emit_document_end(emitter, event) + + case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, true) + + case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_flow_sequence_item(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_KEY_STATE: + return yaml_emitter_emit_flow_mapping_key(emitter, event, false) + + case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, true) + + case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: + return yaml_emitter_emit_flow_mapping_value(emitter, event, false) + + case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, true) + + case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: + return yaml_emitter_emit_block_sequence_item(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: + return yaml_emitter_emit_block_mapping_key(emitter, event, false) + + case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, true) + + case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: + return yaml_emitter_emit_block_mapping_value(emitter, event, false) + + case yaml_EMIT_END_STATE: + return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") + } + panic("invalid emitter state") +} + +// Expect STREAM-START. +func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_STREAM_START_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") + } + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = event.encoding + if emitter.encoding == yaml_ANY_ENCODING { + emitter.encoding = yaml_UTF8_ENCODING + } + } + if emitter.best_indent < 2 || emitter.best_indent > 9 { + emitter.best_indent = 2 + } + if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { + emitter.best_width = 80 + } + if emitter.best_width < 0 { + emitter.best_width = 1<<31 - 1 + } + if emitter.line_break == yaml_ANY_BREAK { + emitter.line_break = yaml_LN_BREAK + } + + emitter.indent = -1 + emitter.line = 0 + emitter.column = 0 + emitter.whitespace = true + emitter.indention = true + + if emitter.encoding != yaml_UTF8_ENCODING { + if !yaml_emitter_write_bom(emitter) { + return false + } + } + emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE + return true +} + +// Expect DOCUMENT-START or STREAM-END. +func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + + if event.typ == yaml_DOCUMENT_START_EVENT { + + if event.version_directive != nil { + if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { + return false + } + } + + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { + return false + } + if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { + return false + } + } + + for i := 0; i < len(default_tag_directives); i++ { + tag_directive := &default_tag_directives[i] + if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { + return false + } + } + + implicit := event.implicit + if !first || emitter.canonical { + implicit = false + } + + if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if event.version_directive != nil { + implicit = false + if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if len(event.tag_directives) > 0 { + implicit = false + for i := 0; i < len(event.tag_directives); i++ { + tag_directive := &event.tag_directives[i] + if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { + return false + } + if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + if yaml_emitter_check_empty_document(emitter) { + implicit = false + } + if !implicit { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { + return false + } + if emitter.canonical { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + } + + emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE + return true + } + + if event.typ == yaml_STREAM_END_EVENT { + if emitter.open_ended { + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_END_STATE + return true + } + + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") +} + +// Expect the root node. +func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { + emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) + return yaml_emitter_emit_node(emitter, event, true, false, false, false) +} + +// Expect DOCUMENT-END. +func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if event.typ != yaml_DOCUMENT_END_EVENT { + return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !event.implicit { + // [Go] Allocate the slice elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_flush(emitter) { + return false + } + emitter.state = yaml_EMIT_DOCUMENT_START_STATE + emitter.tag_directives = emitter.tag_directives[:0] + return true +} + +// Expect a flow item node. +func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +// Expect a flow key node. +func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + emitter.flow_level++ + } + + if event.typ == yaml_MAPPING_END_EVENT { + emitter.flow_level-- + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + if emitter.canonical && !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + + if !first { + if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { + return false + } + } + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + + if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a flow value node. +func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if emitter.canonical || emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block item node. +func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) { + return false + } + } + if event.typ == yaml_SEQUENCE_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) + return yaml_emitter_emit_node(emitter, event, false, true, false, false) +} + +// Expect a block key node. +func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { + if first { + if !yaml_emitter_increase_indent(emitter, false, false) { + return false + } + } + if event.typ == yaml_MAPPING_END_EVENT { + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true + } + if !yaml_emitter_write_indent(emitter) { + return false + } + if yaml_emitter_check_simple_key(emitter) { + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, true) + } + if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { + return false + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a block value node. +func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { + if simple { + if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { + return false + } + } else { + if !yaml_emitter_write_indent(emitter) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { + return false + } + } + emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) + return yaml_emitter_emit_node(emitter, event, false, false, true, false) +} + +// Expect a node. +func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, + root bool, sequence bool, mapping bool, simple_key bool) bool { + + emitter.root_context = root + emitter.sequence_context = sequence + emitter.mapping_context = mapping + emitter.simple_key_context = simple_key + + switch event.typ { + case yaml_ALIAS_EVENT: + return yaml_emitter_emit_alias(emitter, event) + case yaml_SCALAR_EVENT: + return yaml_emitter_emit_scalar(emitter, event) + case yaml_SEQUENCE_START_EVENT: + return yaml_emitter_emit_sequence_start(emitter, event) + case yaml_MAPPING_START_EVENT: + return yaml_emitter_emit_mapping_start(emitter, event) + default: + return yaml_emitter_set_emitter_error(emitter, + "expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS") + } +} + +// Expect ALIAS. +func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SCALAR. +func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_select_scalar_style(emitter, event) { + return false + } + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if !yaml_emitter_increase_indent(emitter, true, false) { + return false + } + if !yaml_emitter_process_scalar(emitter) { + return false + } + emitter.indent = emitter.indents[len(emitter.indents)-1] + emitter.indents = emitter.indents[:len(emitter.indents)-1] + emitter.state = emitter.states[len(emitter.states)-1] + emitter.states = emitter.states[:len(emitter.states)-1] + return true +} + +// Expect SEQUENCE-START. +func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || + yaml_emitter_check_empty_sequence(emitter) { + emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE + } + return true +} + +// Expect MAPPING-START. +func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { + if !yaml_emitter_process_anchor(emitter) { + return false + } + if !yaml_emitter_process_tag(emitter) { + return false + } + if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || + yaml_emitter_check_empty_mapping(emitter) { + emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE + } else { + emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE + } + return true +} + +// Check if the document content is an empty scalar. +func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { + return false // [Go] Huh? +} + +// Check if the next events represent an empty sequence. +func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT +} + +// Check if the next events represent an empty mapping. +func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { + if len(emitter.events)-emitter.events_head < 2 { + return false + } + return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && + emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT +} + +// Check if the next node can be expressed as a simple key. +func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { + length := 0 + switch emitter.events[emitter.events_head].typ { + case yaml_ALIAS_EVENT: + length += len(emitter.anchor_data.anchor) + case yaml_SCALAR_EVENT: + if emitter.scalar_data.multiline { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + + len(emitter.scalar_data.value) + case yaml_SEQUENCE_START_EVENT: + if !yaml_emitter_check_empty_sequence(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + case yaml_MAPPING_START_EVENT: + if !yaml_emitter_check_empty_mapping(emitter) { + return false + } + length += len(emitter.anchor_data.anchor) + + len(emitter.tag_data.handle) + + len(emitter.tag_data.suffix) + default: + return false + } + return length <= 128 +} + +// Determine an acceptable scalar style. +func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 + if no_tag && !event.implicit && !event.quoted_implicit { + return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") + } + + style := event.scalar_style() + if style == yaml_ANY_SCALAR_STYLE { + style = yaml_PLAIN_SCALAR_STYLE + } + if emitter.canonical { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + if emitter.simple_key_context && emitter.scalar_data.multiline { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + + if style == yaml_PLAIN_SCALAR_STYLE { + if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || + emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + if no_tag && !event.implicit { + style = yaml_SINGLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { + if !emitter.scalar_data.single_quoted_allowed { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { + if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + } + + if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { + emitter.tag_data.handle = []byte{'!'} + } + emitter.scalar_data.style = style + return true +} + +// Write an achor. +func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { + if emitter.anchor_data.anchor == nil { + return true + } + c := []byte{'&'} + if emitter.anchor_data.alias { + c[0] = '*' + } + if !yaml_emitter_write_indicator(emitter, c, true, false, false) { + return false + } + return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) +} + +// Write a tag. +func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { + if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { + return true + } + if len(emitter.tag_data.handle) > 0 { + if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { + return false + } + if len(emitter.tag_data.suffix) > 0 { + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + } + } else { + // [Go] Allocate these slices elsewhere. + if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { + return false + } + if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { + return false + } + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { + return false + } + } + return true +} + +// Write a scalar. +func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { + switch emitter.scalar_data.style { + case yaml_PLAIN_SCALAR_STYLE: + return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_SINGLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_DOUBLE_QUOTED_SCALAR_STYLE: + return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) + + case yaml_LITERAL_SCALAR_STYLE: + return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) + + case yaml_FOLDED_SCALAR_STYLE: + return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) + } + panic("unknown scalar style") +} + +// Check if a %YAML directive is valid. +func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { + if version_directive.major != 1 || version_directive.minor != 1 { + return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") + } + return true +} + +// Check if a %TAG directive is valid. +func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { + handle := tag_directive.handle + prefix := tag_directive.prefix + if len(handle) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") + } + if handle[0] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") + } + if handle[len(handle)-1] != '!' { + return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") + } + for i := 1; i < len(handle)-1; i += width(handle[i]) { + if !is_alpha(handle, i) { + return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") + } + } + if len(prefix) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") + } + return true +} + +// Check if an anchor is valid. +func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { + if len(anchor) == 0 { + problem := "anchor value must not be empty" + if alias { + problem = "alias value must not be empty" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + for i := 0; i < len(anchor); i += width(anchor[i]) { + if !is_alpha(anchor, i) { + problem := "anchor value must contain alphanumerical characters only" + if alias { + problem = "alias value must contain alphanumerical characters only" + } + return yaml_emitter_set_emitter_error(emitter, problem) + } + } + emitter.anchor_data.anchor = anchor + emitter.anchor_data.alias = alias + return true +} + +// Check if a tag is valid. +func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { + if len(tag) == 0 { + return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") + } + for i := 0; i < len(emitter.tag_directives); i++ { + tag_directive := &emitter.tag_directives[i] + if bytes.HasPrefix(tag, tag_directive.prefix) { + emitter.tag_data.handle = tag_directive.handle + emitter.tag_data.suffix = tag[len(tag_directive.prefix):] + return true + } + } + emitter.tag_data.suffix = tag + return true +} + +// Check if a scalar is valid. +func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { + var ( + block_indicators = false + flow_indicators = false + line_breaks = false + special_characters = false + + leading_space = false + leading_break = false + trailing_space = false + trailing_break = false + break_space = false + space_break = false + + preceded_by_whitespace = false + followed_by_whitespace = false + previous_space = false + previous_break = false + ) + + emitter.scalar_data.value = value + + if len(value) == 0 { + emitter.scalar_data.multiline = false + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = false + return true + } + + if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { + block_indicators = true + flow_indicators = true + } + + preceded_by_whitespace = true + for i, w := 0, 0; i < len(value); i += w { + w = width(value[i]) + followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) + + if i == 0 { + switch value[i] { + case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': + flow_indicators = true + block_indicators = true + case '?', ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '-': + if followed_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } else { + switch value[i] { + case ',', '?', '[', ']', '{', '}': + flow_indicators = true + case ':': + flow_indicators = true + if followed_by_whitespace { + block_indicators = true + } + case '#': + if preceded_by_whitespace { + flow_indicators = true + block_indicators = true + } + } + } + + if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { + special_characters = true + } + if is_space(value, i) { + if i == 0 { + leading_space = true + } + if i+width(value[i]) == len(value) { + trailing_space = true + } + if previous_break { + break_space = true + } + previous_space = true + previous_break = false + } else if is_break(value, i) { + line_breaks = true + if i == 0 { + leading_break = true + } + if i+width(value[i]) == len(value) { + trailing_break = true + } + if previous_space { + space_break = true + } + previous_space = false + previous_break = true + } else { + previous_space = false + previous_break = false + } + + // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. + preceded_by_whitespace = is_blankz(value, i) + } + + emitter.scalar_data.multiline = line_breaks + emitter.scalar_data.flow_plain_allowed = true + emitter.scalar_data.block_plain_allowed = true + emitter.scalar_data.single_quoted_allowed = true + emitter.scalar_data.block_allowed = true + + if leading_space || leading_break || trailing_space || trailing_break { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if trailing_space { + emitter.scalar_data.block_allowed = false + } + if break_space { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + } + if space_break || special_characters { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + emitter.scalar_data.single_quoted_allowed = false + emitter.scalar_data.block_allowed = false + } + if line_breaks { + emitter.scalar_data.flow_plain_allowed = false + emitter.scalar_data.block_plain_allowed = false + } + if flow_indicators { + emitter.scalar_data.flow_plain_allowed = false + } + if block_indicators { + emitter.scalar_data.block_plain_allowed = false + } + return true +} + +// Check if the event data is valid. +func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + + emitter.anchor_data.anchor = nil + emitter.tag_data.handle = nil + emitter.tag_data.suffix = nil + emitter.scalar_data.value = nil + + switch event.typ { + case yaml_ALIAS_EVENT: + if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { + return false + } + + case yaml_SCALAR_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + if !yaml_emitter_analyze_scalar(emitter, event.value) { + return false + } + + case yaml_SEQUENCE_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + + case yaml_MAPPING_START_EVENT: + if len(event.anchor) > 0 { + if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { + return false + } + } + if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { + if !yaml_emitter_analyze_tag(emitter, event.tag) { + return false + } + } + } + return true +} + +// Write the BOM character. +func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { + if !flush(emitter) { + return false + } + pos := emitter.buffer_pos + emitter.buffer[pos+0] = '\xEF' + emitter.buffer[pos+1] = '\xBB' + emitter.buffer[pos+2] = '\xBF' + emitter.buffer_pos += 3 + return true +} + +func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { + indent := emitter.indent + if indent < 0 { + indent = 0 + } + if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { + if !put_break(emitter) { + return false + } + } + for emitter.column < indent { + if !put(emitter, ' ') { + return false + } + } + emitter.whitespace = true + emitter.indention = true + return true +} + +func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, indicator) { + return false + } + emitter.whitespace = is_whitespace + emitter.indention = (emitter.indention && is_indention) + emitter.open_ended = false + return true +} + +func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + if !write_all(emitter, value) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { + if need_whitespace && !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + for i := 0; i < len(value); { + var must_write bool + switch value[i] { + case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': + must_write = true + default: + must_write = is_alpha(value, i) + } + if must_write { + if !write(emitter, value, &i) { + return false + } + } else { + w := width(value[i]) + for k := 0; k < w; k++ { + octet := value[i] + i++ + if !put(emitter, '%') { + return false + } + + c := octet >> 4 + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + + c = octet & 0x0f + if c < 10 { + c += '0' + } else { + c += 'A' - 10 + } + if !put(emitter, c) { + return false + } + } + } + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + if !emitter.whitespace { + if !put(emitter, ' ') { + return false + } + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + + emitter.whitespace = false + emitter.indention = false + if emitter.root_context { + emitter.open_ended = true + } + + return true +} + +func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { + return false + } + + spaces := false + breaks := false + for i := 0; i < len(value); { + if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + spaces = true + } else if is_break(value, i) { + if !breaks && value[i] == '\n' { + if !put_break(emitter) { + return false + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if value[i] == '\'' { + if !put(emitter, '\'') { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + spaces = false + breaks = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { + spaces := false + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { + return false + } + + for i := 0; i < len(value); { + if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || + is_bom(value, i) || is_break(value, i) || + value[i] == '"' || value[i] == '\\' { + + octet := value[i] + + var w int + var v rune + switch { + case octet&0x80 == 0x00: + w, v = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, v = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, v = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, v = 4, rune(octet&0x07) + } + for k := 1; k < w; k++ { + octet = value[i+k] + v = (v << 6) + (rune(octet) & 0x3F) + } + i += w + + if !put(emitter, '\\') { + return false + } + + var ok bool + switch v { + case 0x00: + ok = put(emitter, '0') + case 0x07: + ok = put(emitter, 'a') + case 0x08: + ok = put(emitter, 'b') + case 0x09: + ok = put(emitter, 't') + case 0x0A: + ok = put(emitter, 'n') + case 0x0b: + ok = put(emitter, 'v') + case 0x0c: + ok = put(emitter, 'f') + case 0x0d: + ok = put(emitter, 'r') + case 0x1b: + ok = put(emitter, 'e') + case 0x22: + ok = put(emitter, '"') + case 0x5c: + ok = put(emitter, '\\') + case 0x85: + ok = put(emitter, 'N') + case 0xA0: + ok = put(emitter, '_') + case 0x2028: + ok = put(emitter, 'L') + case 0x2029: + ok = put(emitter, 'P') + default: + if v <= 0xFF { + ok = put(emitter, 'x') + w = 2 + } else if v <= 0xFFFF { + ok = put(emitter, 'u') + w = 4 + } else { + ok = put(emitter, 'U') + w = 8 + } + for k := (w - 1) * 4; ok && k >= 0; k -= 4 { + digit := byte((v >> uint(k)) & 0x0F) + if digit < 10 { + ok = put(emitter, digit+'0') + } else { + ok = put(emitter, digit+'A'-10) + } + } + } + if !ok { + return false + } + spaces = false + } else if is_space(value, i) { + if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { + if !yaml_emitter_write_indent(emitter) { + return false + } + if is_space(value, i+1) { + if !put(emitter, '\\') { + return false + } + } + i += width(value[i]) + } else if !write(emitter, value, &i) { + return false + } + spaces = true + } else { + if !write(emitter, value, &i) { + return false + } + spaces = false + } + } + if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { + return false + } + emitter.whitespace = false + emitter.indention = false + return true +} + +func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { + if is_space(value, 0) || is_break(value, 0) { + indent_hint := []byte{'0' + byte(emitter.best_indent)} + if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { + return false + } + } + + emitter.open_ended = false + + var chomp_hint [1]byte + if len(value) == 0 { + chomp_hint[0] = '-' + } else { + i := len(value) - 1 + for value[i]&0xC0 == 0x80 { + i-- + } + if !is_break(value, i) { + chomp_hint[0] = '-' + } else if i == 0 { + chomp_hint[0] = '+' + emitter.open_ended = true + } else { + i-- + for value[i]&0xC0 == 0x80 { + i-- + } + if is_break(value, i) { + chomp_hint[0] = '+' + emitter.open_ended = true + } + } + } + if chomp_hint[0] != 0 { + if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { + return false + } + } + return true +} + +func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + if !put_break(emitter) { + return false + } + emitter.indention = true + emitter.whitespace = true + breaks := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + } + if !write(emitter, value, &i) { + return false + } + emitter.indention = false + breaks = false + } + } + + return true +} + +func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { + if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { + return false + } + if !yaml_emitter_write_block_scalar_hints(emitter, value) { + return false + } + + if !put_break(emitter) { + return false + } + emitter.indention = true + emitter.whitespace = true + + breaks := true + leading_spaces := true + for i := 0; i < len(value); { + if is_break(value, i) { + if !breaks && !leading_spaces && value[i] == '\n' { + k := 0 + for is_break(value, k) { + k += width(value[k]) + } + if !is_blankz(value, k) { + if !put_break(emitter) { + return false + } + } + } + if !write_break(emitter, value, &i) { + return false + } + emitter.indention = true + breaks = true + } else { + if breaks { + if !yaml_emitter_write_indent(emitter) { + return false + } + leading_spaces = is_blank(value, i) + } + if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { + if !yaml_emitter_write_indent(emitter) { + return false + } + i += width(value[i]) + } else { + if !write(emitter, value, &i) { + return false + } + } + emitter.indention = false + breaks = false + } + } + return true +} diff --git a/vendor/github.com/sanathkr/go-yaml/encode.go b/vendor/github.com/sanathkr/go-yaml/encode.go new file mode 100644 index 000000000000..84f84995517b --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/encode.go @@ -0,0 +1,306 @@ +package yaml + +import ( + "encoding" + "fmt" + "reflect" + "regexp" + "sort" + "strconv" + "strings" + "time" +) + +type encoder struct { + emitter yaml_emitter_t + event yaml_event_t + out []byte + flow bool +} + +func newEncoder() (e *encoder) { + e = &encoder{} + e.must(yaml_emitter_initialize(&e.emitter)) + yaml_emitter_set_output_string(&e.emitter, &e.out) + yaml_emitter_set_unicode(&e.emitter, true) + e.must(yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)) + e.emit() + e.must(yaml_document_start_event_initialize(&e.event, nil, nil, true)) + e.emit() + return e +} + +func (e *encoder) finish() { + e.must(yaml_document_end_event_initialize(&e.event, true)) + e.emit() + e.emitter.open_ended = false + e.must(yaml_stream_end_event_initialize(&e.event)) + e.emit() +} + +func (e *encoder) destroy() { + yaml_emitter_delete(&e.emitter) +} + +func (e *encoder) emit() { + // This will internally delete the e.event value. + if !yaml_emitter_emit(&e.emitter, &e.event) && e.event.typ != yaml_DOCUMENT_END_EVENT && e.event.typ != yaml_STREAM_END_EVENT { + e.must(false) + } +} + +func (e *encoder) must(ok bool) { + if !ok { + msg := e.emitter.problem + if msg == "" { + msg = "unknown problem generating YAML content" + } + failf("%s", msg) + } +} + +func (e *encoder) marshal(tag string, in reflect.Value) { + if !in.IsValid() { + e.nilv() + return + } + iface := in.Interface() + if m, ok := iface.(Marshaler); ok { + v, err := m.MarshalYAML() + if err != nil { + fail(err) + } + if v == nil { + e.nilv() + return + } + in = reflect.ValueOf(v) + } else if m, ok := iface.(encoding.TextMarshaler); ok { + text, err := m.MarshalText() + if err != nil { + fail(err) + } + in = reflect.ValueOf(string(text)) + } + switch in.Kind() { + case reflect.Interface: + if in.IsNil() { + e.nilv() + } else { + e.marshal(tag, in.Elem()) + } + case reflect.Map: + e.mapv(tag, in) + case reflect.Ptr: + if in.IsNil() { + e.nilv() + } else { + e.marshal(tag, in.Elem()) + } + case reflect.Struct: + e.structv(tag, in) + case reflect.Slice: + if in.Type().Elem() == mapItemType { + e.itemsv(tag, in) + } else { + e.slicev(tag, in) + } + case reflect.String: + e.stringv(tag, in) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if in.Type() == durationType { + e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) + } else { + e.intv(tag, in) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + e.uintv(tag, in) + case reflect.Float32, reflect.Float64: + e.floatv(tag, in) + case reflect.Bool: + e.boolv(tag, in) + default: + panic("cannot marshal type: " + in.Type().String()) + } +} + +func (e *encoder) mapv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + keys := keyList(in.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + e.marshal("", k) + e.marshal("", in.MapIndex(k)) + } + }) +} + +func (e *encoder) itemsv(tag string, in reflect.Value) { + e.mappingv(tag, func() { + slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) + for _, item := range slice { + e.marshal("", reflect.ValueOf(item.Key)) + e.marshal("", reflect.ValueOf(item.Value)) + } + }) +} + +func (e *encoder) structv(tag string, in reflect.Value) { + sinfo, err := getStructInfo(in.Type()) + if err != nil { + panic(err) + } + e.mappingv(tag, func() { + for _, info := range sinfo.FieldsList { + var value reflect.Value + if info.Inline == nil { + value = in.Field(info.Num) + } else { + value = in.FieldByIndex(info.Inline) + } + if info.OmitEmpty && isZero(value) { + continue + } + e.marshal("", reflect.ValueOf(info.Key)) + e.flow = info.Flow + e.marshal("", value) + } + if sinfo.InlineMap >= 0 { + m := in.Field(sinfo.InlineMap) + if m.Len() > 0 { + e.flow = false + keys := keyList(m.MapKeys()) + sort.Sort(keys) + for _, k := range keys { + if _, found := sinfo.FieldsMap[k.String()]; found { + panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) + } + e.marshal("", k) + e.flow = false + e.marshal("", m.MapIndex(k)) + } + } + } + }) +} + +func (e *encoder) mappingv(tag string, f func()) { + implicit := tag == "" + style := yaml_BLOCK_MAPPING_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_MAPPING_STYLE + } + e.must(yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + f() + e.must(yaml_mapping_end_event_initialize(&e.event)) + e.emit() +} + +func (e *encoder) slicev(tag string, in reflect.Value) { + implicit := tag == "" + style := yaml_BLOCK_SEQUENCE_STYLE + if e.flow { + e.flow = false + style = yaml_FLOW_SEQUENCE_STYLE + } + e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + e.emit() + n := in.Len() + for i := 0; i < n; i++ { + e.marshal("", in.Index(i)) + } + e.must(yaml_sequence_end_event_initialize(&e.event)) + e.emit() +} + +// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. +// +// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported +// in YAML 1.2 and by this package, but these should be marshalled quoted for +// the time being for compatibility with other parsers. +func isBase60Float(s string) (result bool) { + // Fast path. + if s == "" { + return false + } + c := s[0] + if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { + return false + } + // Do the full match. + return base60float.MatchString(s) +} + +// From http://yaml.org/type/float.html, except the regular expression there +// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. +var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) + +func (e *encoder) stringv(tag string, in reflect.Value) { + var style yaml_scalar_style_t + s := in.String() + rtag, rs := resolve("", s) + if rtag == yaml_BINARY_TAG { + if tag == "" || tag == yaml_STR_TAG { + tag = rtag + s = rs.(string) + } else if tag == yaml_BINARY_TAG { + failf("explicitly tagged !!binary data must be base64-encoded") + } else { + failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + } + } + if tag == "" && (rtag != yaml_STR_TAG || isBase60Float(s)) { + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } else if strings.Contains(s, "\n") { + style = yaml_LITERAL_SCALAR_STYLE + } else { + style = yaml_PLAIN_SCALAR_STYLE + } + e.emitScalar(s, "", tag, style) +} + +func (e *encoder) boolv(tag string, in reflect.Value) { + var s string + if in.Bool() { + s = "true" + } else { + s = "false" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) intv(tag string, in reflect.Value) { + s := strconv.FormatInt(in.Int(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) uintv(tag string, in reflect.Value) { + s := strconv.FormatUint(in.Uint(), 10) + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) floatv(tag string, in reflect.Value) { + // FIXME: Handle 64 bits here. + s := strconv.FormatFloat(float64(in.Float()), 'g', -1, 32) + switch s { + case "+Inf": + s = ".inf" + case "-Inf": + s = "-.inf" + case "NaN": + s = ".nan" + } + e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) nilv() { + e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) +} + +func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { + implicit := tag == "" + e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) + e.emit() +} diff --git a/vendor/github.com/sanathkr/go-yaml/parserc.go b/vendor/github.com/sanathkr/go-yaml/parserc.go new file mode 100644 index 000000000000..81d05dfe573f --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/parserc.go @@ -0,0 +1,1095 @@ +package yaml + +import ( + "bytes" +) + +// The parser implements the following grammar: +// +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// implicit_document ::= block_node DOCUMENT-END* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// block_node_or_indentless_sequence ::= +// ALIAS +// | properties (block_content | indentless_block_sequence)? +// | block_content +// | indentless_block_sequence +// block_node ::= ALIAS +// | properties block_content? +// | block_content +// flow_node ::= ALIAS +// | properties flow_content? +// | flow_content +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// block_content ::= block_collection | flow_collection | SCALAR +// flow_content ::= flow_collection | SCALAR +// block_collection ::= block_sequence | block_mapping +// flow_collection ::= flow_sequence | flow_mapping +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// block_mapping ::= BLOCK-MAPPING_START +// ((KEY block_node_or_indentless_sequence?)? +// (VALUE block_node_or_indentless_sequence?)?)* +// BLOCK-END +// flow_sequence ::= FLOW-SEQUENCE-START +// (flow_sequence_entry FLOW-ENTRY)* +// flow_sequence_entry? +// FLOW-SEQUENCE-END +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// flow_mapping ::= FLOW-MAPPING-START +// (flow_mapping_entry FLOW-ENTRY)* +// flow_mapping_entry? +// FLOW-MAPPING-END +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + +// Peek the next token in the token queue. +func peek_token(parser *yaml_parser_t) *yaml_token_t { + if parser.token_available || yaml_parser_fetch_more_tokens(parser) { + return &parser.tokens[parser.tokens_head] + } + return nil +} + +// Remove the next token from the queue (must be called after peek_token). +func skip_token(parser *yaml_parser_t) { + parser.token_available = false + parser.tokens_parsed++ + parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN + parser.tokens_head++ +} + +// Get the next event. +func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { + // Erase the event object. + *event = yaml_event_t{} + + // No events after the end of the stream or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { + return true + } + + // Generate the next event. + return yaml_parser_state_machine(parser, event) +} + +// Set parser error. +func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { + parser.error = yaml_PARSER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = problem_mark + return false +} + +// State dispatcher. +func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { + //trace("yaml_parser_state_machine", "state:", parser.state.String()) + + switch parser.state { + case yaml_PARSE_STREAM_START_STATE: + return yaml_parser_parse_stream_start(parser, event) + + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, true) + + case yaml_PARSE_DOCUMENT_START_STATE: + return yaml_parser_parse_document_start(parser, event, false) + + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return yaml_parser_parse_document_content(parser, event) + + case yaml_PARSE_DOCUMENT_END_STATE: + return yaml_parser_parse_document_end(parser, event) + + case yaml_PARSE_BLOCK_NODE_STATE: + return yaml_parser_parse_node(parser, event, true, false) + + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return yaml_parser_parse_node(parser, event, true, true) + + case yaml_PARSE_FLOW_NODE_STATE: + return yaml_parser_parse_node(parser, event, false, false) + + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, true) + + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_block_sequence_entry(parser, event, false) + + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_indentless_sequence_entry(parser, event) + + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, true) + + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return yaml_parser_parse_block_mapping_key(parser, event, false) + + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return yaml_parser_parse_block_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, true) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return yaml_parser_parse_flow_sequence_entry(parser, event, false) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) + + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) + + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, true) + + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return yaml_parser_parse_flow_mapping_key(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, false) + + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return yaml_parser_parse_flow_mapping_value(parser, event, true) + + default: + panic("invalid parser state") + } +} + +// Parse the production: +// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +// ************ +func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_STREAM_START_TOKEN { + return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) + } + parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + encoding: token.encoding, + } + skip_token(parser) + return true +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// * +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// ************************* +func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { + + token := peek_token(parser) + if token == nil { + return false + } + + // Parse extra document end indicators. + if !implicit { + for token.typ == yaml_DOCUMENT_END_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && + token.typ != yaml_TAG_DIRECTIVE_TOKEN && + token.typ != yaml_DOCUMENT_START_TOKEN && + token.typ != yaml_STREAM_END_TOKEN { + // Parse an implicit document. + if !yaml_parser_process_directives(parser, nil, nil) { + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_BLOCK_NODE_STATE + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + } else if token.typ != yaml_STREAM_END_TOKEN { + // Parse an explicit document. + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + start_mark := token.start_mark + if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { + return false + } + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_DOCUMENT_START_TOKEN { + yaml_parser_set_parser_error(parser, + "did not find expected ", token.start_mark) + return false + } + parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) + parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE + end_mark := token.end_mark + + *event = yaml_event_t{ + typ: yaml_DOCUMENT_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + version_directive: version_directive, + tag_directives: tag_directives, + implicit: false, + } + skip_token(parser) + + } else { + // Parse the stream end. + parser.state = yaml_PARSE_END_STATE + *event = yaml_event_t{ + typ: yaml_STREAM_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + } + + return true +} + +// Parse the productions: +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// *********** +// +func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || + token.typ == yaml_TAG_DIRECTIVE_TOKEN || + token.typ == yaml_DOCUMENT_START_TOKEN || + token.typ == yaml_DOCUMENT_END_TOKEN || + token.typ == yaml_STREAM_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + return yaml_parser_process_empty_scalar(parser, event, + token.start_mark) + } + return yaml_parser_parse_node(parser, event, true, false) +} + +// Parse the productions: +// implicit_document ::= block_node DOCUMENT-END* +// ************* +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +// +func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + start_mark := token.start_mark + end_mark := token.start_mark + + implicit := true + if token.typ == yaml_DOCUMENT_END_TOKEN { + end_mark = token.end_mark + skip_token(parser) + implicit = false + } + + parser.tag_directives = parser.tag_directives[:0] + + parser.state = yaml_PARSE_DOCUMENT_START_STATE + *event = yaml_event_t{ + typ: yaml_DOCUMENT_END_EVENT, + start_mark: start_mark, + end_mark: end_mark, + implicit: implicit, + } + return true +} + +// Parse the productions: +// block_node_or_indentless_sequence ::= +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// block_node ::= ALIAS +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// flow_node ::= ALIAS +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// properties ::= TAG ANCHOR? | ANCHOR TAG? +// ************************* +// block_content ::= block_collection | flow_collection | SCALAR +// ****** +// flow_content ::= flow_collection | SCALAR +// ****** +func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { + //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_ALIAS_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + *event = yaml_event_t{ + typ: yaml_ALIAS_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + anchor: token.value, + } + skip_token(parser) + return true + } + + start_mark := token.start_mark + end_mark := token.start_mark + + var tag_token bool + var tag_handle, tag_suffix, anchor []byte + var tag_mark yaml_mark_t + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + start_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } else if token.typ == yaml_TAG_TOKEN { + tag_token = true + tag_handle = token.value + tag_suffix = token.suffix + start_mark = token.start_mark + tag_mark = token.start_mark + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_ANCHOR_TOKEN { + anchor = token.value + end_mark = token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + } + + var tag []byte + if tag_token { + if len(tag_handle) == 0 { + tag = tag_suffix + tag_suffix = nil + } else { + for i := range parser.tag_directives { + if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { + tag = append([]byte(nil), parser.tag_directives[i].prefix...) + tag = append(tag, tag_suffix...) + break + } + } + if len(tag) == 0 { + yaml_parser_set_parser_error_context(parser, + "while parsing a node", start_mark, + "found undefined tag handle", tag_mark) + return false + } + } + } + + implicit := len(tag) == 0 + if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_SCALAR_TOKEN { + var plain_implicit, quoted_implicit bool + end_mark = token.end_mark + if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { + plain_implicit = true + } else if len(tag) == 0 { + quoted_implicit = true + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + value: token.value, + implicit: plain_implicit, + quoted_implicit: quoted_implicit, + style: yaml_style_t(token.style), + } + skip_token(parser) + return true + } + if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { + // [Go] Some of the events below can be merged as they differ only on style. + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), + } + return true + } + if token.typ == yaml_FLOW_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + return true + } + if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_SEQUENCE_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), + } + return true + } + if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { + end_mark = token.end_mark + parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), + } + return true + } + if len(anchor) > 0 || len(tag) > 0 { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: start_mark, + end_mark: end_mark, + anchor: anchor, + tag: tag, + implicit: implicit, + quoted_implicit: false, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true + } + + context := "while parsing a flow node" + if block { + context = "while parsing a block node" + } + yaml_parser_set_parser_error_context(parser, context, start_mark, + "did not find expected node content", token.start_mark) + return false +} + +// Parse the productions: +// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +// ******************** *********** * ********* +// +func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } else { + parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } + if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block collection", context_mark, + "did not find expected '-' indicator", token.start_mark) +} + +// Parse the productions: +// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +// *********** * +func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_BLOCK_ENTRY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_BLOCK_ENTRY_TOKEN && + token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, true, false) + } + parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? + } + return true +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* +// +// BLOCK-END +// ********* +// +func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ == yaml_KEY_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } else { + parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + } else if token.typ == yaml_BLOCK_END_TOKEN { + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + return true + } + + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a block mapping", context_mark, + "did not find expected key", token.start_mark) +} + +// Parse the productions: +// block_mapping ::= BLOCK-MAPPING_START +// +// ((KEY block_node_or_indentless_sequence?)? +// +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END +// +// +func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + mark := token.end_mark + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_KEY_TOKEN && + token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_BLOCK_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, true, true) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) + } + parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence ::= FLOW-SEQUENCE-START +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow sequence", context_mark, + "did not find expected ',' or ']'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_START_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + implicit: true, + style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), + } + skip_token(parser) + return true + } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + + *event = yaml_event_t{ + typ: yaml_SEQUENCE_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + + skip_token(parser) + return true +} + +// +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// *** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + mark := token.end_mark + skip_token(parser) + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// ***** * +// +func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token := peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Parse the productions: +// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * +// +func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { + token := peek_token(parser) + if token == nil { + return false + } + parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? + } + return true +} + +// Parse the productions: +// flow_mapping ::= FLOW-MAPPING-START +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * *** * +// +func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { + if first { + token := peek_token(parser) + parser.marks = append(parser.marks, token.start_mark) + skip_token(parser) + } + + token := peek_token(parser) + if token == nil { + return false + } + + if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + if !first { + if token.typ == yaml_FLOW_ENTRY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } else { + context_mark := parser.marks[len(parser.marks)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + return yaml_parser_set_parser_error_context(parser, + "while parsing a flow mapping", context_mark, + "did not find expected ',' or '}'", token.start_mark) + } + } + + if token.typ == yaml_KEY_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_VALUE_TOKEN && + token.typ != yaml_FLOW_ENTRY_TOKEN && + token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } else { + parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + + parser.state = parser.states[len(parser.states)-1] + parser.states = parser.states[:len(parser.states)-1] + parser.marks = parser.marks[:len(parser.marks)-1] + *event = yaml_event_t{ + typ: yaml_MAPPING_END_EVENT, + start_mark: token.start_mark, + end_mark: token.end_mark, + } + skip_token(parser) + return true +} + +// Parse the productions: +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// * ***** * +// +func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { + token := peek_token(parser) + if token == nil { + return false + } + if empty { + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) + } + if token.typ == yaml_VALUE_TOKEN { + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { + parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) + return yaml_parser_parse_node(parser, event, false, false) + } + } + parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE + return yaml_parser_process_empty_scalar(parser, event, token.start_mark) +} + +// Generate an empty scalar event. +func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { + *event = yaml_event_t{ + typ: yaml_SCALAR_EVENT, + start_mark: mark, + end_mark: mark, + value: nil, // Empty + implicit: true, + style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), + } + return true +} + +var default_tag_directives = []yaml_tag_directive_t{ + {[]byte("!"), []byte("!")}, + {[]byte("!!"), []byte("tag:yaml.org,2002:")}, +} + +// Parse directives. +func yaml_parser_process_directives(parser *yaml_parser_t, + version_directive_ref **yaml_version_directive_t, + tag_directives_ref *[]yaml_tag_directive_t) bool { + + var version_directive *yaml_version_directive_t + var tag_directives []yaml_tag_directive_t + + token := peek_token(parser) + if token == nil { + return false + } + + for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { + if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { + if version_directive != nil { + yaml_parser_set_parser_error(parser, + "found duplicate %YAML directive", token.start_mark) + return false + } + if token.major != 1 || token.minor != 1 { + yaml_parser_set_parser_error(parser, + "found incompatible YAML document", token.start_mark) + return false + } + version_directive = &yaml_version_directive_t{ + major: token.major, + minor: token.minor, + } + } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { + value := yaml_tag_directive_t{ + handle: token.value, + prefix: token.prefix, + } + if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { + return false + } + tag_directives = append(tag_directives, value) + } + + skip_token(parser) + token = peek_token(parser) + if token == nil { + return false + } + } + + for i := range default_tag_directives { + if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { + return false + } + } + + if version_directive_ref != nil { + *version_directive_ref = version_directive + } + if tag_directives_ref != nil { + *tag_directives_ref = tag_directives + } + return true +} + +// Append a tag directive to the directives stack. +func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { + for i := range parser.tag_directives { + if bytes.Equal(value.handle, parser.tag_directives[i].handle) { + if allow_duplicates { + return true + } + return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) + } + } + + // [Go] I suspect the copy is unnecessary. This was likely done + // because there was no way to track ownership of the data. + value_copy := yaml_tag_directive_t{ + handle: make([]byte, len(value.handle)), + prefix: make([]byte, len(value.prefix)), + } + copy(value_copy.handle, value.handle) + copy(value_copy.prefix, value.prefix) + parser.tag_directives = append(parser.tag_directives, value_copy) + return true +} diff --git a/vendor/github.com/sanathkr/go-yaml/readerc.go b/vendor/github.com/sanathkr/go-yaml/readerc.go new file mode 100644 index 000000000000..f450791717bf --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/readerc.go @@ -0,0 +1,394 @@ +package yaml + +import ( + "io" +) + +// Set the reader error and return 0. +func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { + parser.error = yaml_READER_ERROR + parser.problem = problem + parser.problem_offset = offset + parser.problem_value = value + return false +} + +// Byte order marks. +const ( + bom_UTF8 = "\xef\xbb\xbf" + bom_UTF16LE = "\xff\xfe" + bom_UTF16BE = "\xfe\xff" +) + +// Determine the input stream encoding by checking the BOM symbol. If no BOM is +// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. +func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { + // Ensure that we had enough bytes in the raw buffer. + for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { + if !yaml_parser_update_raw_buffer(parser) { + return false + } + } + + // Determine the encoding. + buf := parser.raw_buffer + pos := parser.raw_buffer_pos + avail := len(buf) - pos + if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { + parser.encoding = yaml_UTF16LE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { + parser.encoding = yaml_UTF16BE_ENCODING + parser.raw_buffer_pos += 2 + parser.offset += 2 + } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { + parser.encoding = yaml_UTF8_ENCODING + parser.raw_buffer_pos += 3 + parser.offset += 3 + } else { + parser.encoding = yaml_UTF8_ENCODING + } + return true +} + +// Update the raw buffer. +func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { + size_read := 0 + + // Return if the raw buffer is full. + if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { + return true + } + + // Return on EOF. + if parser.eof { + return true + } + + // Move the remaining bytes in the raw buffer to the beginning. + if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { + copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) + } + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] + parser.raw_buffer_pos = 0 + + // Call the read handler to fill the buffer. + size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) + parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] + if err == io.EOF { + parser.eof = true + } else if err != nil { + return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) + } + return true +} + +// Ensure that the buffer contains at least `length` characters. +// Return true on success, false on failure. +// +// The length is supposed to be significantly less that the buffer size. +func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { + if parser.read_handler == nil { + panic("read handler must be set") + } + + // If the EOF flag is set and the raw buffer is empty, do nothing. + if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { + return true + } + + // Return if the buffer contains enough characters. + if parser.unread >= length { + return true + } + + // Determine the input encoding if it is not known yet. + if parser.encoding == yaml_ANY_ENCODING { + if !yaml_parser_determine_encoding(parser) { + return false + } + } + + // Move the unread characters to the beginning of the buffer. + buffer_len := len(parser.buffer) + if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { + copy(parser.buffer, parser.buffer[parser.buffer_pos:]) + buffer_len -= parser.buffer_pos + parser.buffer_pos = 0 + } else if parser.buffer_pos == buffer_len { + buffer_len = 0 + parser.buffer_pos = 0 + } + + // Open the whole buffer for writing, and cut it before returning. + parser.buffer = parser.buffer[:cap(parser.buffer)] + + // Fill the buffer until it has enough characters. + first := true + for parser.unread < length { + + // Fill the raw buffer if necessary. + if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { + if !yaml_parser_update_raw_buffer(parser) { + parser.buffer = parser.buffer[:buffer_len] + return false + } + } + first = false + + // Decode the raw buffer. + inner: + for parser.raw_buffer_pos != len(parser.raw_buffer) { + var value rune + var width int + + raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos + + // Decode the next character. + switch parser.encoding { + case yaml_UTF8_ENCODING: + // Decode a UTF-8 character. Check RFC 3629 + // (http://www.ietf.org/rfc/rfc3629.txt) for more details. + // + // The following table (taken from the RFC) is used for + // decoding. + // + // Char. number range | UTF-8 octet sequence + // (hexadecimal) | (binary) + // --------------------+------------------------------------ + // 0000 0000-0000 007F | 0xxxxxxx + // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + // + // Additionally, the characters in the range 0xD800-0xDFFF + // are prohibited as they are reserved for use with UTF-16 + // surrogate pairs. + + // Determine the length of the UTF-8 sequence. + octet := parser.raw_buffer[parser.raw_buffer_pos] + switch { + case octet&0x80 == 0x00: + width = 1 + case octet&0xE0 == 0xC0: + width = 2 + case octet&0xF0 == 0xE0: + width = 3 + case octet&0xF8 == 0xF0: + width = 4 + default: + // The leading octet is invalid. + return yaml_parser_set_reader_error(parser, + "invalid leading UTF-8 octet", + parser.offset, int(octet)) + } + + // Check if the raw buffer contains an incomplete character. + if width > raw_unread { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-8 octet sequence", + parser.offset, -1) + } + break inner + } + + // Decode the leading octet. + switch { + case octet&0x80 == 0x00: + value = rune(octet & 0x7F) + case octet&0xE0 == 0xC0: + value = rune(octet & 0x1F) + case octet&0xF0 == 0xE0: + value = rune(octet & 0x0F) + case octet&0xF8 == 0xF0: + value = rune(octet & 0x07) + default: + value = 0 + } + + // Check and decode the trailing octets. + for k := 1; k < width; k++ { + octet = parser.raw_buffer[parser.raw_buffer_pos+k] + + // Check if the octet is valid. + if (octet & 0xC0) != 0x80 { + return yaml_parser_set_reader_error(parser, + "invalid trailing UTF-8 octet", + parser.offset+k, int(octet)) + } + + // Decode the octet. + value = (value << 6) + rune(octet&0x3F) + } + + // Check the length of the sequence against the value. + switch { + case width == 1: + case width == 2 && value >= 0x80: + case width == 3 && value >= 0x800: + case width == 4 && value >= 0x10000: + default: + return yaml_parser_set_reader_error(parser, + "invalid length of a UTF-8 sequence", + parser.offset, -1) + } + + // Check the range of the value. + if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { + return yaml_parser_set_reader_error(parser, + "invalid Unicode character", + parser.offset, int(value)) + } + + case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: + var low, high int + if parser.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + low, high = 1, 0 + } + + // The UTF-16 encoding is not as simple as one might + // naively think. Check RFC 2781 + // (http://www.ietf.org/rfc/rfc2781.txt). + // + // Normally, two subsequent bytes describe a Unicode + // character. However a special technique (called a + // surrogate pair) is used for specifying character + // values larger than 0xFFFF. + // + // A surrogate pair consists of two pseudo-characters: + // high surrogate area (0xD800-0xDBFF) + // low surrogate area (0xDC00-0xDFFF) + // + // The following formulas are used for decoding + // and encoding characters using surrogate pairs: + // + // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) + // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) + // W1 = 110110yyyyyyyyyy + // W2 = 110111xxxxxxxxxx + // + // where U is the character value, W1 is the high surrogate + // area, W2 is the low surrogate area. + + // Check for incomplete UTF-16 character. + if raw_unread < 2 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 character", + parser.offset, -1) + } + break inner + } + + // Get the character. + value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) + + // Check for unexpected low surrogate area. + if value&0xFC00 == 0xDC00 { + return yaml_parser_set_reader_error(parser, + "unexpected low surrogate area", + parser.offset, int(value)) + } + + // Check for a high surrogate area. + if value&0xFC00 == 0xD800 { + width = 4 + + // Check for incomplete surrogate pair. + if raw_unread < 4 { + if parser.eof { + return yaml_parser_set_reader_error(parser, + "incomplete UTF-16 surrogate pair", + parser.offset, -1) + } + break inner + } + + // Get the next character. + value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + + (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) + + // Check for a low surrogate area. + if value2&0xFC00 != 0xDC00 { + return yaml_parser_set_reader_error(parser, + "expected low surrogate area", + parser.offset+2, int(value2)) + } + + // Generate the value of the surrogate pair. + value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) + } else { + width = 2 + } + + default: + panic("impossible") + } + + // Check if the character is in the allowed range: + // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) + // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) + // | [#x10000-#x10FFFF] (32 bit) + switch { + case value == 0x09: + case value == 0x0A: + case value == 0x0D: + case value >= 0x20 && value <= 0x7E: + case value == 0x85: + case value >= 0xA0 && value <= 0xD7FF: + case value >= 0xE000 && value <= 0xFFFD: + case value >= 0x10000 && value <= 0x10FFFF: + default: + return yaml_parser_set_reader_error(parser, + "control characters are not allowed", + parser.offset, int(value)) + } + + // Move the raw pointers. + parser.raw_buffer_pos += width + parser.offset += width + + // Finally put the character into the buffer. + if value <= 0x7F { + // 0000 0000-0000 007F . 0xxxxxxx + parser.buffer[buffer_len+0] = byte(value) + buffer_len += 1 + } else if value <= 0x7FF { + // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) + parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) + buffer_len += 2 + } else if value <= 0xFFFF { + // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) + buffer_len += 3 + } else { + // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) + parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) + parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) + parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) + buffer_len += 4 + } + + parser.unread++ + } + + // On EOF, put NUL into the buffer and return. + if parser.eof { + parser.buffer[buffer_len] = 0 + buffer_len++ + parser.unread++ + break + } + } + parser.buffer = parser.buffer[:buffer_len] + return true +} diff --git a/vendor/github.com/sanathkr/go-yaml/resolve.go b/vendor/github.com/sanathkr/go-yaml/resolve.go new file mode 100644 index 000000000000..232313cc0845 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/resolve.go @@ -0,0 +1,208 @@ +package yaml + +import ( + "encoding/base64" + "math" + "regexp" + "strconv" + "strings" + "unicode/utf8" +) + +type resolveMapItem struct { + value interface{} + tag string +} + +var resolveTable = make([]byte, 256) +var resolveMap = make(map[string]resolveMapItem) + +func init() { + t := resolveTable + t[int('+')] = 'S' // Sign + t[int('-')] = 'S' + for _, c := range "0123456789" { + t[int(c)] = 'D' // Digit + } + for _, c := range "yYnNtTfFoO~" { + t[int(c)] = 'M' // In map + } + t[int('.')] = '.' // Float (potentially in map) + + var resolveMapList = []struct { + v interface{} + tag string + l []string + }{ + {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}}, + {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}}, + {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}}, + {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}}, + {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}}, + {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}}, + {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}}, + {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}}, + {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}}, + {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}}, + {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}}, + {"<<", yaml_MERGE_TAG, []string{"<<"}}, + } + + m := resolveMap + for _, item := range resolveMapList { + for _, s := range item.l { + m[s] = resolveMapItem{item.v, item.tag} + } + } +} + +const longTagPrefix = "tag:yaml.org,2002:" + +func shortTag(tag string) string { + // TODO This can easily be made faster and produce less garbage. + if strings.HasPrefix(tag, longTagPrefix) { + return "!!" + tag[len(longTagPrefix):] + } + return tag +} + +func longTag(tag string) string { + if strings.HasPrefix(tag, "!!") { + return longTagPrefix + tag[2:] + } + return tag +} + +func resolvableTag(tag string) bool { + switch tag { + case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG: + return true + } + return false +} + +var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`) + +func resolve(tag string, in string) (rtag string, out interface{}) { + if !resolvableTag(tag) { + return tag, in + } + + defer func() { + switch tag { + case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG: + return + } + failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) + }() + + // Any data is accepted as a !!str or !!binary. + // Otherwise, the prefix is enough of a hint about what it might be. + hint := byte('N') + if in != "" { + hint = resolveTable[in[0]] + } + if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG { + // Handle things we can lookup in a map. + if item, ok := resolveMap[in]; ok { + return item.tag, item.value + } + + // Base 60 floats are a bad idea, were dropped in YAML 1.2, and + // are purposefully unsupported here. They're still quoted on + // the way out for compatibility with other parser, though. + + switch hint { + case 'M': + // We've already checked the map above. + + case '.': + // Not in the map, so maybe a normal float. + floatv, err := strconv.ParseFloat(in, 64) + if err == nil { + return yaml_FLOAT_TAG, floatv + } + + case 'D', 'S': + // Int, float, or timestamp. + plain := strings.Replace(in, "_", "", -1) + intv, err := strconv.ParseInt(plain, 0, 64) + if err == nil { + if intv == int64(int(intv)) { + return yaml_INT_TAG, int(intv) + } else { + return yaml_INT_TAG, intv + } + } + uintv, err := strconv.ParseUint(plain, 0, 64) + if err == nil { + return yaml_INT_TAG, uintv + } + if yamlStyleFloat.MatchString(plain) { + floatv, err := strconv.ParseFloat(plain, 64) + if err == nil { + return yaml_FLOAT_TAG, floatv + } + } + if strings.HasPrefix(plain, "0b") { + intv, err := strconv.ParseInt(plain[2:], 2, 64) + if err == nil { + if intv == int64(int(intv)) { + return yaml_INT_TAG, int(intv) + } else { + return yaml_INT_TAG, intv + } + } + uintv, err := strconv.ParseUint(plain[2:], 2, 64) + if err == nil { + return yaml_INT_TAG, uintv + } + } else if strings.HasPrefix(plain, "-0b") { + intv, err := strconv.ParseInt(plain[3:], 2, 64) + if err == nil { + if intv == int64(int(intv)) { + return yaml_INT_TAG, -int(intv) + } else { + return yaml_INT_TAG, -intv + } + } + } + // XXX Handle timestamps here. + + default: + panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") + } + } + if tag == yaml_BINARY_TAG { + return yaml_BINARY_TAG, in + } + if utf8.ValidString(in) { + return yaml_STR_TAG, in + } + return yaml_BINARY_TAG, encodeBase64(in) +} + +// encodeBase64 encodes s as base64 that is broken up into multiple lines +// as appropriate for the resulting length. +func encodeBase64(s string) string { + const lineLen = 70 + encLen := base64.StdEncoding.EncodedLen(len(s)) + lines := encLen/lineLen + 1 + buf := make([]byte, encLen*2+lines) + in := buf[0:encLen] + out := buf[encLen:] + base64.StdEncoding.Encode(in, []byte(s)) + k := 0 + for i := 0; i < len(in); i += lineLen { + j := i + lineLen + if j > len(in) { + j = len(in) + } + k += copy(out[k:], in[i:j]) + if lines > 1 { + out[k] = '\n' + k++ + } + } + return string(out[:k]) +} diff --git a/vendor/github.com/sanathkr/go-yaml/scannerc.go b/vendor/github.com/sanathkr/go-yaml/scannerc.go new file mode 100644 index 000000000000..074484455827 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/scannerc.go @@ -0,0 +1,2711 @@ +package yaml + +import ( + "bytes" + "fmt" +) + +// Introduction +// ************ +// +// The following notes assume that you are familiar with the YAML specification +// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in +// some cases we are less restrictive that it requires. +// +// The process of transforming a YAML stream into a sequence of events is +// divided on two steps: Scanning and Parsing. +// +// The Scanner transforms the input stream into a sequence of tokens, while the +// parser transform the sequence of tokens produced by the Scanner into a +// sequence of parsing events. +// +// The Scanner is rather clever and complicated. The Parser, on the contrary, +// is a straightforward implementation of a recursive-descendant parser (or, +// LL(1) parser, as it is usually called). +// +// Actually there are two issues of Scanning that might be called "clever", the +// rest is quite straightforward. The issues are "block collection start" and +// "simple keys". Both issues are explained below in details. +// +// Here the Scanning step is explained and implemented. We start with the list +// of all the tokens produced by the Scanner together with short descriptions. +// +// Now, tokens: +// +// STREAM-START(encoding) # The stream start. +// STREAM-END # The stream end. +// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. +// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. +// DOCUMENT-START # '---' +// DOCUMENT-END # '...' +// BLOCK-SEQUENCE-START # Indentation increase denoting a block +// BLOCK-MAPPING-START # sequence or a block mapping. +// BLOCK-END # Indentation decrease. +// FLOW-SEQUENCE-START # '[' +// FLOW-SEQUENCE-END # ']' +// BLOCK-SEQUENCE-START # '{' +// BLOCK-SEQUENCE-END # '}' +// BLOCK-ENTRY # '-' +// FLOW-ENTRY # ',' +// KEY # '?' or nothing (simple keys). +// VALUE # ':' +// ALIAS(anchor) # '*anchor' +// ANCHOR(anchor) # '&anchor' +// TAG(handle,suffix) # '!handle!suffix' +// SCALAR(value,style) # A scalar. +// +// The following two tokens are "virtual" tokens denoting the beginning and the +// end of the stream: +// +// STREAM-START(encoding) +// STREAM-END +// +// We pass the information about the input stream encoding with the +// STREAM-START token. +// +// The next two tokens are responsible for tags: +// +// VERSION-DIRECTIVE(major,minor) +// TAG-DIRECTIVE(handle,prefix) +// +// Example: +// +// %YAML 1.1 +// %TAG ! !foo +// %TAG !yaml! tag:yaml.org,2002: +// --- +// +// The correspoding sequence of tokens: +// +// STREAM-START(utf-8) +// VERSION-DIRECTIVE(1,1) +// TAG-DIRECTIVE("!","!foo") +// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") +// DOCUMENT-START +// STREAM-END +// +// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole +// line. +// +// The document start and end indicators are represented by: +// +// DOCUMENT-START +// DOCUMENT-END +// +// Note that if a YAML stream contains an implicit document (without '---' +// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be +// produced. +// +// In the following examples, we present whole documents together with the +// produced tokens. +// +// 1. An implicit document: +// +// 'a scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// STREAM-END +// +// 2. An explicit document: +// +// --- +// 'a scalar' +// ... +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// SCALAR("a scalar",single-quoted) +// DOCUMENT-END +// STREAM-END +// +// 3. Several documents in a stream: +// +// 'a scalar' +// --- +// 'another scalar' +// --- +// 'yet another scalar' +// +// Tokens: +// +// STREAM-START(utf-8) +// SCALAR("a scalar",single-quoted) +// DOCUMENT-START +// SCALAR("another scalar",single-quoted) +// DOCUMENT-START +// SCALAR("yet another scalar",single-quoted) +// STREAM-END +// +// We have already introduced the SCALAR token above. The following tokens are +// used to describe aliases, anchors, tag, and scalars: +// +// ALIAS(anchor) +// ANCHOR(anchor) +// TAG(handle,suffix) +// SCALAR(value,style) +// +// The following series of examples illustrate the usage of these tokens: +// +// 1. A recursive sequence: +// +// &A [ *A ] +// +// Tokens: +// +// STREAM-START(utf-8) +// ANCHOR("A") +// FLOW-SEQUENCE-START +// ALIAS("A") +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A tagged scalar: +// +// !!float "3.14" # A good approximation. +// +// Tokens: +// +// STREAM-START(utf-8) +// TAG("!!","float") +// SCALAR("3.14",double-quoted) +// STREAM-END +// +// 3. Various scalar styles: +// +// --- # Implicit empty plain scalars do not produce tokens. +// --- a plain scalar +// --- 'a single-quoted scalar' +// --- "a double-quoted scalar" +// --- |- +// a literal scalar +// --- >- +// a folded +// scalar +// +// Tokens: +// +// STREAM-START(utf-8) +// DOCUMENT-START +// DOCUMENT-START +// SCALAR("a plain scalar",plain) +// DOCUMENT-START +// SCALAR("a single-quoted scalar",single-quoted) +// DOCUMENT-START +// SCALAR("a double-quoted scalar",double-quoted) +// DOCUMENT-START +// SCALAR("a literal scalar",literal) +// DOCUMENT-START +// SCALAR("a folded scalar",folded) +// STREAM-END +// +// Now it's time to review collection-related tokens. We will start with +// flow collections: +// +// FLOW-SEQUENCE-START +// FLOW-SEQUENCE-END +// FLOW-MAPPING-START +// FLOW-MAPPING-END +// FLOW-ENTRY +// KEY +// VALUE +// +// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and +// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' +// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the +// indicators '?' and ':', which are used for denoting mapping keys and values, +// are represented by the KEY and VALUE tokens. +// +// The following examples show flow collections: +// +// 1. A flow sequence: +// +// [item 1, item 2, item 3] +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-SEQUENCE-START +// SCALAR("item 1",plain) +// FLOW-ENTRY +// SCALAR("item 2",plain) +// FLOW-ENTRY +// SCALAR("item 3",plain) +// FLOW-SEQUENCE-END +// STREAM-END +// +// 2. A flow mapping: +// +// { +// a simple key: a value, # Note that the KEY token is produced. +// ? a complex key: another value, +// } +// +// Tokens: +// +// STREAM-START(utf-8) +// FLOW-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// FLOW-ENTRY +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// FLOW-ENTRY +// FLOW-MAPPING-END +// STREAM-END +// +// A simple key is a key which is not denoted by the '?' indicator. Note that +// the Scanner still produce the KEY token whenever it encounters a simple key. +// +// For scanning block collections, the following tokens are used (note that we +// repeat KEY and VALUE here): +// +// BLOCK-SEQUENCE-START +// BLOCK-MAPPING-START +// BLOCK-END +// BLOCK-ENTRY +// KEY +// VALUE +// +// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation +// increase that precedes a block collection (cf. the INDENT token in Python). +// The token BLOCK-END denote indentation decrease that ends a block collection +// (cf. the DEDENT token in Python). However YAML has some syntax pecularities +// that makes detections of these tokens more complex. +// +// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators +// '-', '?', and ':' correspondingly. +// +// The following examples show how the tokens BLOCK-SEQUENCE-START, +// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: +// +// 1. Block sequences: +// +// - item 1 +// - item 2 +// - +// - item 3.1 +// - item 3.2 +// - +// key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 3.1",plain) +// BLOCK-ENTRY +// SCALAR("item 3.2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Block mappings: +// +// a simple key: a value # The KEY token is produced here. +// ? a complex key +// : another value +// a mapping: +// key 1: value 1 +// key 2: value 2 +// a sequence: +// - item 1 +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a simple key",plain) +// VALUE +// SCALAR("a value",plain) +// KEY +// SCALAR("a complex key",plain) +// VALUE +// SCALAR("another value",plain) +// KEY +// SCALAR("a mapping",plain) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML does not always require to start a new block collection from a new +// line. If the current line contains only '-', '?', and ':' indicators, a new +// block collection may start at the current line. The following examples +// illustrate this case: +// +// 1. Collections in a sequence: +// +// - - item 1 +// - item 2 +// - key 1: value 1 +// key 2: value 2 +// - ? complex key +// : complex value +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-ENTRY +// BLOCK-MAPPING-START +// KEY +// SCALAR("complex key") +// VALUE +// SCALAR("complex value") +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// 2. Collections in a mapping: +// +// ? a sequence +// : - item 1 +// - item 2 +// ? a mapping +// : key 1: value 1 +// key 2: value 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("a sequence",plain) +// VALUE +// BLOCK-SEQUENCE-START +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// KEY +// SCALAR("a mapping",plain) +// VALUE +// BLOCK-MAPPING-START +// KEY +// SCALAR("key 1",plain) +// VALUE +// SCALAR("value 1",plain) +// KEY +// SCALAR("key 2",plain) +// VALUE +// SCALAR("value 2",plain) +// BLOCK-END +// BLOCK-END +// STREAM-END +// +// YAML also permits non-indented sequences if they are included into a block +// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: +// +// key: +// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. +// - item 2 +// +// Tokens: +// +// STREAM-START(utf-8) +// BLOCK-MAPPING-START +// KEY +// SCALAR("key",plain) +// VALUE +// BLOCK-ENTRY +// SCALAR("item 1",plain) +// BLOCK-ENTRY +// SCALAR("item 2",plain) +// BLOCK-END +// + +// Ensure that the buffer contains the required number of characters. +// Return true on success, false on failure (reader error or memory error). +func cache(parser *yaml_parser_t, length int) bool { + // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) + return parser.unread >= length || yaml_parser_update_buffer(parser, length) +} + +// Advance the buffer pointer. +func skip(parser *yaml_parser_t) { + parser.mark.index++ + parser.mark.column++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) +} + +func skip_line(parser *yaml_parser_t) { + if is_crlf(parser.buffer, parser.buffer_pos) { + parser.mark.index += 2 + parser.mark.column = 0 + parser.mark.line++ + parser.unread -= 2 + parser.buffer_pos += 2 + } else if is_break(parser.buffer, parser.buffer_pos) { + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) + } +} + +// Copy a character to a string buffer and advance pointers. +func read(parser *yaml_parser_t, s []byte) []byte { + w := width(parser.buffer[parser.buffer_pos]) + if w == 0 { + panic("invalid character sequence") + } + if len(s) == 0 { + s = make([]byte, 0, 32) + } + if w == 1 && len(s)+w <= cap(s) { + s = s[:len(s)+1] + s[len(s)-1] = parser.buffer[parser.buffer_pos] + parser.buffer_pos++ + } else { + s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) + parser.buffer_pos += w + } + parser.mark.index++ + parser.mark.column++ + parser.unread-- + return s +} + +// Copy a line break character to a string buffer and advance pointers. +func read_line(parser *yaml_parser_t, s []byte) []byte { + buf := parser.buffer + pos := parser.buffer_pos + switch { + case buf[pos] == '\r' && buf[pos+1] == '\n': + // CR LF . LF + s = append(s, '\n') + parser.buffer_pos += 2 + parser.mark.index++ + parser.unread-- + case buf[pos] == '\r' || buf[pos] == '\n': + // CR|LF . LF + s = append(s, '\n') + parser.buffer_pos += 1 + case buf[pos] == '\xC2' && buf[pos+1] == '\x85': + // NEL . LF + s = append(s, '\n') + parser.buffer_pos += 2 + case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): + // LS|PS . LS|PS + s = append(s, buf[parser.buffer_pos:pos+3]...) + parser.buffer_pos += 3 + default: + return s + } + parser.mark.index++ + parser.mark.column = 0 + parser.mark.line++ + parser.unread-- + return s +} + +// Get the next token. +func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { + // Erase the token object. + *token = yaml_token_t{} // [Go] Is this necessary? + + // No tokens after STREAM-END or error. + if parser.stream_end_produced || parser.error != yaml_NO_ERROR { + return true + } + + // Ensure that the tokens queue contains enough tokens. + if !parser.token_available { + if !yaml_parser_fetch_more_tokens(parser) { + return false + } + } + + // Fetch the next token from the queue. + *token = parser.tokens[parser.tokens_head] + parser.tokens_head++ + parser.tokens_parsed++ + parser.token_available = false + + if token.typ == yaml_STREAM_END_TOKEN { + parser.stream_end_produced = true + } + return true +} + +// Set the scanner error and return false. +func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { + parser.error = yaml_SCANNER_ERROR + parser.context = context + parser.context_mark = context_mark + parser.problem = problem + parser.problem_mark = parser.mark + return false +} + +func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { + context := "while parsing a tag" + if directive { + context = "while parsing a %TAG directive" + } + return yaml_parser_set_scanner_error(parser, context, context_mark, problem) +} + +func trace(args ...interface{}) func() { + pargs := append([]interface{}{"+++"}, args...) + fmt.Println(pargs...) + pargs = append([]interface{}{"---"}, args...) + return func() { fmt.Println(pargs...) } +} + +// Ensure that the tokens queue contains at least one token which can be +// returned to the Parser. +func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { + // While we need more tokens to fetch, do it. + for { + // Check if we really need to fetch more tokens. + need_more_tokens := false + + if parser.tokens_head == len(parser.tokens) { + // Queue is empty. + need_more_tokens = true + } else { + // Check if any potential simple key may occupy the head position. + if !yaml_parser_stale_simple_keys(parser) { + return false + } + + for i := range parser.simple_keys { + simple_key := &parser.simple_keys[i] + if simple_key.possible && simple_key.token_number == parser.tokens_parsed { + need_more_tokens = true + break + } + } + } + + // We are finished. + if !need_more_tokens { + break + } + // Fetch the next token. + if !yaml_parser_fetch_next_token(parser) { + return false + } + } + + parser.token_available = true + return true +} + +// The dispatcher for token fetchers. +func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { + // Ensure that the buffer is initialized. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check if we just started scanning. Fetch STREAM-START then. + if !parser.stream_start_produced { + return yaml_parser_fetch_stream_start(parser) + } + + // Eat whitespaces and comments until we reach the next token. + if !yaml_parser_scan_to_next_token(parser) { + return false + } + + // Remove obsolete potential simple keys. + if !yaml_parser_stale_simple_keys(parser) { + return false + } + + // Check the indentation level against the current column. + if !yaml_parser_unroll_indent(parser, parser.mark.column) { + return false + } + + // Ensure that the buffer contains at least 4 characters. 4 is the length + // of the longest indicators ('--- ' and '... '). + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + // Is it the end of the stream? + if is_z(parser.buffer, parser.buffer_pos) { + return yaml_parser_fetch_stream_end(parser) + } + + // Is it a directive? + if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { + return yaml_parser_fetch_directive(parser) + } + + buf := parser.buffer + pos := parser.buffer_pos + + // Is it the document start indicator? + if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) + } + + // Is it the document end indicator? + if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { + return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) + } + + // Is it the flow sequence start indicator? + if buf[pos] == '[' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) + } + + // Is it the flow mapping start indicator? + if parser.buffer[parser.buffer_pos] == '{' { + return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) + } + + // Is it the flow sequence end indicator? + if parser.buffer[parser.buffer_pos] == ']' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_SEQUENCE_END_TOKEN) + } + + // Is it the flow mapping end indicator? + if parser.buffer[parser.buffer_pos] == '}' { + return yaml_parser_fetch_flow_collection_end(parser, + yaml_FLOW_MAPPING_END_TOKEN) + } + + // Is it the flow entry indicator? + if parser.buffer[parser.buffer_pos] == ',' { + return yaml_parser_fetch_flow_entry(parser) + } + + // Is it the block entry indicator? + if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { + return yaml_parser_fetch_block_entry(parser) + } + + // Is it the key indicator? + if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_key(parser) + } + + // Is it the value indicator? + if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_value(parser) + } + + // Is it an alias? + if parser.buffer[parser.buffer_pos] == '*' { + return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) + } + + // Is it an anchor? + if parser.buffer[parser.buffer_pos] == '&' { + return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) + } + + // Is it a tag? + if parser.buffer[parser.buffer_pos] == '!' { + return yaml_parser_fetch_tag(parser) + } + + // Is it a literal scalar? + if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, true) + } + + // Is it a folded scalar? + if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { + return yaml_parser_fetch_block_scalar(parser, false) + } + + // Is it a single-quoted scalar? + if parser.buffer[parser.buffer_pos] == '\'' { + return yaml_parser_fetch_flow_scalar(parser, true) + } + + // Is it a double-quoted scalar? + if parser.buffer[parser.buffer_pos] == '"' { + return yaml_parser_fetch_flow_scalar(parser, false) + } + + // Is it a plain scalar? + // + // A plain scalar may start with any non-blank characters except + // + // '-', '?', ':', ',', '[', ']', '{', '}', + // '#', '&', '*', '!', '|', '>', '\'', '\"', + // '%', '@', '`'. + // + // In the block context (and, for the '-' indicator, in the flow context + // too), it may also start with the characters + // + // '-', '?', ':' + // + // if it is followed by a non-space character. + // + // The last rule is more restrictive than the specification requires. + // [Go] Make this logic more reasonable. + //switch parser.buffer[parser.buffer_pos] { + //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': + //} + if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || + parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || + parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || + (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level == 0 && + (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && + !is_blankz(parser.buffer, parser.buffer_pos+1)) { + return yaml_parser_fetch_plain_scalar(parser) + } + + // If we don't determine the token type so far, it is an error. + return yaml_parser_set_scanner_error(parser, + "while scanning for the next token", parser.mark, + "found character that cannot start any token") +} + +// Check the list of potential simple keys and remove the positions that +// cannot contain simple keys anymore. +func yaml_parser_stale_simple_keys(parser *yaml_parser_t) bool { + // Check for a potential simple key for each flow level. + for i := range parser.simple_keys { + simple_key := &parser.simple_keys[i] + + // The specification requires that a simple key + // + // - is limited to a single line, + // - is shorter than 1024 characters. + if simple_key.possible && (simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index) { + + // Check if the potential simple key to be removed is required. + if simple_key.required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") + } + simple_key.possible = false + } + } + return true +} + +// Check if a simple key may start at the current position and add it if +// needed. +func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { + // A simple key is required at the current position if the scanner is in + // the block context and the current column coincides with the indentation + // level. + + required := parser.flow_level == 0 && parser.indent == parser.mark.column + + // A simple key is required only when it is the first token in the current + // line. Therefore it is always allowed. But we add a check anyway. + if required && !parser.simple_key_allowed { + panic("should not happen") + } + + // + // If the current position may start a simple key, save it. + // + if parser.simple_key_allowed { + simple_key := yaml_simple_key_t{ + possible: true, + required: required, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + } + simple_key.mark = parser.mark + + if !yaml_parser_remove_simple_key(parser) { + return false + } + parser.simple_keys[len(parser.simple_keys)-1] = simple_key + } + return true +} + +// Remove a potential simple key at the current flow level. +func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { + i := len(parser.simple_keys) - 1 + if parser.simple_keys[i].possible { + // If the key is required, it is an error. + if parser.simple_keys[i].required { + return yaml_parser_set_scanner_error(parser, + "while scanning a simple key", parser.simple_keys[i].mark, + "could not find expected ':'") + } + } + // Remove the key from the stack. + parser.simple_keys[i].possible = false + return true +} + +// Increase the flow level and resize the simple key list if needed. +func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { + // Reset the simple key on the next level. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + // Increase the flow level. + parser.flow_level++ + return true +} + +// Decrease the flow level. +func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { + if parser.flow_level > 0 { + parser.flow_level-- + parser.simple_keys = parser.simple_keys[:len(parser.simple_keys)-1] + } + return true +} + +// Push the current indentation level to the stack and set the new level +// the current column is greater than the indentation level. In this case, +// append or insert the specified token into the token queue. +func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + if parser.indent < column { + // Push the current indentation level to the stack and set the new + // indentation level. + parser.indents = append(parser.indents, parser.indent) + parser.indent = column + + // Create a token and insert it into the queue. + token := yaml_token_t{ + typ: typ, + start_mark: mark, + end_mark: mark, + } + if number > -1 { + number -= parser.tokens_parsed + } + yaml_insert_token(parser, number, &token) + } + return true +} + +// Pop indentation levels from the indents stack until the current level +// becomes less or equal to the column. For each indentation level, append +// the BLOCK-END token. +func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { + // In the flow context, do nothing. + if parser.flow_level > 0 { + return true + } + + // Loop through the indentation levels in the stack. + for parser.indent > column { + // Create a token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + + // Pop the indentation level. + parser.indent = parser.indents[len(parser.indents)-1] + parser.indents = parser.indents[:len(parser.indents)-1] + } + return true +} + +// Initialize the scanner and produce the STREAM-START token. +func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { + + // Set the initial indentation. + parser.indent = -1 + + // Initialize the simple key stack. + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + + // A simple key is allowed at the beginning of the stream. + parser.simple_key_allowed = true + + // We have started. + parser.stream_start_produced = true + + // Create the STREAM-START token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_START_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + encoding: parser.encoding, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the STREAM-END token and shut down the scanner. +func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { + + // Force new line. + if parser.mark.column != 0 { + parser.mark.column = 0 + parser.mark.line++ + } + + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the STREAM-END token and append it to the queue. + token := yaml_token_t{ + typ: yaml_STREAM_END_TOKEN, + start_mark: parser.mark, + end_mark: parser.mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. +func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. + token := yaml_token_t{} + if !yaml_parser_scan_directive(parser, &token) { + return false + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the DOCUMENT-START or DOCUMENT-END token. +func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset the indentation level. + if !yaml_parser_unroll_indent(parser, -1) { + return false + } + + // Reset simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + parser.simple_key_allowed = false + + // Consume the token. + start_mark := parser.mark + + skip(parser) + skip(parser) + skip(parser) + + end_mark := parser.mark + + // Create the DOCUMENT-START or DOCUMENT-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. +func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // The indicators '[' and '{' may start a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // Increase the flow level. + if !yaml_parser_increase_flow_level(parser) { + return false + } + + // A simple key may follow the indicators '[' and '{'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. +func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // Reset any potential simple key on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Decrease the flow level. + if !yaml_parser_decrease_flow_level(parser) { + return false + } + + // No simple keys after the indicators ']' and '}'. + parser.simple_key_allowed = false + + // Consume the token. + + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. + token := yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + } + // Append the token to the queue. + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the FLOW-ENTRY token. +func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after ','. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the FLOW-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_FLOW_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the BLOCK-ENTRY token. +func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { + // Check if the scanner is in the block context. + if parser.flow_level == 0 { + // Check if we are allowed to start a new entry. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "block sequence entries are not allowed in this context") + } + // Add the BLOCK-SEQUENCE-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { + return false + } + } else { + // It is an error for the '-' indicator to occur in the flow context, + // but we let the Parser detect and report about it because the Parser + // is able to point to the context. + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '-'. + parser.simple_key_allowed = true + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the BLOCK-ENTRY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_BLOCK_ENTRY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the KEY token. +func yaml_parser_fetch_key(parser *yaml_parser_t) bool { + + // In the block context, additional checks are required. + if parser.flow_level == 0 { + // Check if we are allowed to start a new key (not nessesary simple). + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping keys are not allowed in this context") + } + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Reset any potential simple keys on the current flow level. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // Simple keys are allowed after '?' in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the KEY token and append it to the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the VALUE token. +func yaml_parser_fetch_value(parser *yaml_parser_t) bool { + + simple_key := &parser.simple_keys[len(parser.simple_keys)-1] + + // Have we found a simple key? + if simple_key.possible { + // Create the KEY token and insert it into the queue. + token := yaml_token_t{ + typ: yaml_KEY_TOKEN, + start_mark: simple_key.mark, + end_mark: simple_key.mark, + } + yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) + + // In the block context, we may need to add the BLOCK-MAPPING-START token. + if !yaml_parser_roll_indent(parser, simple_key.mark.column, + simple_key.token_number, + yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { + return false + } + + // Remove the simple key. + simple_key.possible = false + + // A simple key cannot follow another simple key. + parser.simple_key_allowed = false + + } else { + // The ':' indicator follows a complex key. + + // In the block context, extra checks are required. + if parser.flow_level == 0 { + + // Check if we are allowed to start a complex value. + if !parser.simple_key_allowed { + return yaml_parser_set_scanner_error(parser, "", parser.mark, + "mapping values are not allowed in this context") + } + + // Add the BLOCK-MAPPING-START token if needed. + if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { + return false + } + } + + // Simple keys after ':' are allowed in the block context. + parser.simple_key_allowed = parser.flow_level == 0 + } + + // Consume the token. + start_mark := parser.mark + skip(parser) + end_mark := parser.mark + + // Create the VALUE token and append it to the queue. + token := yaml_token_t{ + typ: yaml_VALUE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the ALIAS or ANCHOR token. +func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { + // An anchor or an alias could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow an anchor or an alias. + parser.simple_key_allowed = false + + // Create the ALIAS or ANCHOR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_anchor(parser, &token, typ) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the TAG token. +func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { + // A tag could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a tag. + parser.simple_key_allowed = false + + // Create the TAG token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_tag(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. +func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { + // Remove any potential simple keys. + if !yaml_parser_remove_simple_key(parser) { + return false + } + + // A simple key may follow a block scalar. + parser.simple_key_allowed = true + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_block_scalar(parser, &token, literal) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. +func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_flow_scalar(parser, &token, single) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Produce the SCALAR(...,plain) token. +func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { + // A plain scalar could be a simple key. + if !yaml_parser_save_simple_key(parser) { + return false + } + + // A simple key cannot follow a flow scalar. + parser.simple_key_allowed = false + + // Create the SCALAR token and append it to the queue. + var token yaml_token_t + if !yaml_parser_scan_plain_scalar(parser, &token) { + return false + } + yaml_insert_token(parser, -1, &token) + return true +} + +// Eat whitespaces and comments until the next token is found. +func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { + + // Until the next token is not found. + for { + // Allow the BOM mark to start a line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { + skip(parser) + } + + // Eat whitespaces. + // Tabs are allowed: + // - in the flow context + // - in the block context, but not at the beginning of the line or + // after '-', '?', or ':' (complex value). + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Eat a comment until a line break. + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // If it is a line break, eat it. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + + // In the block context, a new line may start a simple key. + if parser.flow_level == 0 { + parser.simple_key_allowed = true + } + } else { + break // We have found a token. + } + } + + return true +} + +// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { + // Eat '%'. + start_mark := parser.mark + skip(parser) + + // Scan the directive name. + var name []byte + if !yaml_parser_scan_directive_name(parser, start_mark, &name) { + return false + } + + // Is it a YAML directive? + if bytes.Equal(name, []byte("YAML")) { + // Scan the VERSION directive value. + var major, minor int8 + if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { + return false + } + end_mark := parser.mark + + // Create a VERSION-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_VERSION_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + major: major, + minor: minor, + } + + // Is it a TAG directive? + } else if bytes.Equal(name, []byte("TAG")) { + // Scan the TAG directive value. + var handle, prefix []byte + if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { + return false + } + end_mark := parser.mark + + // Create a TAG-DIRECTIVE token. + *token = yaml_token_t{ + typ: yaml_TAG_DIRECTIVE_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + prefix: prefix, + } + + // Unknown directive. + } else { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unknown directive name") + return false + } + + // Eat the rest of the line including any comments. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + return true +} + +// Scan the directive name. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ +// +func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { + // Consume the directive name. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + var s []byte + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the name is empty. + if len(s) == 0 { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "could not find expected directive name") + return false + } + + // Check for an blank character after the name. + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a directive", + start_mark, "found unexpected non-alphabetical character") + return false + } + *name = s + return true +} + +// Scan the value of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^^^^^^ +func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the major version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { + return false + } + + // Eat '.'. + if parser.buffer[parser.buffer_pos] != '.' { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected digit or '.' character") + } + + skip(parser) + + // Consume the minor version number. + if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { + return false + } + return true +} + +const max_number_length = 2 + +// Scan the version number of VERSION-DIRECTIVE. +// +// Scope: +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ +func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { + + // Repeat while the next character is digit. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var value, length int8 + for is_digit(parser.buffer, parser.buffer_pos) { + // Check if the number is too long. + length++ + if length > max_number_length { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "found extremely long version number") + } + value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the number was present. + if length == 0 { + return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", + start_mark, "did not find expected version number") + } + *number = value + return true +} + +// Scan the value of a TAG-DIRECTIVE token. +// +// Scope: +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// +func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { + var handle_value, prefix_value []byte + + // Eat whitespaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a handle. + if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { + return false + } + + // Expect a whitespace. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blank(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace") + return false + } + + // Eat whitespaces. + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Scan a prefix. + if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { + return false + } + + // Expect a whitespace or line break. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", + start_mark, "did not find expected whitespace or line break") + return false + } + + *handle = handle_value + *prefix = prefix_value + return true +} + +func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { + var s []byte + + // Eat the indicator character. + start_mark := parser.mark + skip(parser) + + // Consume the value. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + end_mark := parser.mark + + /* + * Check if length of the anchor is greater than 0 and it is followed by + * a whitespace character or one of the indicators: + * + * '?', ':', ',', ']', '}', '%', '@', '`'. + */ + + if len(s) == 0 || + !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || + parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '`') { + context := "while scanning an alias" + if typ == yaml_ANCHOR_TOKEN { + context = "while scanning an anchor" + } + yaml_parser_set_scanner_error(parser, context, start_mark, + "did not find expected alphabetic or numeric character") + return false + } + + // Create a token. + *token = yaml_token_t{ + typ: typ, + start_mark: start_mark, + end_mark: end_mark, + value: s, + } + + return true +} + +/* + * Scan a TAG token. + */ + +func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { + var handle, suffix []byte + + start_mark := parser.mark + + // Check if the tag is in the canonical form. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + if parser.buffer[parser.buffer_pos+1] == '<' { + // Keep the handle as '' + + // Eat '!<' + skip(parser) + skip(parser) + + // Consume the tag value. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + + // Check for '>' and eat it. + if parser.buffer[parser.buffer_pos] != '>' { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find the expected '>'") + return false + } + + skip(parser) + } else { + // The tag has either the '!suffix' or the '!handle!suffix' form. + + // First, try to scan a handle. + if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { + return false + } + + // Check if it is, indeed, handle. + if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { + // Scan the suffix now. + if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { + return false + } + } else { + // It wasn't a handle after all. Scan the rest of the tag. + if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { + return false + } + + // Set the handle to '!'. + handle = []byte{'!'} + + // A special case: the '!' tag. Set the handle to '' and the + // suffix to '!'. + if len(suffix) == 0 { + handle, suffix = suffix, handle + } + } + } + + // Check the character which ends the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if !is_blankz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a tag", + start_mark, "did not find expected whitespace or line break") + return false + } + + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_TAG_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: handle, + suffix: suffix, + } + return true +} + +// Scan a tag handle. +func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { + // Check the initial '!' character. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] != '!' { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + + var s []byte + + // Copy the '!' character. + s = read(parser, s) + + // Copy all subsequent alphabetical and numerical characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_alpha(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check if the trailing character is '!' and copy it. + if parser.buffer[parser.buffer_pos] == '!' { + s = read(parser, s) + } else { + // It's either the '!' tag or not really a tag handle. If it's a %TAG + // directive, it's an error. If it's a tag token, it must be a part of URI. + if directive && string(s) != "!" { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected '!'") + return false + } + } + + *handle = s + return true +} + +// Scan a tag. +func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { + //size_t length = head ? strlen((char *)head) : 0 + var s []byte + hasTag := len(head) > 0 + + // Copy the head if needed. + // + // Note that we don't copy the leading '!' character. + if len(head) > 1 { + s = append(s, head[1:]...) + } + + // Scan the tag. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // The set of characters that may appear in URI is as follows: + // + // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', + // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', + // '%'. + // [Go] Convert this into more reasonable logic. + for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || + parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || + parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || + parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || + parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || + parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || + parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || + parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || + parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || + parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || + parser.buffer[parser.buffer_pos] == '%' { + // Check if it is a URI-escape sequence. + if parser.buffer[parser.buffer_pos] == '%' { + if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { + return false + } + } else { + s = read(parser, s) + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + hasTag = true + } + + if !hasTag { + yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find expected tag URI") + return false + } + *uri = s + return true +} + +// Decode an URI-escape sequence corresponding to a single UTF-8 character. +func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { + + // Decode the required number of characters. + w := 1024 + for w > 0 { + // Check for a URI-escaped octet. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + + if !(parser.buffer[parser.buffer_pos] == '%' && + is_hex(parser.buffer, parser.buffer_pos+1) && + is_hex(parser.buffer, parser.buffer_pos+2)) { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "did not find URI escaped octet") + } + + // Get the octet. + octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) + + // If it is the leading octet, determine the length of the UTF-8 sequence. + if w == 1024 { + w = width(octet) + if w == 0 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect leading UTF-8 octet") + } + } else { + // Check if the trailing octet is correct. + if octet&0xC0 != 0x80 { + return yaml_parser_set_scanner_tag_error(parser, directive, + start_mark, "found an incorrect trailing UTF-8 octet") + } + } + + // Copy the octet and move the pointers. + *s = append(*s, octet) + skip(parser) + skip(parser) + skip(parser) + w-- + } + return true +} + +// Scan a block scalar. +func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { + // Eat the indicator '|' or '>'. + start_mark := parser.mark + skip(parser) + + // Scan the additional block scalar indicators. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + // Check for a chomping indicator. + var chomping, increment int + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + // Set the chomping method and eat the indicator. + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + + // Check for an indentation indicator. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if is_digit(parser.buffer, parser.buffer_pos) { + // Check that the indentation is greater than 0. + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + + // Get the indentation level and eat the indicator. + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + } + + } else if is_digit(parser.buffer, parser.buffer_pos) { + // Do the same as above, but in the opposite order. + + if parser.buffer[parser.buffer_pos] == '0' { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found an indentation indicator equal to 0") + return false + } + increment = as_digit(parser.buffer, parser.buffer_pos) + skip(parser) + + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { + if parser.buffer[parser.buffer_pos] == '+' { + chomping = +1 + } else { + chomping = -1 + } + skip(parser) + } + } + + // Eat whitespaces and comments to the end of the line. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for is_blank(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.buffer[parser.buffer_pos] == '#' { + for !is_breakz(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + } + + // Check if we are at the end of the line. + if !is_breakz(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "did not find expected comment or line break") + return false + } + + // Eat a line break. + if is_break(parser.buffer, parser.buffer_pos) { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + skip_line(parser) + } + + end_mark := parser.mark + + // Set the indentation level if it was specified. + var indent int + if increment > 0 { + if parser.indent >= 0 { + indent = parser.indent + increment + } else { + indent = increment + } + } + + // Scan the leading line breaks and determine the indentation level if needed. + var s, leading_break, trailing_breaks []byte + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + + // Scan the block scalar content. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + var leading_blank, trailing_blank bool + for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { + // We are at the beginning of a non-empty line. + + // Is it a trailing whitespace? + trailing_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Check if we need to fold the leading line break. + if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { + // Do we need to join the lines by space? + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } + } else { + s = append(s, leading_break...) + } + leading_break = leading_break[:0] + + // Append the remaining line breaks. + s = append(s, trailing_breaks...) + trailing_breaks = trailing_breaks[:0] + + // Is it a leading whitespace? + leading_blank = is_blank(parser.buffer, parser.buffer_pos) + + // Consume the current line. + for !is_breakz(parser.buffer, parser.buffer_pos) { + s = read(parser, s) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + leading_break = read_line(parser, leading_break) + + // Eat the following indentation spaces and line breaks. + if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { + return false + } + } + + // Chomp the tail. + if chomping != -1 { + s = append(s, leading_break...) + } + if chomping == 1 { + s = append(s, trailing_breaks...) + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_LITERAL_SCALAR_STYLE, + } + if !literal { + token.style = yaml_FOLDED_SCALAR_STYLE + } + return true +} + +// Scan indentation spaces and line breaks for a block scalar. Determine the +// indentation level if needed. +func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { + *end_mark = parser.mark + + // Eat the indentation spaces and line breaks. + max_indent := 0 + for { + // Eat the indentation spaces. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { + skip(parser) + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + if parser.mark.column > max_indent { + max_indent = parser.mark.column + } + + // Check for a tab character messing the indentation. + if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { + return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", + start_mark, "found a tab character where an indentation space is expected") + } + + // Have we found a non-empty line? + if !is_break(parser.buffer, parser.buffer_pos) { + break + } + + // Consume the line break. + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + // [Go] Should really be returning breaks instead. + *breaks = read_line(parser, *breaks) + *end_mark = parser.mark + } + + // Determine the indentation level if needed. + if *indent == 0 { + *indent = max_indent + if *indent < parser.indent+1 { + *indent = parser.indent + 1 + } + if *indent < 1 { + *indent = 1 + } + } + return true +} + +// Scan a quoted scalar. +func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { + // Eat the left quote. + start_mark := parser.mark + skip(parser) + + // Consume the content of the quoted scalar. + var s, leading_break, trailing_breaks, whitespaces []byte + for { + // Check that there are no document indicators at the beginning of the line. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected document indicator") + return false + } + + // Check for EOF. + if is_z(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", + start_mark, "found unexpected end of stream") + return false + } + + // Consume non-blank characters. + leading_blanks := false + for !is_blankz(parser.buffer, parser.buffer_pos) { + if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { + // Is is an escaped single quote. + s = append(s, '\'') + skip(parser) + skip(parser) + + } else if single && parser.buffer[parser.buffer_pos] == '\'' { + // It is a right single quote. + break + } else if !single && parser.buffer[parser.buffer_pos] == '"' { + // It is a right double quote. + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { + // It is an escaped line break. + if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { + return false + } + skip(parser) + skip_line(parser) + leading_blanks = true + break + + } else if !single && parser.buffer[parser.buffer_pos] == '\\' { + // It is an escape sequence. + code_length := 0 + + // Check the escape character. + switch parser.buffer[parser.buffer_pos+1] { + case '0': + s = append(s, 0) + case 'a': + s = append(s, '\x07') + case 'b': + s = append(s, '\x08') + case 't', '\t': + s = append(s, '\x09') + case 'n': + s = append(s, '\x0A') + case 'v': + s = append(s, '\x0B') + case 'f': + s = append(s, '\x0C') + case 'r': + s = append(s, '\x0D') + case 'e': + s = append(s, '\x1B') + case ' ': + s = append(s, '\x20') + case '"': + s = append(s, '"') + case '\'': + s = append(s, '\'') + case '\\': + s = append(s, '\\') + case 'N': // NEL (#x85) + s = append(s, '\xC2') + s = append(s, '\x85') + case '_': // #xA0 + s = append(s, '\xC2') + s = append(s, '\xA0') + case 'L': // LS (#x2028) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA8') + case 'P': // PS (#x2029) + s = append(s, '\xE2') + s = append(s, '\x80') + s = append(s, '\xA9') + case 'x': + code_length = 2 + case 'u': + code_length = 4 + case 'U': + code_length = 8 + default: + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found unknown escape character") + return false + } + + skip(parser) + skip(parser) + + // Consume an arbitrary escape code. + if code_length > 0 { + var value int + + // Scan the character value. + if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { + return false + } + for k := 0; k < code_length; k++ { + if !is_hex(parser.buffer, parser.buffer_pos+k) { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "did not find expected hexdecimal number") + return false + } + value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) + } + + // Check the value and write the character. + if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { + yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", + start_mark, "found invalid Unicode character escape code") + return false + } + if value <= 0x7F { + s = append(s, byte(value)) + } else if value <= 0x7FF { + s = append(s, byte(0xC0+(value>>6))) + s = append(s, byte(0x80+(value&0x3F))) + } else if value <= 0xFFFF { + s = append(s, byte(0xE0+(value>>12))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } else { + s = append(s, byte(0xF0+(value>>18))) + s = append(s, byte(0x80+((value>>12)&0x3F))) + s = append(s, byte(0x80+((value>>6)&0x3F))) + s = append(s, byte(0x80+(value&0x3F))) + } + + // Advance the pointer. + for k := 0; k < code_length; k++ { + skip(parser) + } + } + } else { + // It is a non-escaped non-blank character. + s = read(parser, s) + } + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + // Check if we are at the end of the scalar. + if single { + if parser.buffer[parser.buffer_pos] == '\'' { + break + } + } else { + if parser.buffer[parser.buffer_pos] == '"' { + break + } + } + + // Consume blank characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Join the whitespaces or fold line breaks. + if leading_blanks { + // Do we need to fold line breaks? + if len(leading_break) > 0 && leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Eat the right quote. + skip(parser) + end_mark := parser.mark + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_SINGLE_QUOTED_SCALAR_STYLE, + } + if !single { + token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE + } + return true +} + +// Scan a plain scalar. +func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { + + var s, leading_break, trailing_breaks, whitespaces []byte + var leading_blanks bool + var indent = parser.indent + 1 + + start_mark := parser.mark + end_mark := parser.mark + + // Consume the content of the plain scalar. + for { + // Check for a document indicator. + if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { + return false + } + if parser.mark.column == 0 && + ((parser.buffer[parser.buffer_pos+0] == '-' && + parser.buffer[parser.buffer_pos+1] == '-' && + parser.buffer[parser.buffer_pos+2] == '-') || + (parser.buffer[parser.buffer_pos+0] == '.' && + parser.buffer[parser.buffer_pos+1] == '.' && + parser.buffer[parser.buffer_pos+2] == '.')) && + is_blankz(parser.buffer, parser.buffer_pos+3) { + break + } + + // Check for a comment. + if parser.buffer[parser.buffer_pos] == '#' { + break + } + + // Consume non-blank characters. + for !is_blankz(parser.buffer, parser.buffer_pos) { + + // Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". + if parser.flow_level > 0 && + parser.buffer[parser.buffer_pos] == ':' && + !is_blankz(parser.buffer, parser.buffer_pos+1) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found unexpected ':'") + return false + } + + // Check for indicators that may end a plain scalar. + if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || + (parser.flow_level > 0 && + (parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == ':' || + parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || + parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || + parser.buffer[parser.buffer_pos] == '}')) { + break + } + + // Check if we need to join whitespaces and breaks. + if leading_blanks || len(whitespaces) > 0 { + if leading_blanks { + // Do we need to fold line breaks? + if leading_break[0] == '\n' { + if len(trailing_breaks) == 0 { + s = append(s, ' ') + } else { + s = append(s, trailing_breaks...) + } + } else { + s = append(s, leading_break...) + s = append(s, trailing_breaks...) + } + trailing_breaks = trailing_breaks[:0] + leading_break = leading_break[:0] + leading_blanks = false + } else { + s = append(s, whitespaces...) + whitespaces = whitespaces[:0] + } + } + + // Copy the character. + s = read(parser, s) + + end_mark = parser.mark + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + } + + // Is it the end? + if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { + break + } + + // Consume blank characters. + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + + for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { + if is_blank(parser.buffer, parser.buffer_pos) { + + // Check for tab character that abuse indentation. + if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { + yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", + start_mark, "found a tab character that violate indentation") + return false + } + + // Consume a space or a tab character. + if !leading_blanks { + whitespaces = read(parser, whitespaces) + } else { + skip(parser) + } + } else { + if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { + return false + } + + // Check if it is a first line break. + if !leading_blanks { + whitespaces = whitespaces[:0] + leading_break = read_line(parser, leading_break) + leading_blanks = true + } else { + trailing_breaks = read_line(parser, trailing_breaks) + } + } + if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { + return false + } + } + + // Check indentation level. + if parser.flow_level == 0 && parser.mark.column < indent { + break + } + } + + // Create a token. + *token = yaml_token_t{ + typ: yaml_SCALAR_TOKEN, + start_mark: start_mark, + end_mark: end_mark, + value: s, + style: yaml_PLAIN_SCALAR_STYLE, + } + + // Note that we change the 'simple_key_allowed' flag. + if leading_blanks { + parser.simple_key_allowed = true + } + return true +} diff --git a/vendor/github.com/sanathkr/go-yaml/sorter.go b/vendor/github.com/sanathkr/go-yaml/sorter.go new file mode 100644 index 000000000000..5958822f9c6b --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/sorter.go @@ -0,0 +1,104 @@ +package yaml + +import ( + "reflect" + "unicode" +) + +type keyList []reflect.Value + +func (l keyList) Len() int { return len(l) } +func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l keyList) Less(i, j int) bool { + a := l[i] + b := l[j] + ak := a.Kind() + bk := b.Kind() + for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { + a = a.Elem() + ak = a.Kind() + } + for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { + b = b.Elem() + bk = b.Kind() + } + af, aok := keyFloat(a) + bf, bok := keyFloat(b) + if aok && bok { + if af != bf { + return af < bf + } + if ak != bk { + return ak < bk + } + return numLess(a, b) + } + if ak != reflect.String || bk != reflect.String { + return ak < bk + } + ar, br := []rune(a.String()), []rune(b.String()) + for i := 0; i < len(ar) && i < len(br); i++ { + if ar[i] == br[i] { + continue + } + al := unicode.IsLetter(ar[i]) + bl := unicode.IsLetter(br[i]) + if al && bl { + return ar[i] < br[i] + } + if al || bl { + return bl + } + var ai, bi int + var an, bn int64 + for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { + an = an*10 + int64(ar[ai]-'0') + } + for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { + bn = bn*10 + int64(br[bi]-'0') + } + if an != bn { + return an < bn + } + if ai != bi { + return ai < bi + } + return ar[i] < br[i] + } + return len(ar) < len(br) +} + +// keyFloat returns a float value for v if it is a number/bool +// and whether it is a number/bool or not. +func keyFloat(v reflect.Value) (f float64, ok bool) { + switch v.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return float64(v.Int()), true + case reflect.Float32, reflect.Float64: + return v.Float(), true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return float64(v.Uint()), true + case reflect.Bool: + if v.Bool() { + return 1, true + } + return 0, true + } + return 0, false +} + +// numLess returns whether a < b. +// a and b must necessarily have the same kind. +func numLess(a, b reflect.Value) bool { + switch a.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return a.Int() < b.Int() + case reflect.Float32, reflect.Float64: + return a.Float() < b.Float() + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return a.Uint() < b.Uint() + case reflect.Bool: + return !a.Bool() && b.Bool() + } + panic("not a number") +} diff --git a/vendor/github.com/sanathkr/go-yaml/writerc.go b/vendor/github.com/sanathkr/go-yaml/writerc.go new file mode 100644 index 000000000000..190362f25dfb --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/writerc.go @@ -0,0 +1,89 @@ +package yaml + +// Set the writer error and return false. +func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { + emitter.error = yaml_WRITER_ERROR + emitter.problem = problem + return false +} + +// Flush the output buffer. +func yaml_emitter_flush(emitter *yaml_emitter_t) bool { + if emitter.write_handler == nil { + panic("write handler not set") + } + + // Check if the buffer is empty. + if emitter.buffer_pos == 0 { + return true + } + + // If the output encoding is UTF-8, we don't need to recode the buffer. + if emitter.encoding == yaml_UTF8_ENCODING { + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + return true + } + + // Recode the buffer into the raw buffer. + var low, high int + if emitter.encoding == yaml_UTF16LE_ENCODING { + low, high = 0, 1 + } else { + high, low = 1, 0 + } + + pos := 0 + for pos < emitter.buffer_pos { + // See the "reader.c" code for more details on UTF-8 encoding. Note + // that we assume that the buffer contains a valid UTF-8 sequence. + + // Read the next UTF-8 character. + octet := emitter.buffer[pos] + + var w int + var value rune + switch { + case octet&0x80 == 0x00: + w, value = 1, rune(octet&0x7F) + case octet&0xE0 == 0xC0: + w, value = 2, rune(octet&0x1F) + case octet&0xF0 == 0xE0: + w, value = 3, rune(octet&0x0F) + case octet&0xF8 == 0xF0: + w, value = 4, rune(octet&0x07) + } + for k := 1; k < w; k++ { + octet = emitter.buffer[pos+k] + value = (value << 6) + (rune(octet) & 0x3F) + } + pos += w + + // Write the character. + if value < 0x10000 { + var b [2]byte + b[high] = byte(value >> 8) + b[low] = byte(value & 0xFF) + emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) + } else { + // Write the character using a surrogate pair (check "reader.c"). + var b [4]byte + value -= 0x10000 + b[high] = byte(0xD8 + (value >> 18)) + b[low] = byte((value >> 10) & 0xFF) + b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) + b[low+2] = byte(value & 0xFF) + emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) + } + } + + // Write the raw buffer. + if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { + return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) + } + emitter.buffer_pos = 0 + emitter.raw_buffer = emitter.raw_buffer[:0] + return true +} diff --git a/vendor/github.com/sanathkr/go-yaml/yaml.go b/vendor/github.com/sanathkr/go-yaml/yaml.go new file mode 100644 index 000000000000..ed487525cf04 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/yaml.go @@ -0,0 +1,374 @@ +// Package yaml implements YAML support for the Go language. +// +// Source code and other details for the project are available at GitHub: +// +// https://github.com/go-yaml/yaml +// +package yaml + +import ( + "errors" + "fmt" + "reflect" + "strings" + "sync" +) + +// MapSlice encodes and decodes as a YAML map. +// The order of keys is preserved when encoding and decoding. +type MapSlice []MapItem + +// MapItem is an item in a MapSlice. +type MapItem struct { + Key, Value interface{} +} + +// The Unmarshaler interface may be implemented by types to customize their +// behavior when being unmarshaled from a YAML document. The UnmarshalYAML +// method receives a function that may be called to unmarshal the original +// YAML value into a field or variable. It is safe to call the unmarshal +// function parameter more than once if necessary. +type Unmarshaler interface { + UnmarshalYAML(unmarshal func(interface{}) error) error +} + +type TagUnmarshallerDecoder struct { + d *decoder +} + +// The Tag Unmarshaler interface +type TagUnmarshaler interface { + UnmarshalYAMLTag(tag string, out reflect.Value) reflect.Value +} + +// The Marshaler interface may be implemented by types to customize their +// behavior when being marshaled into a YAML document. The returned value +// is marshaled in place of the original value implementing Marshaler. +// +// If an error is returned by MarshalYAML, the marshaling procedure stops +// and returns with the provided error. +type Marshaler interface { + MarshalYAML() (interface{}, error) +} + +// Unmarshal decodes the first document found within the in byte slice +// and assigns decoded values into the out value. +// +// Maps and pointers (to a struct, string, int, etc) are accepted as out +// values. If an internal pointer within a struct is not initialized, +// the yaml package will initialize it if necessary for unmarshalling +// the provided data. The out parameter must not be nil. +// +// The type of the decoded values should be compatible with the respective +// values in out. If one or more values cannot be decoded due to a type +// mismatches, decoding continues partially until the end of the YAML +// content, and a *yaml.TypeError is returned with details for all +// missed values. +// +// Struct fields are only unmarshalled if they are exported (have an +// upper case first letter), and are unmarshalled using the field name +// lowercased as the default key. Custom keys may be defined via the +// "yaml" name in the field tag: the content preceding the first comma +// is used as the key, and the following comma-separated options are +// used to tweak the marshalling process (see Marshal). +// Conflicting names result in a runtime error. +// +// For example: +// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// +// See the documentation of Marshal for the format of tags and a list of +// supported tag options. +// +func Unmarshal(in []byte, out interface{}) (err error) { + return unmarshal(in, out, false) +} + +// UnmarshalStrict is like Unmarshal except that any fields that are found +// in the data that do not have corresponding struct members will result in +// an error. +func UnmarshalStrict(in []byte, out interface{}) (err error) { + return unmarshal(in, out, true) +} + +func unmarshal(in []byte, out interface{}, strict bool) (err error) { + defer handleErr(&err) + d := newDecoder(strict) + p := newParser(in) + defer p.destroy() + node := p.parse() + if node != nil { + v := reflect.ValueOf(out) + if v.Kind() == reflect.Ptr && !v.IsNil() { + v = v.Elem() + } + d.unmarshal(node, v) + } + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + +// Marshal serializes the value provided into a YAML document. The structure +// of the generated document will reflect the structure of the value itself. +// Maps and pointers (to struct, string, int, etc) are accepted as the in value. +// +// Struct fields are only unmarshalled if they are exported (have an upper case +// first letter), and are unmarshalled using the field name lowercased as the +// default key. Custom keys may be defined via the "yaml" name in the field +// tag: the content preceding the first comma is used as the key, and the +// following comma-separated options are used to tweak the marshalling process. +// Conflicting names result in a runtime error. +// +// The field tag format accepted is: +// +// `(...) yaml:"[][,[,]]" (...)` +// +// The following flags are currently supported: +// +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Does not apply to zero valued structs. +// +// flow Marshal using a flow style (useful for structs, +// sequences and maps). +// +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. +// +// In addition, if the key is "-", the field is ignored. +// +// For example: +// +// type T struct { +// F int "a,omitempty" +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" +// +func Marshal(in interface{}) (out []byte, err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshal("", reflect.ValueOf(in)) + e.finish() + out = e.out + return +} + +func RegisterTagUnmarshaler(tag string, unmarshaler TagUnmarshaler) { + registerCustomTagUnmarshaler(tag, unmarshaler) +} + +func UnRegisterTagUnmarshaler(tag string) { + unregisterCustomTagUnmarshaler(tag) +} + +func handleErr(err *error) { + if v := recover(); v != nil { + if e, ok := v.(yamlError); ok { + *err = e.err + } else { + panic(v) + } + } +} + +type yamlError struct { + err error +} + +func fail(err error) { + panic(yamlError{err}) +} + +func failf(format string, args ...interface{}) { + panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) +} + +// A TypeError is returned by Unmarshal when one or more fields in +// the YAML document cannot be properly decoded into the requested +// types. When this error is returned, the value is still +// unmarshaled partially. +type TypeError struct { + Errors []string +} + +func (e *TypeError) Error() string { + return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) +} + +// -------------------------------------------------------------------------- +// Maintain a mapping of keys to structure field indexes + +// The code in this section was copied from mgo/bson. + +// structInfo holds details for the serialization of fields of +// a given struct. +type structInfo struct { + FieldsMap map[string]fieldInfo + FieldsList []fieldInfo + + // InlineMap is the number of the field in the struct that + // contains an ,inline map, or -1 if there's none. + InlineMap int +} + +type fieldInfo struct { + Key string + Num int + OmitEmpty bool + Flow bool + + // Inline holds the field index if the field is part of an inlined struct. + Inline []int +} + +var structMap = make(map[reflect.Type]*structInfo) +var fieldMapMutex sync.RWMutex + +func getStructInfo(st reflect.Type) (*structInfo, error) { + fieldMapMutex.RLock() + sinfo, found := structMap[st] + fieldMapMutex.RUnlock() + if found { + return sinfo, nil + } + + n := st.NumField() + fieldsMap := make(map[string]fieldInfo) + fieldsList := make([]fieldInfo, 0, n) + inlineMap := -1 + for i := 0; i != n; i++ { + field := st.Field(i) + if field.PkgPath != "" && !field.Anonymous { + continue // Private field + } + + info := fieldInfo{Num: i} + + tag := field.Tag.Get("yaml") + if tag == "" && strings.Index(string(field.Tag), ":") < 0 { + tag = string(field.Tag) + } + if tag == "-" { + continue + } + + inline := false + fields := strings.Split(tag, ",") + if len(fields) > 1 { + for _, flag := range fields[1:] { + switch flag { + case "omitempty": + info.OmitEmpty = true + case "flow": + info.Flow = true + case "inline": + inline = true + default: + return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st)) + } + } + tag = fields[0] + } + + if inline { + switch field.Type.Kind() { + case reflect.Map: + if inlineMap >= 0 { + return nil, errors.New("Multiple ,inline maps in struct " + st.String()) + } + if field.Type.Key() != reflect.TypeOf("") { + return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String()) + } + inlineMap = info.Num + case reflect.Struct: + sinfo, err := getStructInfo(field.Type) + if err != nil { + return nil, err + } + for _, finfo := range sinfo.FieldsList { + if _, found := fieldsMap[finfo.Key]; found { + msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + if finfo.Inline == nil { + finfo.Inline = []int{i, finfo.Num} + } else { + finfo.Inline = append([]int{i}, finfo.Inline...) + } + fieldsMap[finfo.Key] = finfo + fieldsList = append(fieldsList, finfo) + } + default: + //return nil, errors.New("Option ,inline needs a struct value or map field") + return nil, errors.New("Option ,inline needs a struct value field") + } + continue + } + + if tag != "" { + info.Key = tag + } else { + info.Key = strings.ToLower(field.Name) + } + + if _, found = fieldsMap[info.Key]; found { + msg := "Duplicated key '" + info.Key + "' in struct " + st.String() + return nil, errors.New(msg) + } + + fieldsList = append(fieldsList, info) + fieldsMap[info.Key] = info + } + + sinfo = &structInfo{fieldsMap, fieldsList, inlineMap} + + fieldMapMutex.Lock() + structMap[st] = sinfo + fieldMapMutex.Unlock() + return sinfo, nil +} + +func isZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.String: + return len(v.String()) == 0 + case reflect.Interface, reflect.Ptr: + return v.IsNil() + case reflect.Slice: + return v.Len() == 0 + case reflect.Map: + return v.Len() == 0 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Struct: + vt := v.Type() + for i := v.NumField() - 1; i >= 0; i-- { + if vt.Field(i).PkgPath != "" { + continue // Private field + } + if !isZero(v.Field(i)) { + return false + } + } + return true + } + return false +} diff --git a/vendor/github.com/sanathkr/go-yaml/yamlh.go b/vendor/github.com/sanathkr/go-yaml/yamlh.go new file mode 100644 index 000000000000..3caeca0491b5 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/yamlh.go @@ -0,0 +1,716 @@ +package yaml + +import ( + "io" +) + +// The version directive data. +type yaml_version_directive_t struct { + major int8 // The major version number. + minor int8 // The minor version number. +} + +// The tag directive data. +type yaml_tag_directive_t struct { + handle []byte // The tag handle. + prefix []byte // The tag prefix. +} + +type yaml_encoding_t int + +// The stream encoding. +const ( + // Let the parser choose the encoding. + yaml_ANY_ENCODING yaml_encoding_t = iota + + yaml_UTF8_ENCODING // The default UTF-8 encoding. + yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. + yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. +) + +type yaml_break_t int + +// Line break types. +const ( + // Let the parser choose the break type. + yaml_ANY_BREAK yaml_break_t = iota + + yaml_CR_BREAK // Use CR for line breaks (Mac style). + yaml_LN_BREAK // Use LN for line breaks (Unix style). + yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). +) + +type yaml_error_type_t int + +// Many bad things could happen with the parser and emitter. +const ( + // No error is produced. + yaml_NO_ERROR yaml_error_type_t = iota + + yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. + yaml_READER_ERROR // Cannot read or decode the input stream. + yaml_SCANNER_ERROR // Cannot scan the input stream. + yaml_PARSER_ERROR // Cannot parse the input stream. + yaml_COMPOSER_ERROR // Cannot compose a YAML document. + yaml_WRITER_ERROR // Cannot write to the output stream. + yaml_EMITTER_ERROR // Cannot emit a YAML stream. +) + +// The pointer position. +type yaml_mark_t struct { + index int // The position index. + line int // The position line. + column int // The position column. +} + +// Node Styles + +type yaml_style_t int8 + +type yaml_scalar_style_t yaml_style_t + +// Scalar styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota + + yaml_PLAIN_SCALAR_STYLE // The plain scalar style. + yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. + yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. + yaml_LITERAL_SCALAR_STYLE // The literal scalar style. + yaml_FOLDED_SCALAR_STYLE // The folded scalar style. +) + +type yaml_sequence_style_t yaml_style_t + +// Sequence styles. +const ( + // Let the emitter choose the style. + yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota + + yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. + yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. +) + +type yaml_mapping_style_t yaml_style_t + +// Mapping styles. +const ( + // Let the emitter choose the style. + yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota + + yaml_BLOCK_MAPPING_STYLE // The block mapping style. + yaml_FLOW_MAPPING_STYLE // The flow mapping style. +) + +// Tokens + +type yaml_token_type_t int + +// Token types. +const ( + // An empty token. + yaml_NO_TOKEN yaml_token_type_t = iota + + yaml_STREAM_START_TOKEN // A STREAM-START token. + yaml_STREAM_END_TOKEN // A STREAM-END token. + + yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. + yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. + yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. + yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. + + yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. + yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. + yaml_BLOCK_END_TOKEN // A BLOCK-END token. + + yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. + yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. + yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. + yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. + + yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. + yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. + yaml_KEY_TOKEN // A KEY token. + yaml_VALUE_TOKEN // A VALUE token. + + yaml_ALIAS_TOKEN // An ALIAS token. + yaml_ANCHOR_TOKEN // An ANCHOR token. + yaml_TAG_TOKEN // A TAG token. + yaml_SCALAR_TOKEN // A SCALAR token. +) + +func (tt yaml_token_type_t) String() string { + switch tt { + case yaml_NO_TOKEN: + return "yaml_NO_TOKEN" + case yaml_STREAM_START_TOKEN: + return "yaml_STREAM_START_TOKEN" + case yaml_STREAM_END_TOKEN: + return "yaml_STREAM_END_TOKEN" + case yaml_VERSION_DIRECTIVE_TOKEN: + return "yaml_VERSION_DIRECTIVE_TOKEN" + case yaml_TAG_DIRECTIVE_TOKEN: + return "yaml_TAG_DIRECTIVE_TOKEN" + case yaml_DOCUMENT_START_TOKEN: + return "yaml_DOCUMENT_START_TOKEN" + case yaml_DOCUMENT_END_TOKEN: + return "yaml_DOCUMENT_END_TOKEN" + case yaml_BLOCK_SEQUENCE_START_TOKEN: + return "yaml_BLOCK_SEQUENCE_START_TOKEN" + case yaml_BLOCK_MAPPING_START_TOKEN: + return "yaml_BLOCK_MAPPING_START_TOKEN" + case yaml_BLOCK_END_TOKEN: + return "yaml_BLOCK_END_TOKEN" + case yaml_FLOW_SEQUENCE_START_TOKEN: + return "yaml_FLOW_SEQUENCE_START_TOKEN" + case yaml_FLOW_SEQUENCE_END_TOKEN: + return "yaml_FLOW_SEQUENCE_END_TOKEN" + case yaml_FLOW_MAPPING_START_TOKEN: + return "yaml_FLOW_MAPPING_START_TOKEN" + case yaml_FLOW_MAPPING_END_TOKEN: + return "yaml_FLOW_MAPPING_END_TOKEN" + case yaml_BLOCK_ENTRY_TOKEN: + return "yaml_BLOCK_ENTRY_TOKEN" + case yaml_FLOW_ENTRY_TOKEN: + return "yaml_FLOW_ENTRY_TOKEN" + case yaml_KEY_TOKEN: + return "yaml_KEY_TOKEN" + case yaml_VALUE_TOKEN: + return "yaml_VALUE_TOKEN" + case yaml_ALIAS_TOKEN: + return "yaml_ALIAS_TOKEN" + case yaml_ANCHOR_TOKEN: + return "yaml_ANCHOR_TOKEN" + case yaml_TAG_TOKEN: + return "yaml_TAG_TOKEN" + case yaml_SCALAR_TOKEN: + return "yaml_SCALAR_TOKEN" + } + return "" +} + +// The token structure. +type yaml_token_t struct { + // The token type. + typ yaml_token_type_t + + // The start/end of the token. + start_mark, end_mark yaml_mark_t + + // The stream encoding (for yaml_STREAM_START_TOKEN). + encoding yaml_encoding_t + + // The alias/anchor/scalar value or tag/tag directive handle + // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). + value []byte + + // The tag suffix (for yaml_TAG_TOKEN). + suffix []byte + + // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). + prefix []byte + + // The scalar style (for yaml_SCALAR_TOKEN). + style yaml_scalar_style_t + + // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). + major, minor int8 +} + +// Events + +type yaml_event_type_t int8 + +// Event types. +const ( + // An empty event. + yaml_NO_EVENT yaml_event_type_t = iota + + yaml_STREAM_START_EVENT // A STREAM-START event. + yaml_STREAM_END_EVENT // A STREAM-END event. + yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. + yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. + yaml_ALIAS_EVENT // An ALIAS event. + yaml_SCALAR_EVENT // A SCALAR event. + yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. + yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. + yaml_MAPPING_START_EVENT // A MAPPING-START event. + yaml_MAPPING_END_EVENT // A MAPPING-END event. +) + +// The event structure. +type yaml_event_t struct { + + // The event type. + typ yaml_event_type_t + + // The start and end of the event. + start_mark, end_mark yaml_mark_t + + // The document encoding (for yaml_STREAM_START_EVENT). + encoding yaml_encoding_t + + // The version directive (for yaml_DOCUMENT_START_EVENT). + version_directive *yaml_version_directive_t + + // The list of tag directives (for yaml_DOCUMENT_START_EVENT). + tag_directives []yaml_tag_directive_t + + // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). + anchor []byte + + // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + tag []byte + + // The scalar value (for yaml_SCALAR_EVENT). + value []byte + + // Is the document start/end indicator implicit, or the tag optional? + // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). + implicit bool + + // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). + quoted_implicit bool + + // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). + style yaml_style_t +} + +func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } +func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } +func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } + +// Nodes + +const ( + yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. + yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. + yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. + yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. + yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. + yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. + + yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. + yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. + + // Not in original libyaml. + yaml_BINARY_TAG = "tag:yaml.org,2002:binary" + yaml_MERGE_TAG = "tag:yaml.org,2002:merge" + + yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. + yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. + yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. +) + +type yaml_node_type_t int + +// Node types. +const ( + // An empty node. + yaml_NO_NODE yaml_node_type_t = iota + + yaml_SCALAR_NODE // A scalar node. + yaml_SEQUENCE_NODE // A sequence node. + yaml_MAPPING_NODE // A mapping node. +) + +// An element of a sequence node. +type yaml_node_item_t int + +// An element of a mapping node. +type yaml_node_pair_t struct { + key int // The key of the element. + value int // The value of the element. +} + +// The node structure. +type yaml_node_t struct { + typ yaml_node_type_t // The node type. + tag []byte // The node tag. + + // The node data. + + // The scalar parameters (for yaml_SCALAR_NODE). + scalar struct { + value []byte // The scalar value. + length int // The length of the scalar value. + style yaml_scalar_style_t // The scalar style. + } + + // The sequence parameters (for YAML_SEQUENCE_NODE). + sequence struct { + items_data []yaml_node_item_t // The stack of sequence items. + style yaml_sequence_style_t // The sequence style. + } + + // The mapping parameters (for yaml_MAPPING_NODE). + mapping struct { + pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). + pairs_start *yaml_node_pair_t // The beginning of the stack. + pairs_end *yaml_node_pair_t // The end of the stack. + pairs_top *yaml_node_pair_t // The top of the stack. + style yaml_mapping_style_t // The mapping style. + } + + start_mark yaml_mark_t // The beginning of the node. + end_mark yaml_mark_t // The end of the node. + +} + +// The document structure. +type yaml_document_t struct { + + // The document nodes. + nodes []yaml_node_t + + // The version directive. + version_directive *yaml_version_directive_t + + // The list of tag directives. + tag_directives_data []yaml_tag_directive_t + tag_directives_start int // The beginning of the tag directives list. + tag_directives_end int // The end of the tag directives list. + + start_implicit int // Is the document start indicator implicit? + end_implicit int // Is the document end indicator implicit? + + // The start/end of the document. + start_mark, end_mark yaml_mark_t +} + +// The prototype of a read handler. +// +// The read handler is called when the parser needs to read more bytes from the +// source. The handler should write not more than size bytes to the buffer. +// The number of written bytes should be set to the size_read variable. +// +// [in,out] data A pointer to an application data specified by +// yaml_parser_set_input(). +// [out] buffer The buffer to write the data from the source. +// [in] size The size of the buffer. +// [out] size_read The actual number of bytes read from the source. +// +// On success, the handler should return 1. If the handler failed, +// the returned value should be 0. On EOF, the handler should set the +// size_read to 0 and return 1. +type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) + +// This structure holds information about a potential simple key. +type yaml_simple_key_t struct { + possible bool // Is a simple key possible? + required bool // Is a simple key required? + token_number int // The number of the token. + mark yaml_mark_t // The position mark. +} + +// The states of the parser. +type yaml_parser_state_t int + +const ( + yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota + + yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. + yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. + yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. + yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. + yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. + yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. + yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. + yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. + yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. + yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. + yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. + yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. + yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. + yaml_PARSE_END_STATE // Expect nothing. +) + +func (ps yaml_parser_state_t) String() string { + switch ps { + case yaml_PARSE_STREAM_START_STATE: + return "yaml_PARSE_STREAM_START_STATE" + case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: + return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_START_STATE: + return "yaml_PARSE_DOCUMENT_START_STATE" + case yaml_PARSE_DOCUMENT_CONTENT_STATE: + return "yaml_PARSE_DOCUMENT_CONTENT_STATE" + case yaml_PARSE_DOCUMENT_END_STATE: + return "yaml_PARSE_DOCUMENT_END_STATE" + case yaml_PARSE_BLOCK_NODE_STATE: + return "yaml_PARSE_BLOCK_NODE_STATE" + case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: + return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" + case yaml_PARSE_FLOW_NODE_STATE: + return "yaml_PARSE_FLOW_NODE_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: + return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" + case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: + return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: + return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" + case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_KEY_STATE: + return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" + case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" + case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: + return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" + case yaml_PARSE_END_STATE: + return "yaml_PARSE_END_STATE" + } + return "" +} + +// This structure holds aliases data. +type yaml_alias_data_t struct { + anchor []byte // The anchor. + index int // The node id. + mark yaml_mark_t // The anchor mark. +} + +// The parser structure. +// +// All members are internal. Manage the structure using the +// yaml_parser_ family of functions. +type yaml_parser_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + + problem string // Error description. + + // The byte about which the problem occurred. + problem_offset int + problem_value int + problem_mark yaml_mark_t + + // The error context. + context string + context_mark yaml_mark_t + + // Reader stuff + + read_handler yaml_read_handler_t // Read handler. + + input_file io.Reader // File input data. + input []byte // String input data. + input_pos int + + eof bool // EOF flag + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + unread int // The number of unread characters in the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The input encoding. + + offset int // The offset of the current position (in bytes). + mark yaml_mark_t // The mark of the current position. + + // Scanner stuff + + stream_start_produced bool // Have we started to scan the input stream? + stream_end_produced bool // Have we reached the end of the input stream? + + flow_level int // The number of unclosed '[' and '{' indicators. + + tokens []yaml_token_t // The tokens queue. + tokens_head int // The head of the tokens queue. + tokens_parsed int // The number of tokens fetched from the queue. + token_available bool // Does the tokens queue contain a token ready for dequeueing. + + indent int // The current indentation level. + indents []int // The indentation levels stack. + + simple_key_allowed bool // May a simple key occur at the current position? + simple_keys []yaml_simple_key_t // The stack of simple keys. + + // Parser stuff + + state yaml_parser_state_t // The current parser state. + states []yaml_parser_state_t // The parser states stack. + marks []yaml_mark_t // The stack of marks. + tag_directives []yaml_tag_directive_t // The list of TAG directives. + + // Dumper stuff + + aliases []yaml_alias_data_t // The alias data. + + document *yaml_document_t // The currently parsed document. +} + +// Emitter Definitions + +// The prototype of a write handler. +// +// The write handler is called when the emitter needs to flush the accumulated +// characters to the output. The handler should write @a size bytes of the +// @a buffer to the output. +// +// @param[in,out] data A pointer to an application data specified by +// yaml_emitter_set_output(). +// @param[in] buffer The buffer with bytes to be written. +// @param[in] size The size of the buffer. +// +// @returns On success, the handler should return @c 1. If the handler failed, +// the returned value should be @c 0. +// +type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error + +type yaml_emitter_state_t int + +// The emitter states. +const ( + // Expect STREAM-START. + yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota + + yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. + yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. + yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. + yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. + yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. + yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. + yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. + yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. + yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. + yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. + yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. + yaml_EMIT_END_STATE // Expect nothing. +) + +// The emitter structure. +// +// All members are internal. Manage the structure using the @c yaml_emitter_ +// family of functions. +type yaml_emitter_t struct { + + // Error handling + + error yaml_error_type_t // Error type. + problem string // Error description. + + // Writer stuff + + write_handler yaml_write_handler_t // Write handler. + + output_buffer *[]byte // String output data. + output_file io.Writer // File output data. + + buffer []byte // The working buffer. + buffer_pos int // The current position of the buffer. + + raw_buffer []byte // The raw buffer. + raw_buffer_pos int // The current position of the buffer. + + encoding yaml_encoding_t // The stream encoding. + + // Emitter stuff + + canonical bool // If the output is in the canonical style? + best_indent int // The number of indentation spaces. + best_width int // The preferred width of the output lines. + unicode bool // Allow unescaped non-ASCII characters? + line_break yaml_break_t // The preferred line break. + + state yaml_emitter_state_t // The current emitter state. + states []yaml_emitter_state_t // The stack of states. + + events []yaml_event_t // The event queue. + events_head int // The head of the event queue. + + indents []int // The stack of indentation levels. + + tag_directives []yaml_tag_directive_t // The list of tag directives. + + indent int // The current indentation level. + + flow_level int // The current flow level. + + root_context bool // Is it the document root context? + sequence_context bool // Is it a sequence context? + mapping_context bool // Is it a mapping context? + simple_key_context bool // Is it a simple mapping key context? + + line int // The current line. + column int // The current column. + whitespace bool // If the last character was a whitespace? + indention bool // If the last character was an indentation character (' ', '-', '?', ':')? + open_ended bool // If an explicit document end is required? + + // Anchor analysis. + anchor_data struct { + anchor []byte // The anchor value. + alias bool // Is it an alias? + } + + // Tag analysis. + tag_data struct { + handle []byte // The tag handle. + suffix []byte // The tag suffix. + } + + // Scalar analysis. + scalar_data struct { + value []byte // The scalar value. + multiline bool // Does the scalar contain line breaks? + flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? + block_plain_allowed bool // Can the scalar be expressed in the block plain style? + single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? + block_allowed bool // Can the scalar be expressed in the literal or folded styles? + style yaml_scalar_style_t // The output style. + } + + // Dumper stuff + + opened bool // If the stream was already opened? + closed bool // If the stream was already closed? + + // The information associated with the document nodes. + anchors *struct { + references int // The number of references. + anchor int // The anchor id. + serialized bool // If the node has been emitted? + } + + last_anchor_id int // The last assigned anchor id. + + document *yaml_document_t // The currently emitted document. +} diff --git a/vendor/github.com/sanathkr/go-yaml/yamlprivateh.go b/vendor/github.com/sanathkr/go-yaml/yamlprivateh.go new file mode 100644 index 000000000000..8110ce3c37a6 --- /dev/null +++ b/vendor/github.com/sanathkr/go-yaml/yamlprivateh.go @@ -0,0 +1,173 @@ +package yaml + +const ( + // The size of the input raw buffer. + input_raw_buffer_size = 512 + + // The size of the input buffer. + // It should be possible to decode the whole raw buffer. + input_buffer_size = input_raw_buffer_size * 3 + + // The size of the output buffer. + output_buffer_size = 128 + + // The size of the output raw buffer. + // It should be possible to encode the whole output buffer. + output_raw_buffer_size = (output_buffer_size*2 + 2) + + // The size of other stacks and queues. + initial_stack_size = 16 + initial_queue_size = 16 + initial_string_size = 16 +) + +// Check if the character at the specified position is an alphabetical +// character, a digit, '_', or '-'. +func is_alpha(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' +} + +// Check if the character at the specified position is a digit. +func is_digit(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' +} + +// Get the value of a digit. +func as_digit(b []byte, i int) int { + return int(b[i]) - '0' +} + +// Check if the character at the specified position is a hex-digit. +func is_hex(b []byte, i int) bool { + return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' +} + +// Get the value of a hex-digit. +func as_hex(b []byte, i int) int { + bi := b[i] + if bi >= 'A' && bi <= 'F' { + return int(bi) - 'A' + 10 + } + if bi >= 'a' && bi <= 'f' { + return int(bi) - 'a' + 10 + } + return int(bi) - '0' +} + +// Check if the character is ASCII. +func is_ascii(b []byte, i int) bool { + return b[i] <= 0x7F +} + +// Check if the character at the start of the buffer can be printed unescaped. +func is_printable(b []byte, i int) bool { + return ((b[i] == 0x0A) || // . == #x0A + (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E + (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF + (b[i] > 0xC2 && b[i] < 0xED) || + (b[i] == 0xED && b[i+1] < 0xA0) || + (b[i] == 0xEE) || + (b[i] == 0xEF && // #xE000 <= . <= #xFFFD + !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF + !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) +} + +// Check if the character at the specified position is NUL. +func is_z(b []byte, i int) bool { + return b[i] == 0x00 +} + +// Check if the beginning of the buffer is a BOM. +func is_bom(b []byte, i int) bool { + return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF +} + +// Check if the character at the specified position is space. +func is_space(b []byte, i int) bool { + return b[i] == ' ' +} + +// Check if the character at the specified position is tab. +func is_tab(b []byte, i int) bool { + return b[i] == '\t' +} + +// Check if the character at the specified position is blank (space or tab). +func is_blank(b []byte, i int) bool { + //return is_space(b, i) || is_tab(b, i) + return b[i] == ' ' || b[i] == '\t' +} + +// Check if the character at the specified position is a line break. +func is_break(b []byte, i int) bool { + return (b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) +} + +func is_crlf(b []byte, i int) bool { + return b[i] == '\r' && b[i+1] == '\n' +} + +// Check if the character is a line break or NUL. +func is_breakz(b []byte, i int) bool { + //return is_break(b, i) || is_z(b, i) + return ( // is_break: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + // is_z: + b[i] == 0) +} + +// Check if the character is a line break, space, or NUL. +func is_spacez(b []byte, i int) bool { + //return is_space(b, i) || is_breakz(b, i) + return ( // is_space: + b[i] == ' ' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Check if the character is a line break, space, tab, or NUL. +func is_blankz(b []byte, i int) bool { + //return is_blank(b, i) || is_breakz(b, i) + return ( // is_blank: + b[i] == ' ' || b[i] == '\t' || + // is_breakz: + b[i] == '\r' || // CR (#xD) + b[i] == '\n' || // LF (#xA) + b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) + b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) + b[i] == 0) +} + +// Determine the width of the character. +func width(b byte) int { + // Don't replace these by a switch without first + // confirming that it is being inlined. + if b&0x80 == 0x00 { + return 1 + } + if b&0xE0 == 0xC0 { + return 2 + } + if b&0xF0 == 0xE0 { + return 3 + } + if b&0xF8 == 0xF0 { + return 4 + } + return 0 + +} diff --git a/vendor/github.com/sanathkr/yaml/LICENSE b/vendor/github.com/sanathkr/yaml/LICENSE new file mode 100644 index 000000000000..7805d36de730 --- /dev/null +++ b/vendor/github.com/sanathkr/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/sanathkr/yaml/README.md b/vendor/github.com/sanathkr/yaml/README.md new file mode 100644 index 000000000000..0200f75b4d12 --- /dev/null +++ b/vendor/github.com/sanathkr/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/sanathkr/yaml/fields.go b/vendor/github.com/sanathkr/yaml/fields.go new file mode 100644 index 000000000000..58600740266c --- /dev/null +++ b/vendor/github.com/sanathkr/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/sanathkr/yaml/yaml.go b/vendor/github.com/sanathkr/yaml/yaml.go new file mode 100644 index 000000000000..132a8fe88f27 --- /dev/null +++ b/vendor/github.com/sanathkr/yaml/yaml.go @@ -0,0 +1,277 @@ +package yaml + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "strconv" + + "github.com/sanathkr/go-yaml" +) + +// 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/vendor.json b/vendor/vendor.json index c870fd00eb45..4f71c82243d1 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -114,6 +114,310 @@ "revision": "e75332964ef517daa070d7c38a9466a0d687e0a5", "revisionTime": "2016-09-02T18:42:37Z" }, + { + "checksumSHA1": "OF/FlsdnL1JiA+l4N3NEkrDuLZ0=", + "path": "github.com/aws/aws-lambda-go", + "revision": "2d482ef09017ae953b1e8d5a6ddac5b696663a3c", + "revisionTime": "2018-07-03T16:40:53Z", + "version": "=v1.6.0", + "versionExact": "v1.6.0" + }, + { + "checksumSHA1": "WyQV07euFOe0+sgc35Ajq0gUApU=", + "path": "github.com/aws/aws-lambda-go/events", + "revision": "2d482ef09017ae953b1e8d5a6ddac5b696663a3c", + "revisionTime": "2018-07-03T16:40:53Z", + "version": "=v1.6.0", + "versionExact": "v1.6.0" + }, + { + "checksumSHA1": "Atnv24CtEnB8ZLGDqFevLMfzLtQ=", + "path": "github.com/aws/aws-lambda-go/lambda", + "revision": "2d482ef09017ae953b1e8d5a6ddac5b696663a3c", + "revisionTime": "2018-07-03T16:40:53Z", + "version": "=v1.6.0", + "versionExact": "v1.6.0" + }, + { + "checksumSHA1": "d4ehJWLS4YsqFG825pgwdvKDB6A=", + "path": "github.com/aws/aws-lambda-go/lambda/messages", + "revision": "2d482ef09017ae953b1e8d5a6ddac5b696663a3c", + "revisionTime": "2018-07-03T16:40:53Z", + "version": "=v1.6.0", + "versionExact": "v1.6.0" + }, + { + "checksumSHA1": "f9MhOwQHveaPVWO6trwfqHa+W0M=", + "path": "github.com/aws/aws-lambda-go/lambdacontext", + "revision": "2d482ef09017ae953b1e8d5a6ddac5b696663a3c", + "revisionTime": "2018-07-03T16:40:53Z", + "version": "=v1.6.0", + "versionExact": "v1.6.0" + }, + { + "checksumSHA1": "1+a8f6z7y90VpfaeeLiuTWzzvnE=", + "path": "github.com/aws/aws-sdk-go-v2", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "1AyIehd0sjJ9uJoLZyqq9L9a1Jg=", + "path": "github.com/aws/aws-sdk-go-v2/aws", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "DVN6AdXnfTwEOLJwCOhFqJAEF1E=", + "path": "github.com/aws/aws-sdk-go-v2/aws/awserr", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "TBYKx/Ng0W7w3yEhflOzpeuWY6g=", + "path": "github.com/aws/aws-sdk-go-v2/aws/defaults", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "jELLmO6M63++VSoDn9owMoV766A=", + "path": "github.com/aws/aws-sdk-go-v2/aws/ec2metadata", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "I7v0p6K9Uu6TD+wTeBrhvFyMLqI=", + "path": "github.com/aws/aws-sdk-go-v2/aws/ec2rolecreds", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "VskG4VAz65TA2WH7uwerIRhZ4G8=", + "path": "github.com/aws/aws-sdk-go-v2/aws/endpointcreds", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "+4ge7E7oZmVtB5Fr+M6/RKAbWt0=", + "path": "github.com/aws/aws-sdk-go-v2/aws/endpoints", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "oLHDYaHGGCvY+LyR/bzMvS+ZV/U=", + "path": "github.com/aws/aws-sdk-go-v2/aws/external", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "p+VkEWftmIz1+oGuOOIvK0gtx6c=", + "path": "github.com/aws/aws-sdk-go-v2/aws/signer/v4", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "EKGMaB27+PYflsRlLBuLGZLih/g=", + "path": "github.com/aws/aws-sdk-go-v2/aws/stscreds", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "e6B1TByeUglBqKy8uBXBaINynlE=", + "path": "github.com/aws/aws-sdk-go-v2/internal/awsutil", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "/cvMYy/6A4bD/jsJCRM+v69gSZI=", + "path": "github.com/aws/aws-sdk-go-v2/internal/ini", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "ERU2v7Jbu86xjpLgb+dG4lnyNfU=", + "path": "github.com/aws/aws-sdk-go-v2/internal/sdk", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "Yfzf9cCDNY/kAG1j7WQx2ZBU7zE=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "FdZh+IZa1ty76+RV7tXVfmtyIuo=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/json", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "W20qSroKjq+SVZCQWhdOxTVzMJc=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/json/jsonutil", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "QBgP8y0RJvyqYn234+0t/TsTV38=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/jsonrpc", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "aHSao8oK9aBHiVerbVN7Ph5NlMU=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/query", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "4deNSswzG34mHBmXucHZ1HuB/4o=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/query/queryutil", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "ePhzbmlr/QdIaq/p5yS1YEWJHPY=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/rest", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "+NM7uyBRkkB2QDMvJnNSGsBFbXQ=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/restjson", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "ySXaN6sOslbV1KjvtZE9ColsPwU=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/restxml", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "yVqzN5KLeyxDlQmTyhMziIgVw+4=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/xml", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "aUgbxpCz2vi9bxm+YHnz3GojvAY=", + "path": "github.com/aws/aws-sdk-go-v2/private/protocol/xml/xmlutil", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "yo32Zcq1rjutOJYfrSqKDGx/i44=", + "path": "github.com/aws/aws-sdk-go-v2/service/cloudformation", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "wJrdYP7TyFYBwNPprzcA+ZdAjyo=", + "path": "github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "QX85Yp1ihkxh8ye/FktHZUVsT6A=", + "path": "github.com/aws/aws-sdk-go-v2/service/lambda", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "/1ueZe/ATSjk0EEVbEkkROXC/hk=", + "path": "github.com/aws/aws-sdk-go-v2/service/s3", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "KxyCqGCS+HriTN14zW1NKyXDCT4=", + "path": "github.com/aws/aws-sdk-go-v2/service/sts", + "revision": "d52522b5f4b95591ff6528d7c54923951aadf099", + "revisionTime": "2018-09-27T22:51:20Z", + "version": "v2.0.0-preview.5", + "versionExact": "v2.0.0-preview.5" + }, + { + "checksumSHA1": "bYNIHZ2HowxKRrXRFVzNh2A12i4=", + "path": "github.com/awslabs/goformation", + "revision": "d42502ef32a8892bf380256e2f57c6f69190d802", + "revisionTime": "2018-09-16T20:29:49Z", + "version": "1.2.2", + "versionExact": "1.2.2" + }, + { + "checksumSHA1": "fF1BZ9eAf5RxXXos9/30RKhbSr8=", + "path": "github.com/awslabs/goformation/cloudformation", + "revision": "d42502ef32a8892bf380256e2f57c6f69190d802", + "revisionTime": "2018-09-16T20:29:49Z", + "version": "1.2.2", + "versionExact": "1.2.2" + }, + { + "checksumSHA1": "iAlvZoyOROLal7D0Zh8K32bQJwE=", + "path": "github.com/awslabs/goformation/intrinsics", + "revision": "d42502ef32a8892bf380256e2f57c6f69190d802", + "revisionTime": "2018-09-16T20:29:49Z", + "version": "1.2.2", + "versionExact": "1.2.2" + }, { "checksumSHA1": "al43W4TWRdznwfxOWp4egKcL39c=", "path": "github.com/bsm/sarama-cluster", @@ -1146,6 +1450,12 @@ "revision": "d520615e531a6bf3fb69406b9eba718261285ec8", "revisionTime": "2016-12-05T14:13:22Z" }, + { + "checksumSHA1": "3LWNcQT7yTaLpEmjhI/3fi8puv0=", + "path": "github.com/imdario/mergo", + "revision": "9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4", + "revisionTime": "2018-07-30T21:26:40Z" + }, { "checksumSHA1": "40vJyUB4ezQSn/NSadsKEOrudMc=", "path": "github.com/inconshreveable/mousetrap", @@ -1164,6 +1474,14 @@ "revision": "633285ba52b2a67b98a3026eb87ee1a76ab60f3c", "revisionTime": "2018-07-16T14:52:14Z" }, + { + "checksumSHA1": "9dPHJ2IqSJok9bKZ6btWALYE/pA=", + "path": "github.com/jmespath/go-jmespath", + "revision": "3433f3ea46d9f8019119e7dd41274e112a2359a9", + "revisionTime": "2015-11-17T17:58:22Z", + "version": "0.2.2", + "versionExact": "0.2.2" + }, { "checksumSHA1": "l9wW52CYGbmO/NGwYZ/Op2QTmaA=", "path": "github.com/joeshaw/multierror", @@ -1403,6 +1721,20 @@ "revision": "2187045faa54fce7f5028706ffeb2f2fc342aa7e", "revisionTime": "2014-05-22T04:34:39Z" }, + { + "checksumSHA1": "SjPjmaPGaIWKtmvyv6cJ7Fdzy50=", + "path": "github.com/sanathkr/go-yaml", + "revision": "ed9d249f429b3f5a69f80a7abef6bfce81fef894", + "revisionTime": "2017-08-19T19:51:28Z", + "version": "v2", + "versionExact": "v2" + }, + { + "checksumSHA1": "owQ87BVbqaio1VTCXy6hnD68Cxo=", + "path": "github.com/sanathkr/yaml", + "revision": "0056894fa522748ca336761ffeeeb6bbae654d07", + "revisionTime": "2017-08-19T20:10:35Z" + }, { "checksumSHA1": "wZ7Q/3JyIlVKeYVqRUGh1zuLa9E=", "path": "github.com/shirou/gopsutil", diff --git a/x-pack/functionbeat/.gitignore b/x-pack/functionbeat/.gitignore new file mode 100644 index 000000000000..e89322a26571 --- /dev/null +++ b/x-pack/functionbeat/.gitignore @@ -0,0 +1,10 @@ +.idea +.vagrant +.vscode +/*/_meta/kibana.generated +functionbeat +functionbeat.test +build +data +logs +./fields.yml diff --git a/x-pack/functionbeat/Dockerfile b/x-pack/functionbeat/Dockerfile new file mode 100644 index 000000000000..b34fa982756c --- /dev/null +++ b/x-pack/functionbeat/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.10.3 +MAINTAINER Pier-Hugues Pellerin + +RUN set -x && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + netcat python-pip rsync virtualenv && \ + apt-get clean + +RUN pip install --upgrade setuptools + +# Setup work environment +ENV FUNCTIONBEAT_PATH /go/src/github.com/elastic/beats/x-pack/functionbeat + +RUN mkdir -p $FUNCTIONBEAT_PATH/build/coverage +WORKDIR $FUNCTIONBEAT_PATH diff --git a/x-pack/functionbeat/Makefile b/x-pack/functionbeat/Makefile new file mode 100644 index 000000000000..876f451476c4 --- /dev/null +++ b/x-pack/functionbeat/Makefile @@ -0,0 +1,22 @@ +BEAT_NAME?=functionbeat +LICENSE=Elastic +BEAT_TITLE?=Functionbeat +SYSTEM_TESTS?=true +BEAT_PATH?=github.com/elastic/beats/x-pack/${BEAT_NAME} +TEST_ENVIRONMENT?=true +GOX_FLAGS=-arch="amd64 386 arm ppc64 ppc64le" +ES_BEATS?=../../ +FIELDS_FILE_PATH=module +XPACK_ONLY?=true + +# Path to the libbeat Makefile +include $(ES_BEATS)/libbeat/scripts/Makefile + +# Runs all collection steps and updates afterwards +.PHONY: collect +collect: + +# Generate an artifact to be push on serverless provider. +.PHONY: linux +linux: + GOOS=linux go build -o pkg/functionbeat diff --git a/x-pack/functionbeat/_meta/beat.reference.yml b/x-pack/functionbeat/_meta/beat.reference.yml new file mode 100644 index 000000000000..e29d6061d8b8 --- /dev/null +++ b/x-pack/functionbeat/_meta/beat.reference.yml @@ -0,0 +1,94 @@ +########################## Functionbeat Configuration ########################### + +# This file is a full configuration example documenting all non-deprecated +# options in comments. For a shorter configuration example, that contains only +# the most common options, please see functionbeat.yml in the same directory. +# +# You can find the full configuration reference here: +# https://www.elastic.co/guide/en/beats/functionbeat/index.html +# +#============================ Provider =============================== +# Configure functions to run on AWS Lambda, currently we assume that the credentials +# are present in the environment to correctly create the function when using the CLI. +# +# Configure which S3 bucket we should upload the lambda artifact. +functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy" + +functionbeat.provider.aws.functions: + # Define the list of function availables, each function required to have a unique name. + # Create a function that accepts events coming from cloudwatchlogs. + - name: cloudwatch + enabled: false + type: cloudwatch_logs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for cloudwatch logs" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - log_group_name: /aws/lambda/functionbeat-cloudwatch + #filter_pattern: mylog_ + + # Define custom processors for this function. + #processors: + # - dissect: + # tokenizer: "%{key1} %{key2}" + + # Create a function that accepts events from SQS queues. + - name: sqs + enabled: false + type: sqs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for sqs events" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - event_source_arn: arn:aws:sqs:us-east-1:xxxxx:myevents + + # Define custom processors for this function. + #processors: + # - decode_json_fields: + # fields: ["message"] + # process_array: false + # max_depth: 1 + # target: "" + # overwrite_keys: false diff --git a/x-pack/functionbeat/_meta/beat.yml b/x-pack/functionbeat/_meta/beat.yml new file mode 100644 index 000000000000..a57bc650f710 --- /dev/null +++ b/x-pack/functionbeat/_meta/beat.yml @@ -0,0 +1,88 @@ +###################### Functionbeat Configuration Example ####################### + +# This file is an example configuration file highlighting only the most common +# options. The functionbeat.reference.yml file from the same directory contains all the +# supported options with more comments. You can use it as a reference. +# +# You can find the full configuration reference here: +# https://www.elastic.co/guide/en/beats/functionbeat/index.html +# + +#============================ Provider =============================== +# Configure functions to run on AWS Lambda, currently we assume that the credentials +# are present in the environment to correctly create the function when using the CLI. +# +functionbeat.provider.aws.functions: + # Define the list of function availables, each function required to have a unique name. + # Create a function that accepts events coming from cloudwatchlogs. + - name: fn_cloudwatch_logs + enabled: false + type: cloudwatch_logs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for cloudwatch logs" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - log_group_name: /aws/lambda/functionbeat-cloudwatch_logs + filter_pattern: mylog_ + + # Define custom processors for this function. + #processors: + # - dissect: + # tokenizer: "%{key1} %{key2}" + + # Create a function that accepts events from SQS queues. + - name: sqs + enabled: false + type: sqs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for SQS events" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # Define custom processors for this function. + #processors: + # - decode_json_fields: + # fields: ["message"] + # process_array: false + # max_depth: 1 + # target: "" + # overwrite_keys: false diff --git a/x-pack/functionbeat/_meta/fields.yml b/x-pack/functionbeat/_meta/fields.yml new file mode 100644 index 000000000000..a150a420e350 --- /dev/null +++ b/x-pack/functionbeat/_meta/fields.yml @@ -0,0 +1,4 @@ +- key: functionbeat + title: Functionbeat + description: + fields: diff --git a/x-pack/functionbeat/beater/functionbeat.go b/x-pack/functionbeat/beater/functionbeat.go new file mode 100644 index 000000000000..61b61cf03442 --- /dev/null +++ b/x-pack/functionbeat/beater/functionbeat.go @@ -0,0 +1,164 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package beater + +import ( + "context" + "fmt" + "os" + "strings" + "time" + + "github.com/pkg/errors" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/libbeat/processors" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/core" + _ "github.com/elastic/beats/x-pack/functionbeat/include" // imports features + "github.com/elastic/beats/x-pack/functionbeat/licenser" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +var ( + graceDelay = 45 * time.Minute + refreshDelay = 15 * time.Minute +) + +// Functionbeat is a beat designed to run under a serverless environment and listen to external triggers, +// each invocation will generate one or more events to Elasticsearch. +// +// Each serverless implementation is different but functionbeat follows a few execution rules. +// - Publishing events from the source to the output is done synchronously. +// - Execution can be suspended. +// - Run on a read only filesystem +// - More execution constraints based on speed and memory usage. +type Functionbeat struct { + ctx context.Context + log *logp.Logger + cancel context.CancelFunc + Provider provider.Provider + Config *config.Config +} + +// New creates an instance of functionbeat. +func New(b *beat.Beat, cfg *common.Config) (beat.Beater, error) { + c := &config.DefaultConfig + if err := cfg.Unpack(c); err != nil { + return nil, fmt.Errorf("error reading config file: %+v", err) + } + + provider, err := provider.NewProvider(c) + if err != nil { + return nil, err + } + ctx, cancel := context.WithCancel(context.Background()) + + bt := &Functionbeat{ + ctx: ctx, + cancel: cancel, + log: logp.NewLogger("functionbeat"), + Provider: provider, + Config: c, + } + return bt, nil +} + +// Run starts functionbeat. +func (bt *Functionbeat) Run(b *beat.Beat) error { + defer bt.cancel() + bt.log.Info("Functionbeat is running") + defer bt.log.Info("Functionbeat stopped running") + + manager, err := licenser.Create(&b.Config.Output, refreshDelay, graceDelay) + if err != nil { + return errors.Wrap(err, "could not create the license manager") + } + manager.Start() + defer manager.Stop() + + // Wait until we receive the initial license. + if err := licenser.WaitForLicense(bt.ctx, bt.log, manager, checkLicense); err != nil { + return err + } + + clientFactory := makeClientFactory(bt.log, manager, b.Publisher) + + enabledFunctions := bt.enabledFunctions() + bt.log.Infof("Functionbeat is configuring enabled functions: %s", strings.Join(enabledFunctions, ", ")) + // Create a client per function and wrap them into a runnable function by the coordinator. + functions, err := bt.Provider.CreateFunctions(clientFactory, enabledFunctions) + if err != nil { + return fmt.Errorf("error when creating the functions, error: %+v", err) + } + + // manages the goroutine related to the function handlers, if an error occurs and its not handled + // by the function itself, it will reach the coordinator, we log the error and shutdown beats. + // When an error reach the coordinator we assume that we cannot recover from it and we initiate + // a shutdown and return an aggregated errors. + coordinator := core.NewCoordinator(logp.NewLogger("coordinator"), functions...) + err = coordinator.Run(bt.ctx) + if err != nil { + return err + } + return nil +} + +func (bt *Functionbeat) enabledFunctions() (values []string) { + raw, found := os.LookupEnv("ENABLED_FUNCTIONS") + if !found { + return values + } + return strings.Split(raw, ",") +} + +// Stop stops functionbeat. +func (bt *Functionbeat) Stop() { + bt.log.Info("Functionbeat is stopping") + defer bt.log.Info("Functionbeat is stopped") + bt.cancel() +} + +func makeClientFactory(log *logp.Logger, manager *licenser.Manager, pipeline beat.Pipeline) func(*common.Config) (core.Client, error) { + // Each function has his own client to the publisher pipeline, + // publish operation will block the calling thread, when the method unwrap we have received the + // ACK for the batch. + return func(cfg *common.Config) (core.Client, error) { + c := struct { + Processors processors.PluginConfig `config:"processors"` + common.EventMetadata `config:",inline"` // Fields and tags to add to events. + }{} + + if err := cfg.Unpack(&c); err != nil { + return nil, err + } + + processors, err := processors.New(c.Processors) + if err != nil { + return nil, err + } + + client, err := core.NewSyncClient(log, pipeline, beat.ClientConfig{ + PublishMode: beat.GuaranteedSend, + Processor: processors, + EventMetadata: c.EventMetadata, + }) + + if err != nil { + return nil, err + } + + // Make the client aware of the current license, the client will accept sending events to the + // pipeline until the client is closed or if the license change and is not valid. + licenseAware := core.NewLicenseAwareClient(client, checkLicense) + if err := manager.AddWatcher(licenseAware); err != nil { + return nil, err + } + + return licenseAware, nil + } +} diff --git a/x-pack/functionbeat/beater/license.go b/x-pack/functionbeat/beater/license.go new file mode 100644 index 000000000000..1294a9331c42 --- /dev/null +++ b/x-pack/functionbeat/beater/license.go @@ -0,0 +1,14 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package beater + +import ( + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/licenser" +) + +func checkLicense(log *logp.Logger, license licenser.License) bool { + return licenser.CheckBasic(log, license) || licenser.CheckTrial(log, license) +} diff --git a/x-pack/functionbeat/cmd/cli_handler.go b/x-pack/functionbeat/cmd/cli_handler.go new file mode 100644 index 000000000000..c84d6ba3d13c --- /dev/null +++ b/x-pack/functionbeat/cmd/cli_handler.go @@ -0,0 +1,131 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package cmd + +import ( + "errors" + "fmt" + "io" + "io/ioutil" + "strings" + + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +// Errors generated by the cliHandler. +var ( + errNoFunctionGiven = errors.New("no function given") +) + +// cliHandler takes a provider.CLIManager and acts a bridge between user enterred content from the CLI +// and the type managing the function on the provider. It allow to specify multiple functions at +// the command line but will do a single invocation on the CLIManager and will do general validation +// and normalization of the values. It also communicate the status of the operations to the user. +// +// NOTES: Each execution call of the CLIManager are independant, this mean that a fail call will not +// stop other calls to succeed. +// +// TODO(ph) functions could be merged into a single call , but I thought it was premature to do +// it. +type cliHandler struct { + cli provider.CLIManager + log *logp.Logger + errOutput io.Writer + output io.Writer +} + +func newCLIHandler(cli provider.CLIManager, errOutput io.Writer, output io.Writer) *cliHandler { + return &cliHandler{cli: cli, errOutput: errOutput, output: output, log: logp.NewLogger("cli-handler")} +} + +func (c *cliHandler) Deploy(names []string) error { + c.log.Debugf("Starting deploy for: %s", strings.Join(names, ", ")) + defer c.log.Debug("Deploy execution ended") + + if len(names) == 0 { + return errNoFunctionGiven + } + + errCount := 0 + for _, name := range names { + if err := c.cli.Deploy(name); err != nil { + fmt.Fprintf(c.errOutput, "Function: %s, could not deploy, error: %s\n", name, err) + errCount++ + continue + } + fmt.Fprintf(c.output, "Function: %s, deploy successful\n", name) + } + + if errCount > 0 { + return fmt.Errorf("Fail to deploy %d function(s)", errCount) + } + return nil +} + +func (c *cliHandler) Update(names []string) error { + c.log.Debugf("Starting update for: %s", strings.Join(names, ", ")) + defer c.log.Debug("Update execution ended") + + if len(names) == 0 { + return errNoFunctionGiven + } + + errCount := 0 + for _, name := range names { + if err := c.cli.Update(name); err != nil { + fmt.Fprintf(c.errOutput, "Function: %s, could not update, error: %s\n", name, err) + errCount++ + continue + } + fmt.Fprintf(c.output, "Function: %s, update successful\n", name) + } + + if errCount > 0 { + return fmt.Errorf("fail to deploy %d function(s)", errCount) + } + return nil +} + +func (c *cliHandler) Remove(names []string) error { + c.log.Debugf("Starting remove for: %s", strings.Join(names, ", ")) + defer c.log.Debug("Remove execution ended") + + if len(names) == 0 { + return errNoFunctionGiven + } + + errCount := 0 + for _, name := range names { + if err := c.cli.Remove(name); err != nil { + fmt.Fprintf(c.errOutput, "Function: %s, could not remove, error: %s\n", name, err) + errCount++ + continue + } + fmt.Fprintf(c.output, "Function: %s, remove successful\n", name) + } + + if errCount > 0 { + return fmt.Errorf("fail to remove %d function(s)", errCount) + } + return nil +} + +// TODO(ph) check current path and option flag for cobra +func (c *cliHandler) BuildPackage(output string) error { + content, err := core.MakeZip() + if err != nil { + return err + } + + err = ioutil.WriteFile(output, content, 0644) + if err != nil { + return err + } + + fmt.Fprintf(c.output, "Generated package at: %s\n", output) + return nil +} diff --git a/x-pack/functionbeat/cmd/cli_handler_test.go b/x-pack/functionbeat/cmd/cli_handler_test.go new file mode 100644 index 000000000000..c0918ce41cee --- /dev/null +++ b/x-pack/functionbeat/cmd/cli_handler_test.go @@ -0,0 +1,136 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package cmd + +import ( + "bytes" + "errors" + "io" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +type mockCLIManager struct { + mock.Mock +} + +func (m *mockCLIManager) Deploy(name string) error { + args := m.Called(name) + return args.Error(0) +} + +func (m *mockCLIManager) Update(name string) error { + args := m.Called(name) + return args.Error(0) +} + +func (m *mockCLIManager) Remove(name string) error { + args := m.Called(name) + return args.Error(0) +} + +func outputs() (io.Writer, io.Writer) { + errOut := new(bytes.Buffer) + output := new(bytes.Buffer) + return errOut, output +} + +func TestCliHandler(t *testing.T) { + t.Run("deploy", testDeploy) + t.Run("update", testUpdate) + t.Run("remove", testRemove) +} + +func testDeploy(t *testing.T) { + t.Run("return error when no functions are specified", func(t *testing.T) { + errOut, output := outputs() + handler := newCLIHandler(&mockCLIManager{}, errOut, output) + err := handler.Deploy([]string{}) + assert.Equal(t, errNoFunctionGiven, err) + }) + + t.Run("return an error if the manager return an error", func(t *testing.T) { + errOut, output := outputs() + myErr := errors.New("my error") + m := &mockCLIManager{} + m.On("Deploy", "saiyajin").Return(myErr) + handler := newCLIHandler(m, errOut, output) + err := handler.Deploy([]string{"saiyajin"}) + assert.Error(t, err) + }) + + t.Run("call the method for all the functions", func(t *testing.T) { + errOut, output := outputs() + m := &mockCLIManager{} + m.On("Deploy", "super").Return(nil) + m.On("Deploy", "saiyajin").Return(nil) + handler := newCLIHandler(m, errOut, output) + err := handler.Deploy([]string{"super", "saiyajin"}) + assert.NoError(t, err) + m.AssertExpectations(t) + }) +} + +func testUpdate(t *testing.T) { + t.Run("return error when no functions are specified", func(t *testing.T) { + errOut, output := outputs() + handler := newCLIHandler(&mockCLIManager{}, errOut, output) + err := handler.Update([]string{}) + assert.Equal(t, errNoFunctionGiven, err) + }) + + t.Run("return an error if the manager return an error", func(t *testing.T) { + errOut, output := outputs() + myErr := errors.New("my error") + m := &mockCLIManager{} + m.On("Update", "saiyajin").Return(myErr) + handler := newCLIHandler(m, errOut, output) + err := handler.Update([]string{"saiyajin"}) + assert.Error(t, err) + }) + + t.Run("call the method for all the functions", func(t *testing.T) { + errOut, output := outputs() + m := &mockCLIManager{} + m.On("Update", "super").Return(nil) + m.On("Update", "saiyajin").Return(nil) + handler := newCLIHandler(m, errOut, output) + err := handler.Update([]string{"super", "saiyajin"}) + assert.NoError(t, err) + m.AssertExpectations(t) + }) +} + +func testRemove(t *testing.T) { + t.Run("return error when no functions are specified", func(t *testing.T) { + errOut, output := outputs() + handler := newCLIHandler(&mockCLIManager{}, errOut, output) + err := handler.Remove([]string{}) + assert.Equal(t, errNoFunctionGiven, err) + }) + + t.Run("return an error if the manager return an error", func(t *testing.T) { + errOut, output := outputs() + myErr := errors.New("my error") + m := &mockCLIManager{} + m.On("Remove", "saiyajin").Return(myErr) + handler := newCLIHandler(m, errOut, output) + err := handler.Remove([]string{"saiyajin"}) + assert.Error(t, err) + }) + + t.Run("call the method for all the functions", func(t *testing.T) { + errOut, output := outputs() + m := &mockCLIManager{} + m.On("Remove", "super").Return(nil) + m.On("Remove", "saiyajin").Return(nil) + handler := newCLIHandler(m, errOut, output) + err := handler.Remove([]string{"super", "saiyajin"}) + assert.NoError(t, err) + m.AssertExpectations(t) + }) +} diff --git a/x-pack/functionbeat/cmd/provider_cmd.go b/x-pack/functionbeat/cmd/provider_cmd.go new file mode 100644 index 000000000000..a519160f75b5 --- /dev/null +++ b/x-pack/functionbeat/cmd/provider_cmd.go @@ -0,0 +1,105 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package cmd + +import ( + "os" + "path/filepath" + + "github.com/spf13/cobra" + + "github.com/elastic/beats/libbeat/cmd/instance" + "github.com/elastic/beats/libbeat/common/cli" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +var output string + +// TODO: Add List() subcommand. +func handler() (*cliHandler, error) { + b, err := instance.NewBeat(Name, "", "") + if err != nil { + return nil, err + } + + if err = b.Init(); err != nil { + return nil, err + } + + c, err := b.BeatConfig() + if err != nil { + return nil, err + } + + cfg := &config.DefaultConfig + if err := c.Unpack(cfg); err != nil { + return nil, err + } + + provider, err := provider.NewProvider(cfg) + if err != nil { + return nil, err + } + + cli, err := provider.CLIManager() + if err != nil { + return nil, err + } + handler := newCLIHandler(cli, os.Stdout, os.Stderr) + return handler, nil +} + +func genCLICmd(use, short string, fn func(*cliHandler, []string) error) *cobra.Command { + return &cobra.Command{ + Use: use, + Short: short, + Run: cli.RunWith(func(_ *cobra.Command, args []string) error { + h, err := handler() + if err != nil { + return err + } + return fn(h, args) + }), + } +} + +func genDeployCmd() *cobra.Command { + return genCLICmd("deploy", "Deploy a function", (*cliHandler).Deploy) +} + +func genUpdateCmd() *cobra.Command { + return genCLICmd("update", "Update a function", (*cliHandler).Update) +} + +func genRemoveCmd() *cobra.Command { + return genCLICmd("remove", "Remove a function", (*cliHandler).Remove) +} + +func genPackageCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "package", + Short: "Package the configuration and the executable in a zip", + Run: cli.RunWith(func(cmd *cobra.Command, args []string) error { + h, err := handler() + if err != nil { + return err + } + + if len(output) == 0 { + dir, err := os.Getwd() + if err != nil { + return err + } + + output = filepath.Join(dir, "package.zip") + } + + return h.BuildPackage(output) + }), + } + cmd.Flags().StringVarP(&output, "output", "o", "", "full path to the package") + return cmd +} diff --git a/x-pack/functionbeat/cmd/root.go b/x-pack/functionbeat/cmd/root.go new file mode 100644 index 000000000000..043e303fb815 --- /dev/null +++ b/x-pack/functionbeat/cmd/root.go @@ -0,0 +1,30 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package cmd + +import ( + cmd "github.com/elastic/beats/libbeat/cmd" + "github.com/elastic/beats/libbeat/cmd/instance" + "github.com/elastic/beats/x-pack/functionbeat/beater" + "github.com/elastic/beats/x-pack/functionbeat/config" +) + +// Name of this beat +var Name = "functionbeat" + +// RootCmd to handle functionbeat +var RootCmd *cmd.BeatsRootCmd + +func init() { + RootCmd = cmd.GenRootCmdWithSettings(beater.New, instance.Settings{ + Name: Name, + ConfigOverrides: config.ConfigOverrides, + }) + + RootCmd.AddCommand(genDeployCmd()) + RootCmd.AddCommand(genUpdateCmd()) + RootCmd.AddCommand(genRemoveCmd()) + RootCmd.AddCommand(genPackageCmd()) +} diff --git a/x-pack/functionbeat/config/config.go b/x-pack/functionbeat/config/config.go new file mode 100644 index 000000000000..56796546bcc9 --- /dev/null +++ b/x-pack/functionbeat/config/config.go @@ -0,0 +1,98 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Config is put into a different package to prevent cyclic imports in case +// it is needed in several locations + +package config + +import ( + "fmt" + "regexp" + + "github.com/elastic/beats/libbeat/common" +) + +var ( + functionPattern = "^[A-Za-z][A-Za-z0-9\\-]{0,139}$" + functionRE = regexp.MustCompile(functionPattern) +) + +// ConfigOverrides overrides the defaults provided by libbeat. +var ConfigOverrides = common.MustNewConfigFrom(map[string]interface{}{ + "path.data": "/tmp", + "path.logs": "/tmp/logs", + "logging.to_stderr": true, + "logging.to_files": false, + "logging.level": "debug", + "setup.template.enabled": true, + "queue.mem": map[string]interface{}{ + "events": "${output.elasticsearch.bulk_max_size}", + "flush.min_events": 10, + "flush.timeout": "0.01s", + }, + "output.elasticsearch.bulk_max_size": 50, +}) + +// Config default configuration for Functionbeat. +type Config struct { + Provider *common.ConfigNamespace `config:"provider" validate:"required"` +} + +// ProviderConfig is a generic configured used by providers. +type ProviderConfig struct { + Functions []*common.Config `config:"functions"` +} + +// FunctionConfig minimal configuration from each function. +type FunctionConfig struct { + Type string `config:"type"` + Name functionName `config:"name"` + Enabled bool `config:"enabled"` +} + +// DefaultConfig is the default configuration for Functionbeat. +var DefaultConfig = Config{} + +// DefaultFunctionConfig is the default configuration for new function. +var DefaultFunctionConfig = FunctionConfig{ + Enabled: true, +} + +type functionName string + +func (f *functionName) Unpack(s string) error { + if !functionRE.MatchString(s) { + return fmt.Errorf( + "invalid name: '%s', name must match [a-zA-Z0-9-] and be at most 140 characters", + s, + ) + } + *f = functionName(s) + return nil +} + +func (f *functionName) String() string { + return string(*f) +} + +// Validate enforces that function names are unique. +func (p *ProviderConfig) Validate() error { + names := make(map[functionName]bool) + for _, rawfn := range p.Functions { + fc := FunctionConfig{} + rawfn.Unpack(&fc) + + if !fc.Enabled { + return nil + } + + if _, found := names[fc.Name]; found { + return fmt.Errorf("function name '%s' already exist, name must be unique", fc.Name) + } + + names[fc.Name] = true + } + return nil +} diff --git a/x-pack/functionbeat/config/config_test.go b/x-pack/functionbeat/config/config_test.go new file mode 100644 index 000000000000..fb616b9af10e --- /dev/null +++ b/x-pack/functionbeat/config/config_test.go @@ -0,0 +1,110 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package config + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" +) + +func TestNameMustBeUnique(t *testing.T) { + tests := []struct { + name string + v map[string]interface{} + err bool + }{ + { + name: "not unique names", + err: true, + v: map[string]interface{}{ + "functions": []map[string]interface{}{ + map[string]interface{}{ + "enabled": true, + "type": "cloudwatchlogs", + "name": "ok", + }, + map[string]interface{}{ + "enabled": true, + "type": "cloudwatchlogs", + "name": "ok", + }, + }, + }, + }, + { + name: "not unique names but duplicate is disabled", + err: false, + v: map[string]interface{}{ + "functions": []map[string]interface{}{ + map[string]interface{}{ + "enabled": true, + "type": "cloudwatchlogs", + "name": "ok", + }, + map[string]interface{}{ + "enabled": false, + "type": "cloudwatchlogs", + "name": "ok", + }, + }, + }, + }, + { + name: "name are uniques", + err: false, + v: map[string]interface{}{ + "functions": []map[string]interface{}{ + map[string]interface{}{ + "enabled": true, + "type": "cloudwatchlogs", + "name": "ok", + }, + map[string]interface{}{ + "enabled": true, + "type": "cloudwatchlogs", + "name": "another", + }, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + cfg, err := common.NewConfigFrom(test.v) + if !assert.NoError(t, err) { + return + } + provider := ProviderConfig{} + + err = cfg.Unpack(&provider) + if test.err == true { + assert.Error(t, err) + return + } + assert.NoError(t, err) + }) + } +} + +func TestFunctionName(t *testing.T) { + t.Run("valid function name", func(t *testing.T) { + f := functionName("") + err := f.Unpack("hello-world") + if !assert.NoError(t, err) { + return + } + assert.Equal(t, functionName("hello-world"), f) + }) + + t.Run("invalid function name", func(t *testing.T) { + f := functionName("") + err := f.Unpack("hello world") + assert.Error(t, err) + }) +} diff --git a/x-pack/functionbeat/core/bundle/bundle.go b/x-pack/functionbeat/core/bundle/bundle.go new file mode 100644 index 000000000000..f55b109d3aa6 --- /dev/null +++ b/x-pack/functionbeat/core/bundle/bundle.go @@ -0,0 +1,196 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package bundle + +import ( + "archive/zip" + "bufio" + "bytes" + "errors" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" +) + +// ReadCloserWith takes a reader and a closer for the specific reader and return an io.ReaderCloser. +func ReadCloserWith(reader io.Reader, closer io.Closer) io.ReadCloser { + return &ReadCloser{reader: reader, closer: closer} +} + +// ReadCloser wraps a io.Reader and a file handle into a FileReadCloser interface, +// this leave the responsability on the consumer to close the handle when its done consuming the +// io.Reader. +type ReadCloser struct { + reader io.Reader + closer io.Closer +} + +// Read proxies the Read to the original io.Reader. +func (f *ReadCloser) Read(p []byte) (int, error) { + return f.reader.Read(p) +} + +// Close closes the file handle this must be called after consuming the io.Reader to make sure we +// don't leak any file handle. +func (f *ReadCloser) Close() error { + return f.closer.Close() +} + +// Resource is the interface used to bundle the resource, a resource can be a local or a remote file. +// Reader must be a io.ReadCloser, this make it easier to deal with streaming of remote data. +type Resource interface { + // Open return an io.ReadCloser of the original resource, this will be used to stream content to + // The compressed file. + Open() (io.ReadCloser, error) + + // Name return the string that will be used as the file name inside the Zip file. + Name() string + + // Mode returns the permission of the file. + Mode() os.FileMode +} + +// LocalFile represents a local file on disk. +type LocalFile struct { + Path string + FileMode os.FileMode +} + +// Open return a reader for the opened file. +func (l *LocalFile) Open() (io.ReadCloser, error) { + fd, err := os.Open(l.Path) + if err != nil { + return nil, err + } + + reader := bufio.NewReader(fd) + return ReadCloserWith(reader, fd), nil +} + +// Name return the basename of the file to be used as the name of the file in the archive. +func (l *LocalFile) Name() string { + return filepath.Base(l.Path) +} + +// Mode return the permissions of the file in the zip. +func (l *LocalFile) Mode() os.FileMode { + return l.FileMode +} + +// MemoryFile an in-memory representation of a physical file. +type MemoryFile struct { + Path string + FileMode os.FileMode + Raw []byte +} + +// Open the reader for the raw byte slice. +func (m *MemoryFile) Open() (io.ReadCloser, error) { + reader := bytes.NewReader(m.Raw) + return ioutil.NopCloser(reader), nil +} + +// Name returns the path to use in the zip. +func (m *MemoryFile) Name() string { + return m.Path +} + +// Mode returns the permission of the file. +func (m *MemoryFile) Mode() os.FileMode { + return m.FileMode +} + +// ZipBundle accepts a set of local files to bundle them into a zip file, it also accept size limits +// for the uncompressed and the compressed data. +type ZipBundle struct { + resources []Resource + maxSizeUncompressed int64 + maxSizeCompressed int64 +} + +// NewZipWithoutLimits creates a bundle that doesn't impose any limit on the uncompressed data and the +// compressed data. +func NewZipWithoutLimits(resources ...Resource) *ZipBundle { + return NewZipWithLimits(-1, -1, resources...) +} + +// NewZipWithLimits creates a Bundle that impose limit for the uncompressed data and the compressed data, +// using a limit of -1 with desactivate the check. +func NewZipWithLimits(maxSizeUncompressed, maxSizeCompressed int64, resources ...Resource) *ZipBundle { + return &ZipBundle{ + resources: resources, + maxSizeUncompressed: maxSizeUncompressed, + maxSizeCompressed: maxSizeCompressed, + } +} + +// Bytes takes the resources and bundle them into a zip and validates if needed that the +// created resources doesn't go over any predefined size limits. +func (p *ZipBundle) Bytes() ([]byte, error) { + buf := new(bytes.Buffer) + zipWriter := zip.NewWriter(buf) + + var uncompressed int64 + for _, file := range p.resources { + r, err := file.Open() + if err != nil { + return nil, err + } + defer r.Close() + + header := &zip.FileHeader{ + Name: file.Name(), + Method: zip.Deflate, + } + + header.SetMode(file.Mode()) + w, err := zipWriter.CreateHeader(header) + if err != nil { + return nil, err + } + + l, err := io.Copy(w, r) + if err != nil { + return nil, err + } + + uncompressed = uncompressed + l + if p.maxSizeUncompressed != -1 && uncompressed > p.maxSizeUncompressed { + // Close the current zip, the zip has incomplete data. + zipWriter.Close() + return nil, fmt.Errorf( + "max uncompressed size reached, size %d, limit is %d", + uncompressed, + p.maxSizeUncompressed, + ) + } + + if l == 0 { + return nil, errors.New("no bytes written to the zip file") + } + + // Force a flush to accurately check for the size of the bytes.Buffer and see if + // we are over the limit. + if err := zipWriter.Flush(); err != nil { + return nil, err + } + + if p.maxSizeCompressed != -1 && int64(buf.Len()) > p.maxSizeCompressed { + // Close the current zip, the zip has incomplete data. + zipWriter.Close() + return nil, fmt.Errorf( + "max compressed size reached, size %d, limit is %d", + buf.Len(), + p.maxSizeCompressed, + ) + } + } + + // Flush bytes/writes headers, the zip is valid at this point. + zipWriter.Close() + return buf.Bytes(), nil +} diff --git a/x-pack/functionbeat/core/bundle/bundle_test.go b/x-pack/functionbeat/core/bundle/bundle_test.go new file mode 100644 index 000000000000..0aae4e7f8e6f --- /dev/null +++ b/x-pack/functionbeat/core/bundle/bundle_test.go @@ -0,0 +1,150 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package bundle + +import ( + "archive/zip" + "bytes" + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" +) + +func newFixedResource(name string, length int64) *MemoryFile { + paddingData, err := common.RandomBytes(int(length)) + if err != nil { + // fatal, This mean something is wrong with the random number generator. + panic(err) + } + return &MemoryFile{Path: name, Raw: paddingData, FileMode: 0755} +} + +func TestZipBundle(t *testing.T) { + t.Run("with limits", testWithLimits) + t.Run("with no limits", testArtifact(-1, -1)) +} + +func testWithLimits(t *testing.T) { + t.Run("uncompressed size is over limit", func(t *testing.T) { + limit := int64(50) + bundle := NewZipWithLimits(limit, -1, newFixedResource("ok.yml", limit+1)) + _, err := bundle.Bytes() + assert.Error(t, err) + }) + + t.Run("compressed size is over limit", func(t *testing.T) { + limit := int64(10) + bundle := NewZipWithLimits(-1, limit, newFixedResource("ok.yml", 2*limit)) + _, err := bundle.Bytes() + assert.Error(t, err) + }) + + t.Run("zip artifact is under limit and valid", testArtifact(1000, 1000)) +} + +func testArtifact(maxSizeUncompressed, maxSizeCompressed int64) func(t *testing.T) { + return func(t *testing.T) { + m := map[string]*MemoryFile{ + "f1.txt": newFixedResource("f1.txt", 65), + "f2.txt": newFixedResource("f2.txt", 100), + } + + resources := make([]Resource, len(m)) + var idx int + for _, r := range m { + resources[idx] = r + idx++ + } + + bundle := NewZipWithLimits(maxSizeUncompressed, maxSizeCompressed, resources...) + b, err := bundle.Bytes() + if !assert.NoError(t, err) { + return + } + + zip, err := zip.NewReader(bytes.NewReader(b), int64(len(b))) + if !assert.NoError(t, err) { + return + } + + if !assert.Equal(t, 2, len(zip.File)) { + return + } + + for _, file := range zip.File { + r, ok := m[file.Name] + if !assert.True(t, ok) { + t.Fatal("unknown file present in the zip") + } + + reader, err := file.Open() + if !assert.NoError(t, err) { + return + } + defer reader.Close() + + raw, err := ioutil.ReadAll(reader) + if !assert.NoError(t, err) { + return + } + + assert.True(t, bytes.Equal(r.Raw, raw), "bytes doesn't match") + } + } +} + +func TestLocalFile(t *testing.T) { + local := LocalFile{Path: "testdata/lipsum.txt", FileMode: 755} + + assert.Equal(t, "lipsum.txt", local.Name()) + assert.Equal(t, os.FileMode(755), local.Mode()) + + reader, err := local.Open() + if !assert.NoError(t, err) { + return + } + + defer func() { + err := reader.Close() + assert.NoError(t, err) + }() + + content, err := ioutil.ReadAll(reader) + if !assert.NoError(t, err) { + return + } + + raw, _ := ioutil.ReadFile("testdata/lipsum.txt") + assert.Equal(t, raw, content) +} + +func TestMemoryFile(t *testing.T) { + raw := []byte("hello world") + memory := MemoryFile{Path: "lipsum.txt", FileMode: 755, Raw: raw} + + assert.Equal(t, "lipsum.txt", memory.Name()) + assert.Equal(t, os.FileMode(755), memory.Mode()) + + reader, err := memory.Open() + if !assert.NoError(t, err) { + return + } + + defer func() { + err := reader.Close() + assert.NoError(t, err) + }() + + content, err := ioutil.ReadAll(reader) + if !assert.NoError(t, err) { + return + } + + assert.Equal(t, raw, content) +} diff --git a/x-pack/functionbeat/core/bundle/testdata/lipsum.txt b/x-pack/functionbeat/core/bundle/testdata/lipsum.txt new file mode 100644 index 000000000000..d86bac9de59a --- /dev/null +++ b/x-pack/functionbeat/core/bundle/testdata/lipsum.txt @@ -0,0 +1 @@ +OK diff --git a/x-pack/functionbeat/core/coordinator.go b/x-pack/functionbeat/core/coordinator.go new file mode 100644 index 000000000000..ef05c520760c --- /dev/null +++ b/x-pack/functionbeat/core/coordinator.go @@ -0,0 +1,96 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "context" + "fmt" + + "github.com/joeshaw/multierror" + + "github.com/elastic/beats/libbeat/logp" +) + +// Runner is the interface that the coordinator will follow to manage a function goroutine. +type Runner interface { + fmt.Stringer + Run(context.Context) error +} + +// Coordinator takes care of managing the function goroutine, it receives the list of functions that +// need to be executed and manage the goroutine. If an error happen and its not handled by the +// function, we assume its a fatal error and we will +// stop all the other goroutine and functionbeat will terminate. +type Coordinator struct { + log *logp.Logger + runners []Runner +} + +// NewCoordinator create a new coordinator objects receiving the clientFactory and the runner. +func NewCoordinator(log *logp.Logger, + runners ...Runner, +) *Coordinator { + if log == nil { + log = logp.NewLogger("") + } + log = log.Named("Coordinator") + return &Coordinator{log: log, runners: runners} +} + +// Run starts each functions into an independent goroutine and wait until all the goroutine are +// stopped to exit. +func (r *Coordinator) Run(ctx context.Context) error { + r.log.Debug("Coordinator is starting") + defer r.log.Debug("Coordinator is stopped") + + // When an errors happen in a function and its not handled by the running function, we log an error + // and we trigger a shutdown of all the others goroutine. + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + results := make(chan error) + defer close(results) + + r.log.Debugf("The coordinator is starting %d functions", len(r.runners)) + for _, rfn := range r.runners { + go func(ctx context.Context, rfn Runner) { + var err error + defer func() { results <- err }() + err = r.runFunc(ctx, rfn) + if err != nil { + cancel() + } + }(ctx, rfn) + } + + // Wait for goroutine to complete and aggregate any errors from the goroutine and + // raise them back to the main program. + var errors multierror.Errors + for range r.runners { + err := <-results + if err != nil { + errors = append(errors, err) + } + } + return errors.Err() +} + +func (r *Coordinator) runFunc( + ctx context.Context, + rfn Runner, +) error { + r.log.Infof("The function '%s' is starting", rfn.String()) + defer r.log.Infof("The function '%s' is stopped", rfn.String()) + + err := rfn.Run(ctx) + if err != nil { + r.log.Errorf( + "Nonrecoverable error when executing the function: '%s', error: '%+v', terminating all running functions", + rfn, + err, + ) + } + return err +} diff --git a/x-pack/functionbeat/core/coordinator_test.go b/x-pack/functionbeat/core/coordinator_test.go new file mode 100644 index 000000000000..b93b6884dd14 --- /dev/null +++ b/x-pack/functionbeat/core/coordinator_test.go @@ -0,0 +1,56 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/assert" +) + +var errUnhappy = errors.New("unhappy :(") + +type happyRunner struct{} + +func (hr *happyRunner) Run(ctx context.Context) error { + <-ctx.Done() + return nil +} +func (hr *happyRunner) String() string { return "happyRunner" } + +type unhappyRunner struct{} + +func (uhr *unhappyRunner) Run(ctx context.Context) error { + return errUnhappy +} + +func (uhr *unhappyRunner) String() string { return "unhappyRunner" } + +func TestStart(t *testing.T) { + t.Run("start the runner", func(t *testing.T) { + coordinator := NewCoordinator(nil, &happyRunner{}, &happyRunner{}) + ctx, cancel := context.WithCancel(context.Background()) + var err error + go func() { + err = coordinator.Run(ctx) + assert.NoError(t, err) + }() + cancel() + }) + + t.Run("on error shutdown all the runner", func(t *testing.T) { + coordinator := NewCoordinator(nil, &happyRunner{}, &unhappyRunner{}) + err := coordinator.Run(context.Background()) + assert.Error(t, err) + }) + + t.Run("aggregate all errors", func(t *testing.T) { + coordinator := NewCoordinator(nil, &unhappyRunner{}, &unhappyRunner{}) + err := coordinator.Run(context.Background()) + assert.Error(t, err) + }) +} diff --git a/x-pack/functionbeat/core/license_client.go b/x-pack/functionbeat/core/license_client.go new file mode 100644 index 000000000000..bcccc2bdf11f --- /dev/null +++ b/x-pack/functionbeat/core/license_client.go @@ -0,0 +1,73 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "errors" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common/atomic" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/licenser" +) + +var errInvalidLicense = errors.New("invalid license detected, cannot publish events") + +// LicenseAwareClient is a client that enforce a specific license, the type implements the +// `License.Watcher` interface and will need to be registered to the license manager. +// The client instance will listen to license change and make sure that the required licenses +// match the current license. +type LicenseAwareClient struct { + checks []licenser.CheckFunc + client Client + log *logp.Logger + valid atomic.Bool +} + +// NewLicenseAwareClient returns a new license aware client. +func NewLicenseAwareClient( + client Client, + checks ...licenser.CheckFunc, +) *LicenseAwareClient { + return &LicenseAwareClient{log: logp.NewLogger("license-aware-client"), checks: checks, client: client} +} + +// OnNewLicense receives a callback by the license manager when new license is available and control +// if we can send events to the client or not. +func (lac *LicenseAwareClient) OnNewLicense(license licenser.License) { + valid := licenser.Validate(lac.log, license, lac.checks...) + lac.valid.Swap(valid) +} + +// OnManagerStopped receives a callback from the license manager when the manager is stopped. +func (lac *LicenseAwareClient) OnManagerStopped() { + // NOOP but need to be implemented for the watcher interface. +} + +// PublishAll check if the license allow us to send events. +func (lac *LicenseAwareClient) PublishAll(events []beat.Event) error { + if lac.valid.Load() { + return lac.client.PublishAll(events) + } + return errInvalidLicense +} + +// Publish check if the license allow us to send events. +func (lac *LicenseAwareClient) Publish(event beat.Event) error { + if lac.valid.Load() { + return lac.client.Publish(event) + } + return errInvalidLicense +} + +// Wait proxy the Wait() call to the original client. +func (lac *LicenseAwareClient) Wait() { + lac.client.Wait() +} + +// Close proxy the Close() call to the original client. +func (lac *LicenseAwareClient) Close() error { + return lac.client.Close() +} diff --git a/x-pack/functionbeat/core/license_client_test.go b/x-pack/functionbeat/core/license_client_test.go new file mode 100644 index 000000000000..e5b90f2d0acb --- /dev/null +++ b/x-pack/functionbeat/core/license_client_test.go @@ -0,0 +1,108 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/licenser" +) + +type dummySyncClient struct{ EventCount int } + +func (dsc *dummySyncClient) Publish(event beat.Event) error { + dsc.EventCount++ + return nil +} + +func (dsc *dummySyncClient) PublishAll(events []beat.Event) error { + dsc.EventCount += len(events) + return nil +} + +func (dsc *dummySyncClient) Close() error { + return nil +} + +func (dsc *dummySyncClient) Wait() {} + +func TestLicenseAwareClient(t *testing.T) { + t.Run("publish single event", func(t *testing.T) { + testPublish(t, func(lac *LicenseAwareClient) (int, error) { + return 1, lac.Publish(beat.Event{}) + }) + }) + + t.Run("publish multiple events", func(t *testing.T) { + testPublish(t, func(lac *LicenseAwareClient) (int, error) { + return 2, lac.PublishAll([]beat.Event{beat.Event{}, beat.Event{}}) + }) + }) +} + +func testPublish(t *testing.T, publish func(lac *LicenseAwareClient) (int, error)) { + // Create strict license check. + allowBasic := func(log *logp.Logger, l licenser.License) bool { + return l.Is(licenser.Basic) + } + + allowPlatinum := func(log *logp.Logger, l licenser.License) bool { + return l.Is(licenser.Platinum) + } + + t.Run("when license is valid first check", func(t *testing.T) { + license := licenser.License{Mode: licenser.Basic} + client := &dummySyncClient{} + lac := NewLicenseAwareClient(client, allowBasic, allowPlatinum) + defer lac.Close() + lac.OnNewLicense(license) + count, err := publish(lac) + if !assert.NoError(t, err) { + return + } + assert.Equal(t, count, client.EventCount) + }) + + t.Run("when license is valid second check", func(t *testing.T) { + license := licenser.License{Mode: licenser.Platinum} + client := &dummySyncClient{} + lac := NewLicenseAwareClient(client, allowBasic, allowPlatinum) + defer lac.Close() + lac.OnNewLicense(license) + count, err := publish(lac) + if !assert.NoError(t, err) { + return + } + assert.Equal(t, count, client.EventCount) + }) + + t.Run("when license is not valid", func(t *testing.T) { + license := licenser.License{Mode: licenser.Gold} + client := &dummySyncClient{} + lac := NewLicenseAwareClient(client, allowBasic, allowPlatinum) + defer lac.Close() + lac.OnNewLicense(license) + _, err := publish(lac) + if assert.Error(t, err, errInvalidLicense) { + return + } + assert.Equal(t, 0, client.EventCount) + }) + + t.Run("license is invalid by default", func(t *testing.T) { + client := &dummySyncClient{} + lac := NewLicenseAwareClient(client, allowBasic, allowPlatinum) + defer lac.Close() + _, err := publish(lac) + if assert.Error(t, err, errInvalidLicense) { + return + } + assert.Equal(t, 0, client.EventCount) + }) +} diff --git a/x-pack/functionbeat/core/makezip.go b/x-pack/functionbeat/core/makezip.go new file mode 100644 index 000000000000..0d1a88d00d91 --- /dev/null +++ b/x-pack/functionbeat/core/makezip.go @@ -0,0 +1,58 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + yaml "gopkg.in/yaml.v2" + + "github.com/elastic/beats/libbeat/cfgfile" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/core/bundle" +) + +// Package size limits for function providers, we should be a lot under this limit but +// adding a check to make sure we never go over. +const packageCompressedLimit = 50 * 1000 * 1000 // 50MB +const packageUncompressedLimit = 250 * 1000 * 1000 // 250MB + +func rawYaml() ([]byte, error) { + // Load the configuration file from disk with all the settings, + // the function takes care of using -c. + rawConfig, err := cfgfile.Load("", config.ConfigOverrides) + if err != nil { + return nil, err + } + var config map[string]interface{} + if err := rawConfig.Unpack(&config); err != nil { + return nil, err + } + + res, err := yaml.Marshal(config) + if err != nil { + return nil, err + } + + return res, nil +} + +// MakeZip creates a zip from the the current artifacts and the currently available configuration. +func MakeZip() ([]byte, error) { + rawConfig, err := rawYaml() + if err != nil { + return nil, err + } + bundle := bundle.NewZipWithLimits( + packageUncompressedLimit, + packageCompressedLimit, + &bundle.MemoryFile{Path: "functionbeat.yml", Raw: rawConfig, FileMode: 0766}, + &bundle.LocalFile{Path: "pkg/functionbeat", FileMode: 0755}, + ) + + content, err := bundle.Bytes() + if err != nil { + return nil, err + } + return content, nil +} diff --git a/x-pack/functionbeat/core/sync_client.go b/x-pack/functionbeat/core/sync_client.go new file mode 100644 index 000000000000..1bdc8840efed --- /dev/null +++ b/x-pack/functionbeat/core/sync_client.go @@ -0,0 +1,141 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "sync" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/logp" +) + +// Client implements the interface used by all the functionbeat function, we only implement a synchronous +// client. This interface superseed the core beat.Client interface inside functionbeat because our publish +// and publishAll methods can return an error. +type Client interface { + // Publish accepts a unique events and will publish it to the pipeline. + Publish(beat.Event) error + + // PublishAll accepts a list of multiple events and will publish them to the pipeline. + PublishAll([]beat.Event) error + + // Close closes the current client, no events will be accepted, this method can block if we still + // need to ACK on events. + Close() error + + // Wait blocks until the publisher pipeline send the ACKS for all the events. + Wait() +} + +// SyncClient wraps an existing beat.Client and provide a sync interface. +type SyncClient struct { + // Chain callbacks already defined in the original ClientConfig + ackCount func(int) + ackEvents func([]interface{}) + ackLastEvent func(interface{}) + + client beat.Client + wg sync.WaitGroup + log *logp.Logger +} + +// NewSyncClient creates a new sync clients from the provided configuration, existing ACKs handlers +// defined in the configuration will be proxied by this object. +func NewSyncClient(log *logp.Logger, pipeline beat.Pipeline, cfg beat.ClientConfig) (*SyncClient, error) { + if log == nil { + log = logp.NewLogger("") + } + s := &SyncClient{log: log.Named("sync client")} + + // Proxy any callbacks to the original client. + // + // Notes: it's not supported to have multiple callback defined, but to support any configuration + // we map all of them. + if cfg.ACKCount != nil { + s.ackCount = cfg.ACKCount + cfg.ACKCount = s.onACKCount + } + + if cfg.ACKEvents != nil { + s.ackEvents = cfg.ACKEvents + cfg.ACKEvents = s.onACKEvents + } + + if cfg.ACKLastEvent != nil { + s.ackLastEvent = cfg.ACKLastEvent + cfg.ACKLastEvent = nil + cfg.ACKEvents = s.onACKEvents + } + + // No calls is defined on the target on the config but we still need to track + // the ack to unblock. + hasACK := cfg.ACKCount != nil || cfg.ACKEvents != nil || cfg.ACKLastEvent != nil + if !hasACK { + cfg.ACKCount = s.onACKCount + } + + c, err := pipeline.ConnectWith(cfg) + if err != nil { + return nil, err + } + + s.client = c + + return s, nil +} + +// Publish publishes one event to the pipeline and return. +func (s *SyncClient) Publish(event beat.Event) error { + s.log.Debug("Publish 1 event") + s.wg.Add(1) + s.client.Publish(event) + return nil +} + +// PublishAll publish a slice of events to the pipeline and return. +func (s *SyncClient) PublishAll(events []beat.Event) error { + s.log.Debugf("Publish %d events", len(events)) + s.wg.Add(len(events)) + s.client.PublishAll(events) + return nil +} + +// Close closes the wrapped beat.Client. +func (s *SyncClient) Close() error { + s.wg.Wait() + return s.client.Close() +} + +// Wait waits until we received a ACK for every events that were sent, this is useful in the +// context of serverless, because when the handler return the execution of the process is suspended. +func (s *SyncClient) Wait() { + s.wg.Wait() +} + +// AckEvents receives an array with all the event acked for this client. +func (s *SyncClient) onACKEvents(data []interface{}) { + s.log.Debugf("onACKEvents callback receives with events count of %d", len(data)) + count := len(data) + if count == 0 { + return + } + + s.onACKCount(count) + if s.ackEvents != nil { + s.ackEvents(data) + } + + if s.ackLastEvent != nil { + s.ackLastEvent(data[len(data)-1]) + } +} + +func (s *SyncClient) onACKCount(c int) { + s.log.Debugf("onACKCount callback receives with events count of %d", c) + s.wg.Add(c * -1) + if s.ackCount != nil { + s.ackCount(c) + } +} diff --git a/x-pack/functionbeat/core/sync_client_test.go b/x-pack/functionbeat/core/sync_client_test.go new file mode 100644 index 000000000000..953c9b7e3127 --- /dev/null +++ b/x-pack/functionbeat/core/sync_client_test.go @@ -0,0 +1,219 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package core + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/beat" +) + +type dummyClient struct { + Received chan int +} + +func newDummyClient() *dummyClient { + return &dummyClient{Received: make(chan int)} +} + +func (c *dummyClient) Publish(event beat.Event) { + c.Received <- 1 +} + +func (c *dummyClient) PublishAll(events []beat.Event) { + c.Received <- len(events) +} + +func (c *dummyClient) Close() error { + close(c.Received) + return nil +} + +type dummyPipeline struct { + client beat.Client +} + +func newDummyPipeline(client beat.Client) *dummyPipeline { + return &dummyPipeline{client: client} +} + +func (d *dummyPipeline) Connect() (beat.Client, error) { + return d.client, nil +} + +func (d *dummyPipeline) ConnectWith(cfg beat.ClientConfig) (beat.Client, error) { + return d.client, nil +} + +func (d *dummyPipeline) SetACKHandler(ackhandler beat.PipelineACKHandler) error { + return nil +} + +func TestSyncClient(t *testing.T) { + receiver := func(c *dummyClient, sc *SyncClient) { + select { + case i := <-c.Received: + sc.onACKEvents(make([]interface{}, i)) + return + } + } + + t.Run("Publish", func(t *testing.T) { + c := newDummyClient() + + pipeline := newDummyPipeline(c) + sc, err := NewSyncClient(nil, pipeline, beat.ClientConfig{}) + if !assert.NoError(t, err) { + return + } + defer sc.Close() + + go receiver(c, sc) + + err = sc.Publish(beat.Event{}) + if !assert.NoError(t, err) { + return + } + sc.Wait() + }) + + t.Run("PublishAll single ACK", func(t *testing.T) { + c := newDummyClient() + + pipeline := newDummyPipeline(c) + sc, err := NewSyncClient(nil, pipeline, beat.ClientConfig{}) + if !assert.NoError(t, err) { + return + } + defer sc.Close() + + go receiver(c, sc) + + err = sc.PublishAll(make([]beat.Event, 10)) + if !assert.NoError(t, err) { + return + } + sc.Wait() + }) + + t.Run("PublishAll multiple independant ACKs", func(t *testing.T) { + c := newDummyClient() + + pipeline := newDummyPipeline(c) + sc, err := NewSyncClient(nil, pipeline, beat.ClientConfig{}) + if !assert.NoError(t, err) { + return + } + defer sc.Close() + + go func(c *dummyClient, sc *SyncClient) { + select { + case <-c.Received: + // simulate multiple acks + sc.onACKEvents(make([]interface{}, 5)) + sc.onACKEvents(make([]interface{}, 5)) + return + } + }(c, sc) + + err = sc.PublishAll(make([]beat.Event, 10)) + if !assert.NoError(t, err) { + return + } + sc.Wait() + }) +} + +func TestCallbacksPropagation(t *testing.T) { + testCallback := func(done <-chan struct{}, config beat.ClientConfig, events []beat.Event) { + c := newDummyClient() + + pipeline := newDummyPipeline(c) + sc, err := NewSyncClient(nil, pipeline, config) + if !assert.NoError(t, err) { + return + } + defer sc.Close() + + go func(c *dummyClient, sc *SyncClient, events []beat.Event) { + select { + case <-c.Received: + elements := make([]interface{}, len(events)) + for i, e := range events { + elements[i] = e.Private + } + sc.onACKEvents(elements) + return + } + }(c, sc, events) + + err = sc.PublishAll(events) + if !assert.NoError(t, err) { + return + } + + sc.Wait() + select { + case <-done: + } + } + + t.Run("propagate ACKCount", func(t *testing.T) { + done := make(chan struct{}) + + callback := func(count int) { + assert.Equal(t, 2, count) + close(done) + } + + clientConfig := beat.ClientConfig{ + ACKCount: callback, + } + + testCallback(done, clientConfig, make([]beat.Event, 2)) + }) + + t.Run("propagate ACKEvents", func(t *testing.T) { + done := make(chan struct{}) + + callback := func(data []interface{}) { + assert.Equal(t, 2, len(data)) + close(done) + } + + clientConfig := beat.ClientConfig{ + ACKEvents: callback, + } + + testCallback(done, clientConfig, make([]beat.Event, 2)) + }) + + t.Run("propagate ACKLastEvent", func(t *testing.T) { + done := make(chan struct{}) + + type s struct{ test string } + + semaphore := &s{test: "hello"} + + events := []beat.Event{ + beat.Event{}, + beat.Event{ + Private: semaphore, + }, + } + callback := func(data interface{}) { + assert.Equal(t, semaphore, data) + close(done) + } + + clientConfig := beat.ClientConfig{ + ACKLastEvent: callback, + } + + testCallback(done, clientConfig, events) + }) +} diff --git a/x-pack/functionbeat/dev-tools/packaging/packages.yml b/x-pack/functionbeat/dev-tools/packaging/packages.yml new file mode 100644 index 000000000000..fac59dd6a767 --- /dev/null +++ b/x-pack/functionbeat/dev-tools/packaging/packages.yml @@ -0,0 +1,101 @@ +--- + +# This file contains the package specifications for Functionbeat. + +shared: + - &common + name: '{{.BeatName}}' + service_name: '{{.BeatServiceName}}' + os: '{{.GOOS}}' + arch: '{{.PackageArch}}' + vendor: '{{.BeatVendor}}' + version: '{{ beat_version }}' + license: '{{.BeatLicense}}' + url: '{{.BeatURL}}' + description: '{{.BeatDescription}}' + + - &binary_files + '{{.BeatName}}{{.BinaryExt}}': + source: build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} + mode: 0755 + fields.yml: + source: fields.yml + mode: 0644 + LICENSE.txt: + source: '{{ repo.RootDir }}/LICENSE.txt' + mode: 0644 + NOTICE.txt: + source: '{{ repo.RootDir }}/NOTICE.txt' + mode: 0644 + README.md: + template: '{{ elastic_beats_dir }}/dev-tools/packaging/templates/common/README.md.tmpl' + mode: 0644 + .build_hash.txt: + content: > + {{ commit }} + mode: 0644 + '{{.BeatName}}.reference.yml': + source: '{{.BeatName}}.reference.yml' + mode: 0644 + '{{.BeatName}}.yml': + source: '{{.BeatName}}.yml' + mode: 0600 + config: true + kibana: + source: _meta/kibana.generated + mode: 0644 + + # Binary package spec (tar.gz for linux/darwin) + - &binary_spec + <<: *common + files: + <<: *binary_files + + # + # License modifiers for the Elastic License + # + - &elastic_license_for_binaries + license: "Elastic License" + files: + LICENSE.txt: + source: '{{ repo.RootDir }}/licenses/ELASTIC-LICENSE.txt' + mode: 0644 + # + # Binaries used to run the function. + # + - &functionbeat_binaries + files: + pkg/functionbeat: + source: 'build/golang-crossbuild/{{.BeatName}}-linux-amd64' + mode: 0755 +# specs is a list of named packaging "flavors". +specs: + functionbeat: + ### + # Elastic Licensed Packages + ### + - os: windows + types: [zip] + spec: + <<: *binary_spec + <<: *functionbeat_binaries + <<: *elastic_license_for_binaries + '{{.BeatName}}{{.BinaryExt}}': + source: build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} + + - os: darwin + types: [tgz] + spec: + <<: *binary_spec + <<: *functionbeat_binaries + <<: *elastic_license_for_binaries + + - os: linux + types: [tgz] + spec: + <<: *binary_spec + <<: *functionbeat_binaries + <<: *elastic_license_for_binaries + files: + '{{.BeatName}}{{.BinaryExt}}': + source: build/golang-crossbuild/{{.BeatName}}-{{.GOOS}}-{{.Platform.Arch}}{{.BinaryExt}} diff --git a/x-pack/functionbeat/docker-compose.yml b/x-pack/functionbeat/docker-compose.yml new file mode 100644 index 000000000000..b60040f7dee3 --- /dev/null +++ b/x-pack/functionbeat/docker-compose.yml @@ -0,0 +1,26 @@ +version: '2.1' +services: + beat: + build: ${PWD}/. + depends_on: + - proxy_dep + env_file: + - ${PWD}/build/test.env + working_dir: /go/src/github.com/elastic/beats/x-pack/functionbeat + volumes: + - ${PWD}/../..:/go/src/github.com/elastic/beats/ + # We launch docker containers to test docker autodiscover: + - /var/run/docker.sock:/var/run/docker.sock + command: make + + # This is a proxy used to block beats until all services are healthy. + # See: https://github.com/docker/compose/issues/4369 + proxy_dep: + image: busybox + depends_on: + elasticsearch: { condition: service_healthy } + + elasticsearch: + extends: + file: ${ES_BEATS}/testing/environments/${TESTING_ENVIRONMENT}.yml + service: elasticsearch diff --git a/x-pack/functionbeat/docs/fields.asciidoc b/x-pack/functionbeat/docs/fields.asciidoc new file mode 100644 index 000000000000..7df7c6804b66 --- /dev/null +++ b/x-pack/functionbeat/docs/fields.asciidoc @@ -0,0 +1,432 @@ + +//// +This file is generated! See _meta/fields.yml and scripts/generate_field_docs.py +//// + +[[exported-fields]] += Exported fields + +[partintro] + +-- +This document describes the fields that are exported by Functionbeat. They are +grouped in the following categories: + +* <> +* <> +* <> +* <> +* <> +* <> + +-- +[[exported-fields-beat]] +== Beat fields + +Contains common beat fields available in all event types. + + + +*`beat.name`*:: ++ +-- +The name of the Beat sending the log messages. If the Beat name is set in the configuration file, then that value is used. If it is not set, the hostname is used. To set the Beat name, use the `name` option in the configuration file. + + +-- + +*`beat.hostname`*:: ++ +-- +The hostname as returned by the operating system on which the Beat is running. + + +-- + +*`beat.timezone`*:: ++ +-- +The timezone as returned by the operating system on which the Beat is running. + + +-- + +*`beat.version`*:: ++ +-- +The version of the beat that generated this event. + + +-- + +*`@timestamp`*:: ++ +-- +type: date + +example: August 26th 2016, 12:35:53.332 + +format: date + +required: True + +The timestamp when the event log record was generated. + + +-- + +*`tags`*:: ++ +-- +Arbitrary tags that can be set per Beat and per transaction type. + + +-- + +*`fields`*:: ++ +-- +type: object + +Contains user configurable fields. + + +-- + +[float] +== error fields + +Error fields containing additional info in case of errors. + + + +*`error.message`*:: ++ +-- +type: text + +Error message. + + +-- + +*`error.code`*:: ++ +-- +type: long + +Error code. + + +-- + +*`error.type`*:: ++ +-- +type: keyword + +Error type. + + +-- + +[[exported-fields-cloud]] +== Cloud provider metadata fields + +Metadata from cloud providers added by the add_cloud_metadata processor. + + + +*`meta.cloud.provider`*:: ++ +-- +example: ec2 + +Name of the cloud provider. Possible values are ec2, gce, or digitalocean. + + +-- + +*`meta.cloud.instance_id`*:: ++ +-- +Instance ID of the host machine. + + +-- + +*`meta.cloud.instance_name`*:: ++ +-- +Instance name of the host machine. + + +-- + +*`meta.cloud.machine_type`*:: ++ +-- +example: t2.medium + +Machine type of the host machine. + + +-- + +*`meta.cloud.availability_zone`*:: ++ +-- +example: us-east-1c + +Availability zone in which this host is running. + + +-- + +*`meta.cloud.project_id`*:: ++ +-- +example: project-x + +Name of the project in Google Cloud. + + +-- + +*`meta.cloud.region`*:: ++ +-- +Region in which this host is running. + + +-- + +[[exported-fields-docker-processor]] +== Docker fields + +Docker stats collected from Docker. + + + + +*`docker.container.id`*:: ++ +-- +type: keyword + +Unique container id. + + +-- + +*`docker.container.image`*:: ++ +-- +type: keyword + +Name of the image the container was built on. + + +-- + +*`docker.container.name`*:: ++ +-- +type: keyword + +Container name. + + +-- + +*`docker.container.labels`*:: ++ +-- +type: object + +Image labels. + + +-- + +[[exported-fields-functionbeat]] +== Functionbeat fields + +None + +[[exported-fields-host-processor]] +== Host fields + +Info collected for the host machine. + + + + +*`host.name`*:: ++ +-- +type: keyword + +Hostname. + + +-- + +*`host.id`*:: ++ +-- +type: keyword + +Unique host id. + + +-- + +*`host.architecture`*:: ++ +-- +type: keyword + +Host architecture (e.g. x86_64, arm, ppc, mips). + + +-- + +*`host.os.platform`*:: ++ +-- +type: keyword + +OS platform (e.g. centos, ubuntu, windows). + + +-- + +*`host.os.version`*:: ++ +-- +type: keyword + +OS version. + + +-- + +*`host.os.family`*:: ++ +-- +type: keyword + +OS family (e.g. redhat, debian, freebsd, windows). + + +-- + +*`host.ip`*:: ++ +-- +type: ip + +List of IP-addresses. + + +-- + +*`host.mac`*:: ++ +-- +type: keyword + +List of hardware-addresses, usually MAC-addresses. + + +-- + +[[exported-fields-kubernetes-processor]] +== Kubernetes fields + +Kubernetes metadata added by the kubernetes processor + + + + +*`kubernetes.pod.name`*:: ++ +-- +type: keyword + +Kubernetes pod name + + +-- + +*`kubernetes.pod.uid`*:: ++ +-- +type: keyword + +Kubernetes Pod UID + + +-- + +*`kubernetes.namespace`*:: ++ +-- +type: keyword + +Kubernetes namespace + + +-- + +*`kubernetes.node.name`*:: ++ +-- +type: keyword + +Kubernetes node name + + +-- + +*`kubernetes.labels`*:: ++ +-- +type: object + +Kubernetes labels map + + +-- + +*`kubernetes.annotations`*:: ++ +-- +type: object + +Kubernetes annotations map + + +-- + +*`kubernetes.container.name`*:: ++ +-- +type: keyword + +Kubernetes container name + + +-- + +*`kubernetes.container.image`*:: ++ +-- +type: keyword + +Kubernetes container image + + +-- + diff --git a/x-pack/functionbeat/docs/index.asciidoc b/x-pack/functionbeat/docs/index.asciidoc new file mode 100644 index 000000000000..4bdd7d1c2df0 --- /dev/null +++ b/x-pack/functionbeat/docs/index.asciidoc @@ -0,0 +1,20 @@ += Functionbeat Reference + +include::../../../libbeat/docs/version.asciidoc[] + +include::{asciidoc-dir}/../../shared/attributes.asciidoc[] + +:version: {stack-version} +:beatname_lc: functionbeat +:beatname_uc: Functionbeat +:beatname_pkg: {beatname_lc} +:github_repo_name: beats +:discuss_forum: beats/{beatname_lc} +:beat_default_index_prefix: {beatname_lc} +:has_ml_jobs: no + + +include::../../../libbeat/docs/shared-beats-attributes.asciidoc[] + +include::./overview.asciidoc[] + diff --git a/x-pack/functionbeat/docs/overview.asciidoc b/x-pack/functionbeat/docs/overview.asciidoc new file mode 100644 index 000000000000..74ae9bbbe20c --- /dev/null +++ b/x-pack/functionbeat/docs/overview.asciidoc @@ -0,0 +1,10 @@ +[id="{beatname_lc}-overview"] +== {beatname_uc} overview + +++++ +Overview +++++ + +{beatname_uc} is a lightweight shipper that you can install as a function on +a serverless provider.For example, you can use {beatname_uc} to collect and +centralize log events from the Cloudwatchlogs to your Elasticsearch cluster. diff --git a/x-pack/functionbeat/functionbeat.reference.yml b/x-pack/functionbeat/functionbeat.reference.yml new file mode 100644 index 000000000000..65cc9e7cb21c --- /dev/null +++ b/x-pack/functionbeat/functionbeat.reference.yml @@ -0,0 +1,1229 @@ +########################## Functionbeat Configuration ########################### + +# This file is a full configuration example documenting all non-deprecated +# options in comments. For a shorter configuration example, that contains only +# the most common options, please see functionbeat.yml in the same directory. +# +# You can find the full configuration reference here: +# https://www.elastic.co/guide/en/beats/functionbeat/index.html +# +#============================ Provider =============================== +# Configure functions to run on AWS Lambda, currently we assume that the credentials +# are present in the environment to correctly create the function when using the CLI. +# +# Configure which S3 bucket we should upload the lambda artifact. +functionbeat.provider.aws.deploy_bucket: "functionbeat-deploy" + +functionbeat.provider.aws.functions: + # Define the list of function availables, each function required to have a unique name. + # Create a function that accepts events coming from cloudwatchlogs. + - name: cloudwatch + enabled: false + type: cloudwatch_logs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for cloudwatch logs" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - log_group_name: /aws/lambda/functionbeat-cloudwatch + #filter_pattern: mylog_ + + # Define custom processors for this function. + #processors: + # - dissect: + # tokenizer: "%{key1} %{key2}" + + # Create a function that accepts events from SQS queues. + - name: sqs + enabled: false + type: sqs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for sqs events" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - event_source_arn: arn:aws:sqs:us-east-1:xxxxx:myevents + + # Define custom processors for this function. + #processors: + # - decode_json_fields: + # fields: ["message"] + # process_array: false + # max_depth: 1 + # target: "" + # overwrite_keys: false + +#================================ General ====================================== + +# The name of the shipper that publishes the network data. It can be used to group +# all the transactions sent by a single shipper in the web interface. +# If this options is not defined, the hostname is used. +#name: + +# The tags of the shipper are included in their own field with each +# transaction published. Tags make it easy to group servers by different +# logical properties. +#tags: ["service-X", "web-tier"] + +# Optional fields that you can specify to add additional information to the +# output. Fields can be scalar values, arrays, dictionaries, or any nested +# combination of these. +#fields: +# env: staging + +# If this option is set to true, the custom fields are stored as top-level +# fields in the output document instead of being grouped under a fields +# sub-dictionary. Default is false. +#fields_under_root: false + +# Internal queue configuration for buffering events to be published. +#queue: + # Queue type by name (default 'mem') + # The memory queue will present all available events (up to the outputs + # bulk_max_size) to the output, the moment the output is ready to server + # another batch of events. + #mem: + # Max number of events the queue can buffer. + #events: 4096 + + # Hints the minimum number of events stored in the queue, + # before providing a batch of events to the outputs. + # The default value is set to 2048. + # A value of 0 ensures events are immediately available + # to be sent to the outputs. + #flush.min_events: 2048 + + # Maximum duration after which events are available to the outputs, + # if the number of events stored in the queue is < min_flush_events. + #flush.timeout: 1s + + # The spool queue will store events in a local spool file, before + # forwarding the events to the outputs. + # + # Beta: spooling to disk is currently a beta feature. Use with care. + # + # The spool file is a circular buffer, which blocks once the file/buffer is full. + # Events are put into a write buffer and flushed once the write buffer + # is full or the flush_timeout is triggered. + # Once ACKed by the output, events are removed immediately from the queue, + # making space for new events to be persisted. + #spool: + # The file namespace configures the file path and the file creation settings. + # Once the file exists, the `size`, `page_size` and `prealloc` settings + # will have no more effect. + #file: + # Location of spool file. The default value is ${path.data}/spool.dat. + #path: "${path.data}/spool.dat" + + # Configure file permissions if file is created. The default value is 0600. + #permissions: 0600 + + # File size hint. The spool blocks, once this limit is reached. The default value is 100 MiB. + #size: 100MiB + + # The files page size. A file is split into multiple pages of the same size. The default value is 4KiB. + #page_size: 4KiB + + # If prealloc is set, the required space for the file is reserved using + # truncate. The default value is true. + #prealloc: true + + # Spool writer settings + # Events are serialized into a write buffer. The write buffer is flushed if: + # - The buffer limit has been reached. + # - The configured limit of buffered events is reached. + # - The flush timeout is triggered. + #write: + # Sets the write buffer size. + #buffer_size: 1MiB + + # Maximum duration after which events are flushed, if the write buffer + # is not full yet. The default value is 1s. + #flush.timeout: 1s + + # Number of maximum buffered events. The write buffer is flushed once the + # limit is reached. + #flush.events: 16384 + + # Configure the on-disk event encoding. The encoding can be changed + # between restarts. + # Valid encodings are: json, ubjson, and cbor. + #codec: cbor + #read: + # Reader flush timeout, waiting for more events to become available, so + # to fill a complete batch, as required by the outputs. + # If flush_timeout is 0, all available events are forwarded to the + # outputs immediately. + # The default value is 0s. + #flush.timeout: 0s + +# Sets the maximum number of CPUs that can be executing simultaneously. The +# default is the number of logical CPUs available in the system. +#max_procs: + +#================================ Processors =================================== + +# Processors are used to reduce the number of fields in the exported event or to +# enhance the event with external metadata. This section defines a list of +# processors that are applied one by one and the first one receives the initial +# event: +# +# event -> filter1 -> event1 -> filter2 ->event2 ... +# +# The supported processors are drop_fields, drop_event, include_fields, +# decode_json_fields, and add_cloud_metadata. +# +# For example, you can use the following processors to keep the fields that +# contain CPU load percentages, but remove the fields that contain CPU ticks +# values: +# +#processors: +#- include_fields: +# fields: ["cpu"] +#- drop_fields: +# fields: ["cpu.user", "cpu.system"] +# +# The following example drops the events that have the HTTP response code 200: +# +#processors: +#- drop_event: +# when: +# equals: +# http.code: 200 +# +# The following example renames the field a to b: +# +#processors: +#- rename: +# fields: +# - from: "a" +# to: "b" +# +# The following example tokenizes the string into fields: +# +#processors: +#- dissect: +# tokenizer: "%{key1} - %{key2}" +# field: "message" +# target_prefix: "dissect" +# +# The following example enriches each event with metadata from the cloud +# provider about the host machine. It works on EC2, GCE, DigitalOcean, +# Tencent Cloud, and Alibaba Cloud. +# +#processors: +#- add_cloud_metadata: ~ +# +# The following example enriches each event with the machine's local time zone +# offset from UTC. +# +#processors: +#- add_locale: +# format: offset +# +# The following example enriches each event with docker metadata, it matches +# given fields to an existing container id and adds info from that container: +# +#processors: +#- add_docker_metadata: +# host: "unix:///var/run/docker.sock" +# match_fields: ["system.process.cgroup.id"] +# match_pids: ["process.pid", "process.ppid"] +# match_source: true +# match_source_index: 4 +# match_short_id: false +# cleanup_timeout: 60 +# # To connect to Docker over TLS you must specify a client and CA certificate. +# #ssl: +# # certificate_authority: "/etc/pki/root/ca.pem" +# # certificate: "/etc/pki/client/cert.pem" +# # key: "/etc/pki/client/cert.key" +# +# The following example enriches each event with docker metadata, it matches +# container id from log path available in `source` field (by default it expects +# it to be /var/lib/docker/containers/*/*.log). +# +#processors: +#- add_docker_metadata: ~ +# +# The following example enriches each event with host metadata. +# +#processors: +#- add_host_metadata: +# netinfo.enabled: false +# +# The following example enriches each event with process metadata using +# process IDs included in the event. +# +#processors: +#- add_process_metadata: +# match_pids: ["system.process.ppid"] +# target: system.process.parent +# +# The following example decodes fields containing JSON strings +# and replaces the strings with valid JSON objects. +# +#processors: +#- decode_json_fields: +# fields: ["field1", "field2", ...] +# process_array: false +# max_depth: 1 +# target: "" +# overwrite_keys: false + +#============================= Elastic Cloud ================================== + +# These settings simplify using functionbeat with the Elastic Cloud (https://cloud.elastic.co/). + +# The cloud.id setting overwrites the `output.elasticsearch.hosts` and +# `setup.kibana.host` options. +# You can find the `cloud.id` in the Elastic Cloud web UI. +#cloud.id: + +# The cloud.auth setting overwrites the `output.elasticsearch.username` and +# `output.elasticsearch.password` settings. The format is `:`. +#cloud.auth: + +#================================ Outputs ====================================== + +# Configure what output to use when sending the data collected by the beat. + +#-------------------------- Elasticsearch output ------------------------------- +output.elasticsearch: + # Boolean flag to enable or disable the output module. + #enabled: true + + # Array of hosts to connect to. + # Scheme and port can be left out and will be set to the default (http and 9200) + # In case you specify and additional path, the scheme is required: http://localhost:9200/path + # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200 + hosts: ["localhost:9200"] + + # Set gzip compression level. + #compression_level: 0 + + # Configure escaping html symbols in strings. + #escape_html: true + + # Optional protocol and basic auth credentials. + #protocol: "https" + #username: "elastic" + #password: "changeme" + + # Dictionary of HTTP parameters to pass within the url with index operations. + #parameters: + #param1: value1 + #param2: value2 + + # Number of workers per Elasticsearch host. + #worker: 1 + + # Optional index name. The default is "functionbeat" plus date + # and generates [functionbeat-]YYYY.MM.DD keys. + # In case you modify this pattern you must update setup.template.name and setup.template.pattern accordingly. + #index: "functionbeat-%{[beat.version]}-%{+yyyy.MM.dd}" + + # Optional ingest node pipeline. By default no pipeline will be used. + #pipeline: "" + + # Optional HTTP Path + #path: "/elasticsearch" + + # Custom HTTP headers to add to each request + #headers: + # X-My-Header: Contents of the header + + # Proxy server url + #proxy_url: http://proxy:3128 + + # The number of times a particular Elasticsearch index operation is attempted. If + # the indexing operation doesn't succeed after this many retries, the events are + # dropped. The default is 3. + #max_retries: 3 + + # The maximum number of events to bulk in a single Elasticsearch bulk API index request. + # The default is 50. + #bulk_max_size: 50 + + # The number of seconds to wait before trying to reconnect to Elasticsearch + # after a network error. After waiting backoff.init seconds, the Beat + # tries to reconnect. If the attempt fails, the backoff timer is increased + # exponentially up to backoff.max. After a successful connection, the backoff + # timer is reset. The default is 1s. + #backoff.init: 1s + + # The maximum number of seconds to wait before attempting to connect to + # Elasticsearch after a network error. The default is 60s. + #backoff.max: 60s + + # Configure http request timeout before failing a request to Elasticsearch. + #timeout: 90 + + # Use SSL settings for HTTPS. + #ssl.enabled: true + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # SSL configuration. By default is off. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + # Configure what types of renegotiation are supported. Valid options are + # never, once, and freely. Default is never. + #ssl.renegotiation: never + + +#----------------------------- Logstash output --------------------------------- +#output.logstash: + # Boolean flag to enable or disable the output module. + #enabled: true + + # The Logstash hosts + #hosts: ["localhost:5044"] + + # Number of workers per Logstash host. + #worker: 1 + + # Set gzip compression level. + #compression_level: 3 + + # Configure escaping html symbols in strings. + #escape_html: true + + # Optional maximum time to live for a connection to Logstash, after which the + # connection will be re-established. A value of `0s` (the default) will + # disable this feature. + # + # Not yet supported for async connections (i.e. with the "pipelining" option set) + #ttl: 30s + + # Optional load balance the events between the Logstash hosts. Default is false. + #loadbalance: false + + # Number of batches to be sent asynchronously to Logstash while processing + # new batches. + #pipelining: 2 + + # If enabled only a subset of events in a batch of events is transferred per + # transaction. The number of events to be sent increases up to `bulk_max_size` + # if no error is encountered. + #slow_start: false + + # The number of seconds to wait before trying to reconnect to Logstash + # after a network error. After waiting backoff.init seconds, the Beat + # tries to reconnect. If the attempt fails, the backoff timer is increased + # exponentially up to backoff.max. After a successful connection, the backoff + # timer is reset. The default is 1s. + #backoff.init: 1s + + # The maximum number of seconds to wait before attempting to connect to + # Logstash after a network error. The default is 60s. + #backoff.max: 60s + + # Optional index name. The default index name is set to functionbeat + # in all lowercase. + #index: 'functionbeat' + + # SOCKS5 proxy server URL + #proxy_url: socks5://user:password@socks5-server:2233 + + # Resolve names locally when using a proxy server. Defaults to false. + #proxy_use_local_resolver: false + + # Enable SSL support. SSL is automatically enabled, if any SSL setting is set. + #ssl.enabled: true + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # Optional SSL configuration options. SSL is off by default. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + # Configure what types of renegotiation are supported. Valid options are + # never, once, and freely. Default is never. + #ssl.renegotiation: never + + # The number of times to retry publishing an event after a publishing failure. + # After the specified number of retries, the events are typically dropped. + # Some Beats, such as Filebeat and Winlogbeat, ignore the max_retries setting + # and retry until all events are published. Set max_retries to a value less + # than 0 to retry until all events are published. The default is 3. + #max_retries: 3 + + # The maximum number of events to bulk in a single Logstash request. The + # default is 2048. + #bulk_max_size: 2048 + + # The number of seconds to wait for responses from the Logstash server before + # timing out. The default is 30s. + #timeout: 30s + +#------------------------------- Kafka output ---------------------------------- +#output.kafka: + # Boolean flag to enable or disable the output module. + #enabled: true + + # The list of Kafka broker addresses from where to fetch the cluster metadata. + # The cluster metadata contain the actual Kafka brokers events are published + # to. + #hosts: ["localhost:9092"] + + # The Kafka topic used for produced events. The setting can be a format string + # using any event field. To set the topic from document type use `%{[type]}`. + #topic: beats + + # The Kafka event key setting. Use format string to create unique event key. + # By default no event key will be generated. + #key: '' + + # The Kafka event partitioning strategy. Default hashing strategy is `hash` + # using the `output.kafka.key` setting or randomly distributes events if + # `output.kafka.key` is not configured. + #partition.hash: + # If enabled, events will only be published to partitions with reachable + # leaders. Default is false. + #reachable_only: false + + # Configure alternative event field names used to compute the hash value. + # If empty `output.kafka.key` setting will be used. + # Default value is empty list. + #hash: [] + + # Authentication details. Password is required if username is set. + #username: '' + #password: '' + + # Kafka version functionbeat is assumed to run against. Defaults to the "1.0.0". + #version: '1.0.0' + + # Configure JSON encoding + #codec.json: + # Pretty print json event + #pretty: false + + # Configure escaping html symbols in strings. + #escape_html: true + + # Metadata update configuration. Metadata do contain leader information + # deciding which broker to use when publishing. + #metadata: + # Max metadata request retry attempts when cluster is in middle of leader + # election. Defaults to 3 retries. + #retry.max: 3 + + # Waiting time between retries during leader elections. Default is 250ms. + #retry.backoff: 250ms + + # Refresh metadata interval. Defaults to every 10 minutes. + #refresh_frequency: 10m + + # The number of concurrent load-balanced Kafka output workers. + #worker: 1 + + # The number of times to retry publishing an event after a publishing failure. + # After the specified number of retries, the events are typically dropped. + # Some Beats, such as Filebeat, ignore the max_retries setting and retry until + # all events are published. Set max_retries to a value less than 0 to retry + # until all events are published. The default is 3. + #max_retries: 3 + + # The maximum number of events to bulk in a single Kafka request. The default + # is 2048. + #bulk_max_size: 2048 + + # The number of seconds to wait for responses from the Kafka brokers before + # timing out. The default is 30s. + #timeout: 30s + + # The maximum duration a broker will wait for number of required ACKs. The + # default is 10s. + #broker_timeout: 10s + + # The number of messages buffered for each Kafka broker. The default is 256. + #channel_buffer_size: 256 + + # The keep-alive period for an active network connection. If 0s, keep-alives + # are disabled. The default is 0 seconds. + #keep_alive: 0 + + # Sets the output compression codec. Must be one of none, snappy and gzip. The + # default is gzip. + #compression: gzip + + # Set the compression level. Currently only gzip provides a compression level + # between 0 and 9. The default value is chosen by the compression algorithm. + #compression_level: 4 + + # The maximum permitted size of JSON-encoded messages. Bigger messages will be + # dropped. The default value is 1000000 (bytes). This value should be equal to + # or less than the broker's message.max.bytes. + #max_message_bytes: 1000000 + + # The ACK reliability level required from broker. 0=no response, 1=wait for + # local commit, -1=wait for all replicas to commit. The default is 1. Note: + # If set to 0, no ACKs are returned by Kafka. Messages might be lost silently + # on error. + #required_acks: 1 + + # The configurable ClientID used for logging, debugging, and auditing + # purposes. The default is "beats". + #client_id: beats + + # Enable SSL support. SSL is automatically enabled, if any SSL setting is set. + #ssl.enabled: true + + # Optional SSL configuration options. SSL is off by default. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + # Configure what types of renegotiation are supported. Valid options are + # never, once, and freely. Default is never. + #ssl.renegotiation: never + +#------------------------------- Redis output ---------------------------------- +#output.redis: + # Boolean flag to enable or disable the output module. + #enabled: true + + # Configure JSON encoding + #codec.json: + # Pretty print json event + #pretty: false + + # Configure escaping html symbols in strings. + #escape_html: true + + # The list of Redis servers to connect to. If load balancing is enabled, the + # events are distributed to the servers in the list. If one server becomes + # unreachable, the events are distributed to the reachable servers only. + #hosts: ["localhost:6379"] + + # The Redis port to use if hosts does not contain a port number. The default + # is 6379. + #port: 6379 + + # The name of the Redis list or channel the events are published to. The + # default is functionbeat. + #key: functionbeat + + # The password to authenticate with. The default is no authentication. + #password: + + # The Redis database number where the events are published. The default is 0. + #db: 0 + + # The Redis data type to use for publishing events. If the data type is list, + # the Redis RPUSH command is used. If the data type is channel, the Redis + # PUBLISH command is used. The default value is list. + #datatype: list + + # The number of workers to use for each host configured to publish events to + # Redis. Use this setting along with the loadbalance option. For example, if + # you have 2 hosts and 3 workers, in total 6 workers are started (3 for each + # host). + #worker: 1 + + # If set to true and multiple hosts or workers are configured, the output + # plugin load balances published events onto all Redis hosts. If set to false, + # the output plugin sends all events to only one host (determined at random) + # and will switch to another host if the currently selected one becomes + # unreachable. The default value is true. + #loadbalance: true + + # The Redis connection timeout in seconds. The default is 5 seconds. + #timeout: 5s + + # The number of times to retry publishing an event after a publishing failure. + # After the specified number of retries, the events are typically dropped. + # Some Beats, such as Filebeat, ignore the max_retries setting and retry until + # all events are published. Set max_retries to a value less than 0 to retry + # until all events are published. The default is 3. + #max_retries: 3 + + # The number of seconds to wait before trying to reconnect to Redis + # after a network error. After waiting backoff.init seconds, the Beat + # tries to reconnect. If the attempt fails, the backoff timer is increased + # exponentially up to backoff.max. After a successful connection, the backoff + # timer is reset. The default is 1s. + #backoff.init: 1s + + # The maximum number of seconds to wait before attempting to connect to + # Redis after a network error. The default is 60s. + #backoff.max: 60s + + # The maximum number of events to bulk in a single Redis request or pipeline. + # The default is 2048. + #bulk_max_size: 2048 + + # The URL of the SOCKS5 proxy to use when connecting to the Redis servers. The + # value must be a URL with a scheme of socks5://. + #proxy_url: + + # This option determines whether Redis hostnames are resolved locally when + # using a proxy. The default value is false, which means that name resolution + # occurs on the proxy server. + #proxy_use_local_resolver: false + + # Enable SSL support. SSL is automatically enabled, if any SSL setting is set. + #ssl.enabled: true + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # Optional SSL configuration options. SSL is off by default. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + # Configure what types of renegotiation are supported. Valid options are + # never, once, and freely. Default is never. + #ssl.renegotiation: never + +#------------------------------- File output ----------------------------------- +#output.file: + # Boolean flag to enable or disable the output module. + #enabled: true + + # Configure JSON encoding + #codec.json: + # Pretty print json event + #pretty: false + + # Configure escaping html symbols in strings. + #escape_html: true + + # Path to the directory where to save the generated files. The option is + # mandatory. + #path: "/tmp/functionbeat" + + # Name of the generated files. The default is `functionbeat` and it generates + # files: `functionbeat`, `functionbeat.1`, `functionbeat.2`, etc. + #filename: functionbeat + + # Maximum size in kilobytes of each file. When this size is reached, and on + # every functionbeat restart, the files are rotated. The default value is 10240 + # kB. + #rotate_every_kb: 10000 + + # Maximum number of files under path. When this number of files is reached, + # the oldest file is deleted and the rest are shifted from last to first. The + # default is 7 files. + #number_of_files: 7 + + # Permissions to use for file creation. The default is 0600. + #permissions: 0600 + + +#----------------------------- Console output --------------------------------- +#output.console: + # Boolean flag to enable or disable the output module. + #enabled: true + + # Configure JSON encoding + #codec.json: + # Pretty print json event + #pretty: false + + # Configure escaping html symbols in strings. + #escape_html: true + +#================================= Paths ====================================== + +# The home path for the functionbeat installation. This is the default base path +# for all other path settings and for miscellaneous files that come with the +# distribution (for example, the sample dashboards). +# If not set by a CLI flag or in the configuration file, the default for the +# home path is the location of the binary. +#path.home: + +# The configuration path for the functionbeat installation. This is the default +# base path for configuration files, including the main YAML configuration file +# and the Elasticsearch template file. If not set by a CLI flag or in the +# configuration file, the default for the configuration path is the home path. +#path.config: ${path.home} + +# The data path for the functionbeat installation. This is the default base path +# for all the files in which functionbeat needs to store its data. If not set by a +# CLI flag or in the configuration file, the default for the data path is a data +# subdirectory inside the home path. +#path.data: ${path.home}/data + +# The logs path for a functionbeat installation. This is the default location for +# the Beat's log files. If not set by a CLI flag or in the configuration file, +# the default for the logs path is a logs subdirectory inside the home path. +#path.logs: ${path.home}/logs + +#================================ Keystore ========================================== +# Location of the Keystore containing the keys and their sensitive values. +#keystore.path: "${path.config}/beats.keystore" + +#============================== Dashboards ===================================== +# These settings control loading the sample dashboards to the Kibana index. Loading +# the dashboards are disabled by default and can be enabled either by setting the +# options here, or by using the `-setup` CLI flag or the `setup` command. +#setup.dashboards.enabled: false + +# The directory from where to read the dashboards. The default is the `kibana` +# folder in the home path. +#setup.dashboards.directory: ${path.home}/kibana + +# The URL from where to download the dashboards archive. It is used instead of +# the directory if it has a value. +#setup.dashboards.url: + +# The file archive (zip file) from where to read the dashboards. It is used instead +# of the directory when it has a value. +#setup.dashboards.file: + +# In case the archive contains the dashboards from multiple Beats, this lets you +# select which one to load. You can load all the dashboards in the archive by +# setting this to the empty string. +#setup.dashboards.beat: functionbeat + +# The name of the Kibana index to use for setting the configuration. Default is ".kibana" +#setup.dashboards.kibana_index: .kibana + +# The Elasticsearch index name. This overwrites the index name defined in the +# dashboards and index pattern. Example: testbeat-* +#setup.dashboards.index: + +# Always use the Kibana API for loading the dashboards instead of autodetecting +# how to install the dashboards by first querying Elasticsearch. +#setup.dashboards.always_kibana: false + +# If true and Kibana is not reachable at the time when dashboards are loaded, +# it will retry to reconnect to Kibana instead of exiting with an error. +#setup.dashboards.retry.enabled: false + +# Duration interval between Kibana connection retries. +#setup.dashboards.retry.interval: 1s + +# Maximum number of retries before exiting with an error, 0 for unlimited retrying. +#setup.dashboards.retry.maximum: 0 + + +#============================== Template ===================================== + +# A template is used to set the mapping in Elasticsearch +# By default template loading is enabled and the template is loaded. +# These settings can be adjusted to load your own template or overwrite existing ones. + +# Set to false to disable template loading. +#setup.template.enabled: true + +# Template name. By default the template name is "functionbeat-%{[beat.version]}" +# The template name and pattern has to be set in case the elasticsearch index pattern is modified. +#setup.template.name: "functionbeat-%{[beat.version]}" + +# Template pattern. By default the template pattern is "-%{[beat.version]}-*" to apply to the default index settings. +# The first part is the version of the beat and then -* is used to match all daily indices. +# The template name and pattern has to be set in case the elasticsearch index pattern is modified. +#setup.template.pattern: "functionbeat-%{[beat.version]}-*" + +# Path to fields.yml file to generate the template +#setup.template.fields: "${path.config}/fields.yml" + +# A list of fields to be added to the template and Kibana index pattern. Also +# specify setup.template.overwrite: true to overwrite the existing template. +# This setting is experimental. +#setup.template.append_fields: +#- name: field_name +# type: field_type + +# Enable json template loading. If this is enabled, the fields.yml is ignored. +#setup.template.json.enabled: false + +# Path to the json template file +#setup.template.json.path: "${path.config}/template.json" + +# Name under which the template is stored in Elasticsearch +#setup.template.json.name: "" + +# Overwrite existing template +#setup.template.overwrite: false + +# Elasticsearch template settings +setup.template.settings: + + # A dictionary of settings to place into the settings.index dictionary + # of the Elasticsearch template. For more details, please check + # https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html + #index: + #number_of_shards: 1 + #codec: best_compression + #number_of_routing_shards: 30 + + # A dictionary of settings for the _source field. For more details, please check + # https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html + #_source: + #enabled: false + +#============================== Kibana ===================================== + +# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API. +# This requires a Kibana endpoint configuration. +setup.kibana: + + # Kibana Host + # Scheme and port can be left out and will be set to the default (http and 5601) + # In case you specify and additional path, the scheme is required: http://localhost:5601/path + # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601 + #host: "localhost:5601" + + # Optional protocol and basic auth credentials. + #protocol: "https" + #username: "elastic" + #password: "changeme" + + # Optional HTTP Path + #path: "" + + # Use SSL settings for HTTPS. Default is true. + #ssl.enabled: true + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # SSL configuration. By default is off. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + + +#================================ Logging ====================================== +# There are four options for the log output: file, stderr, syslog, eventlog +# The file output is the default. + +# Sets log level. The default log level is info. +# Available log levels are: error, warning, info, debug +#logging.level: info + +# Enable debug output for selected components. To enable all selectors use ["*"] +# Other available selectors are "beat", "publish", "service" +# Multiple selectors can be chained. +#logging.selectors: [ ] + +# Send all logging output to syslog. The default is false. +#logging.to_syslog: false + +# Send all logging output to Windows Event Logs. The default is false. +#logging.to_eventlog: false + +# If enabled, functionbeat periodically logs its internal metrics that have changed +# in the last period. For each metric that changed, the delta from the value at +# the beginning of the period is logged. Also, the total values for +# all non-zero internal metrics are logged on shutdown. The default is true. +#logging.metrics.enabled: true + +# The period after which to log the internal metrics. The default is 30s. +#logging.metrics.period: 30s + +# Logging to rotating files. Set logging.to_files to false to disable logging to +# files. +logging.to_files: true +logging.files: + # Configure the path where the logs are written. The default is the logs directory + # under the home path (the binary location). + #path: /var/log/functionbeat + + # The name of the files where the logs are written to. + #name: functionbeat + + # Configure log file size limit. If limit is reached, log file will be + # automatically rotated + #rotateeverybytes: 10485760 # = 10MB + + # Number of rotated log files to keep. Oldest files will be deleted first. + #keepfiles: 7 + + # The permissions mask to apply when rotating log files. The default value is 0600. + # Must be a valid Unix-style file permissions mask expressed in octal notation. + #permissions: 0600 + + # Enable log file rotation on time intervals in addition to size-based rotation. + # Intervals must be at least 1s. Values of 1m, 1h, 24h, 7*24h, 30*24h, and 365*24h + # are boundary-aligned with minutes, hours, days, weeks, months, and years as + # reported by the local system clock. All other intervals are calculated from the + # unix epoch. Defaults to disabled. + #interval: 0 + +# Set to true to log messages in json format. +#logging.json: false + + +#============================== Xpack Monitoring ===================================== +# functionbeat can export internal metrics to a central Elasticsearch monitoring cluster. +# This requires xpack monitoring to be enabled in Elasticsearch. +# The reporting is disabled by default. + +# Set to true to enable the monitoring reporter. +#xpack.monitoring.enabled: false + +# Uncomment to send the metrics to Elasticsearch. Most settings from the +# Elasticsearch output are accepted here as well. Any setting that is not set is +# automatically inherited from the Elasticsearch output configuration, so if you +# have the Elasticsearch output configured, you can simply uncomment the +# following line, and leave the rest commented out. +#xpack.monitoring.elasticsearch: + + # Array of hosts to connect to. + # Scheme and port can be left out and will be set to the default (http and 9200) + # In case you specify and additional path, the scheme is required: http://localhost:9200/path + # IPv6 addresses should always be defined as: https://[2001:db8::1]:9200 + #hosts: ["localhost:9200"] + + # Set gzip compression level. + #compression_level: 0 + + # Optional protocol and basic auth credentials. + #protocol: "https" + #username: "beats_system" + #password: "changeme" + + # Dictionary of HTTP parameters to pass within the url with index operations. + #parameters: + #param1: value1 + #param2: value2 + + # Custom HTTP headers to add to each request + #headers: + # X-My-Header: Contents of the header + + # Proxy server url + #proxy_url: http://proxy:3128 + + # The number of times a particular Elasticsearch index operation is attempted. If + # the indexing operation doesn't succeed after this many retries, the events are + # dropped. The default is 3. + #max_retries: 3 + + # The maximum number of events to bulk in a single Elasticsearch bulk API index request. + # The default is 50. + #bulk_max_size: 50 + + # The number of seconds to wait before trying to reconnect to Elasticsearch + # after a network error. After waiting backoff.init seconds, the Beat + # tries to reconnect. If the attempt fails, the backoff timer is increased + # exponentially up to backoff.max. After a successful connection, the backoff + # timer is reset. The default is 1s. + #backoff.init: 1s + + # The maximum number of seconds to wait before attempting to connect to + # Elasticsearch after a network error. The default is 60s. + #backoff.max: 60s + + # Configure http request timeout before failing an request to Elasticsearch. + #timeout: 90 + + # Use SSL settings for HTTPS. + #ssl.enabled: true + + # Configure SSL verification mode. If `none` is configured, all server hosts + # and certificates will be accepted. In this mode, SSL based connections are + # susceptible to man-in-the-middle attacks. Use only for testing. Default is + # `full`. + #ssl.verification_mode: full + + # List of supported/valid TLS versions. By default all TLS versions 1.0 up to + # 1.2 are enabled. + #ssl.supported_protocols: [TLSv1.0, TLSv1.1, TLSv1.2] + + # SSL configuration. By default is off. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + + # Optional passphrase for decrypting the Certificate Key. + #ssl.key_passphrase: '' + + # Configure cipher suites to be used for SSL connections + #ssl.cipher_suites: [] + + # Configure curve types for ECDHE based cipher suites + #ssl.curve_types: [] + + # Configure what types of renegotiation are supported. Valid options are + # never, once, and freely. Default is never. + #ssl.renegotiation: never + + #metrics.period: 10s + #state.period: 1m + +#================================ HTTP Endpoint ====================================== +# Each beat can expose internal metrics through a HTTP endpoint. For security +# reasons the endpoint is disabled by default. This feature is currently experimental. +# Stats can be access through http://localhost:5066/stats . For pretty JSON output +# append ?pretty to the URL. + +# Defines if the HTTP endpoint is enabled. +#http.enabled: false + +# The HTTP endpoint will bind to this hostname or IP address. It is recommended to use only localhost. +#http.host: localhost + +# Port on which the HTTP endpoint will bind. Default is 5066. +#http.port: 5066 + +#============================= Process Security ================================ + +# Enable or disable seccomp system call filtering on Linux. Default is enabled. +#seccomp.enabled: true diff --git a/x-pack/functionbeat/functionbeat.yml b/x-pack/functionbeat/functionbeat.yml new file mode 100644 index 000000000000..1e7e79c8da64 --- /dev/null +++ b/x-pack/functionbeat/functionbeat.yml @@ -0,0 +1,209 @@ +###################### Functionbeat Configuration Example ####################### + +# This file is an example configuration file highlighting only the most common +# options. The functionbeat.reference.yml file from the same directory contains all the +# supported options with more comments. You can use it as a reference. +# +# You can find the full configuration reference here: +# https://www.elastic.co/guide/en/beats/functionbeat/index.html +# + +#============================ Provider =============================== +# Configure functions to run on AWS Lambda, currently we assume that the credentials +# are present in the environment to correctly create the function when using the CLI. +# +functionbeat.provider.aws.functions: + # Define the list of function availables, each function required to have a unique name. + # Create a function that accepts events coming from cloudwatchlogs. + - name: fn_cloudwatch_logs + enabled: false + type: cloudwatch_logs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for cloudwatch logs" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # List of cloudwatch log group registered to that function. + triggers: + - log_group_name: /aws/lambda/functionbeat-cloudwatch_logs + filter_pattern: mylog_ + + # Define custom processors for this function. + #processors: + # - dissect: + # tokenizer: "%{key1} %{key2}" + + # Create a function that accepts events from SQS queues. + - name: sqs + enabled: false + type: sqs + + # Description of the method to help identify them when you run multiples functions. + description: "lambda function for SQS events" + + # Concurrency, is the reserved number of instances for that function. + # Default is unreserved. + # + # Note: There is a hard limit of 1000 functions of any kind per account. + #concurrency: 5 + + # The maximum memory allocated for this function, the configured size must be a factor of 64. + # There is a hard limit of 3008MiB for each function. Default is 128MiB. + #memory_size: 128MiB + + # Dead letter queue configuration, this must be set to an ARN pointing to a SQS queue. + #dead_letter_config.target_arn: + + # Optional fields that you can specify to add additional information to the + # output. Fields can be scalar values, arrays, dictionaries, or any nested + # combination of these. + #fields: + # env: staging + + # Define custom processors for this function. + #processors: + # - decode_json_fields: + # fields: ["message"] + # process_array: false + # max_depth: 1 + # target: "" + # overwrite_keys: false + +#================================ General ===================================== + +# The name of the shipper that publishes the network data. It can be used to group +# all the transactions sent by a single shipper in the web interface. +#name: + +# The tags of the shipper are included in their own field with each +# transaction published. +#tags: ["service-X", "web-tier"] + +# Optional fields that you can specify to add additional information to the +# output. +#fields: +# env: staging + + +#============================== Dashboards ===================================== +# These settings control loading the sample dashboards to the Kibana index. Loading +# the dashboards is disabled by default and can be enabled either by setting the +# options here, or by using the `-setup` CLI flag or the `setup` command. +#setup.dashboards.enabled: false + +# The URL from where to download the dashboards archive. By default this URL +# has a value which is computed based on the Beat name and version. For released +# versions, this URL points to the dashboard archive on the artifacts.elastic.co +# website. +#setup.dashboards.url: + +#============================== Kibana ===================================== + +# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API. +# This requires a Kibana endpoint configuration. +setup.kibana: + + # Kibana Host + # Scheme and port can be left out and will be set to the default (http and 5601) + # In case you specify and additional path, the scheme is required: http://localhost:5601/path + # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601 + #host: "localhost:5601" + + # Kibana Space ID + # ID of the Kibana Space into which the dashboards should be loaded. By default, + # the Default Space will be used. + #space.id: + +#============================= Elastic Cloud ================================== + +# These settings simplify using functionbeat with the Elastic Cloud (https://cloud.elastic.co/). + +# The cloud.id setting overwrites the `output.elasticsearch.hosts` and +# `setup.kibana.host` options. +# You can find the `cloud.id` in the Elastic Cloud web UI. +#cloud.id: + +# The cloud.auth setting overwrites the `output.elasticsearch.username` and +# `output.elasticsearch.password` settings. The format is `:`. +#cloud.auth: + +#================================ Outputs ===================================== + +# Configure what output to use when sending the data collected by the beat. + +#-------------------------- Elasticsearch output ------------------------------ +output.elasticsearch: + # Array of hosts to connect to. + hosts: ["localhost:9200"] + + # Optional protocol and basic auth credentials. + #protocol: "https" + #username: "elastic" + #password: "changeme" + +#----------------------------- Logstash output -------------------------------- +#output.logstash: + # The Logstash hosts + #hosts: ["localhost:5044"] + + # Optional SSL. By default is off. + # List of root certificates for HTTPS server verifications + #ssl.certificate_authorities: ["/etc/pki/root/ca.pem"] + + # Certificate for SSL client authentication + #ssl.certificate: "/etc/pki/client/cert.pem" + + # Client Certificate Key + #ssl.key: "/etc/pki/client/cert.key" + +#================================ Procesors ===================================== + +# Configure processors to enhance or manipulate events generated by the beat. + +processors: + - add_host_metadata: ~ + - add_cloud_metadata: ~ + +#================================ Logging ===================================== + +# Sets log level. The default log level is info. +# Available log levels are: error, warning, info, debug +#logging.level: debug + +# At debug level, you can selectively enable logging only for some components. +# To enable all selectors use ["*"]. Examples of other selectors are "beat", +# "publish", "service". +#logging.selectors: ["*"] + +#============================== Xpack Monitoring =============================== +# functionbeat can export internal metrics to a central Elasticsearch monitoring +# cluster. This requires xpack monitoring to be enabled in Elasticsearch. The +# reporting is disabled by default. + +# Set to true to enable the monitoring reporter. +#xpack.monitoring.enabled: false + +# Uncomment to send the metrics to Elasticsearch. Most settings from the +# Elasticsearch output are accepted here as well. Any setting that is not set is +# automatically inherited from the Elasticsearch output configuration, so if you +# have the Elasticsearch output configured, you can simply uncomment the +# following line. +#xpack.monitoring.elasticsearch: diff --git a/x-pack/functionbeat/include/feature.go b/x-pack/functionbeat/include/feature.go new file mode 100644 index 000000000000..1a9ea1b80b62 --- /dev/null +++ b/x-pack/functionbeat/include/feature.go @@ -0,0 +1,21 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package include + +import ( + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/x-pack/functionbeat/provider/aws" + "github.com/elastic/beats/x-pack/functionbeat/provider/local" +) + +// Bundle feature enabled. +var Bundle = feature.MustBundle( + local.Bundle, + aws.Bundle, +) + +func init() { + feature.MustRegisterBundle(Bundle) +} diff --git a/x-pack/functionbeat/include/fields.go b/x-pack/functionbeat/include/fields.go new file mode 100644 index 000000000000..3374462335bf --- /dev/null +++ b/x-pack/functionbeat/include/fields.go @@ -0,0 +1,22 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Code generated by beats/dev-tools/cmd/asset/asset.go - DO NOT EDIT. + +package include + +import ( + "github.com/elastic/beats/libbeat/asset" +) + +func init() { + if err := asset.SetFields("functionbeat", "fields.yml", Asset); err != nil { + panic(err) + } +} + +// Asset returns asset data +func Asset() string { + return "eJy0WF1v3LYSffevGOTpXkAr3Ng3xsU+XDR12mbRpg3a5HkzS85KrCVSISmvt7++GIr6srQfjrd+MMyvcw7JmTOUF3BP+yVsay28MnpD6K8AvPIFLeHHca8kJ6yquGd5BbBVVEi3vLqKGOO130/XwP+vAADujPaotANhytLosC6CAT6gKnBTECgNWBRAD6Q9+H1FLh1yMtACNJbUEKf8Z+id5eSfTzmFBWC24HMKCsGRlkpnoaMwGZTkHGbkUlgNZoVlynVQjjwL5HFh9FZltUWmg60qKOF+HkQPD1jUvBJqRzJgKs9NbfwQLCyB3DgfmeL8TyZQjXQkPBa6vnDzS4djwo4P60qnh9Yynj64Ths6sORrq0nCZh+oTEVMozNwe+epBKNhlyuR98IHZ2drrZXOZtR4VdJfRp+hpp35T6p5IOuU0afFxIltWIVwDpefkWYpJMHnyjWhnI5D99V3vBXnsaxeRVCO9SVI9O05WPpaK0tyCd7WbefW2BL9aB49Yllx6r2ts9p5uL71OVz/5/VtAq+vlzdvlm9u0pub6/NON0iCXRPIFNOQE8SSMFbCDl2/vyeb8pi54yxv7UZ5i3Yf5janJZCtIMR7Rba5KNQyNLxF7TB4UYfB5/SEuHGH0TmazZ8k2lxrGutm5J72O2PlcaGdV9WObJ9TbFAN2RMFZK2xIwGZNXV1nOQHXtQ6oGgYOX5RSsVzsQClt4YzW6AL/hV4XNoGQ3TFFrBVE82s6281eXr0g84DsnppESedEAgjp+iF0dlz0BlkCs1YE+jxnZ2F3oRJLFGiMLXsa9QdN6Gy5kFJ4m16lOhxvmx9iKOwtaZskLqlju+qtyCUch0mrFtIninIOWMPVjGemoZVaQv7NLFJnMjeXwflbawwhY/GOcWBG2qSA7TEgAlkghIwFqTKlMfCCEKdHtSmtPOoBa3VidRZxYmwetdK4iICJYpc6aepO8dwujJ1HMO6fh5LnLAexFl3zv46LUmqujzO/qGBCCH2PPL4zFGF8vv1oOR1Cmq3IHR+8VqcMNIBEISKqPpqp1wjR7m+zB0JueCN3a12UuLI4vH80ItLWMtPxmQFNZl2mN1SdrLU/h7mnNpfTHRpxH3In5jp79r2DHgzBs6jZ/stChJcs0OaN2Ocsy431q+bCrCELRaOLw21yI1t+RZdll+NTbndcicLZuvDIR+PNYFsquTLPPGzVl9r6gFByTlX7+jKufLxLMZhXAS49nUaBfBDYlOrwoPRx6QMzOAbldx1nIx1jKvADRVuwjZ6S8Dx98QJLatwEg1PF7QczH3Ivm9aMyArfgwMApWr3MR6+tjk/pORGbmfF5cvv5P38bNiehsXivTGIGaCHK3IlSfha3uBPYzg4F+UZik8/u92ffvfBNCWCVSVSKBUlfv3VIpxaVWg5yf9y5T89ge0QFGDIO2NS6De1NrXCeyUlmZ3QMT4i+fbNUScWY4tlqrYv5iigYmbtCRz9AlI2ijUCWwt0cbJY7tV1UTCqOsI+y/KeTa01ccFSmnJOXJTghLFyzbZ0uRo5Q4t9WQJ1K7GotjDh7d3Qw2tj9zXG7KaPLneTX4e9s3Q9uPdM3j8pu1BYeglx8tiv+ikAY1Ew7NsqDLyAuVhcAKVkY23zVLVL7WmAdNHI+Hz6t2UiH+7CsXlNtUjTsn4C+yiJ8iIB47w3OJ6HlGDBiVWUybU2vjw/6+L0Q0g5zkv+WAZ8IrR2+UY7QWebLO8De7fAQAA///g6368" +} diff --git a/x-pack/functionbeat/licenser/callback_watcher.go b/x-pack/functionbeat/licenser/callback_watcher.go new file mode 100644 index 000000000000..054ad6b22aae --- /dev/null +++ b/x-pack/functionbeat/licenser/callback_watcher.go @@ -0,0 +1,29 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +// CallbackWatcher defines an addhoc listener for events generated by the manager. +type CallbackWatcher struct { + New func(License) + Stopped func() +} + +// OnNewLicense is called when a new license is set in the manager. +func (cb *CallbackWatcher) OnNewLicense(license License) { + if cb.New == nil { + return + } + cb.New(license) +} + +// OnManagerStopped is called when the manager is stopped, watcher are expected to terminates any +// features that depends on a specific license. +func (cb *CallbackWatcher) OnManagerStopped() { + if cb.Stopped == nil { + return + } + + cb.Stopped() +} diff --git a/x-pack/functionbeat/licenser/callback_watcher_test.go b/x-pack/functionbeat/licenser/callback_watcher_test.go new file mode 100644 index 000000000000..4307f7abd9da --- /dev/null +++ b/x-pack/functionbeat/licenser/callback_watcher_test.go @@ -0,0 +1,30 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestCallbackWatcher(t *testing.T) { + t.Run("when no callback is set do not execute anything", func(t *testing.T) { + w := &CallbackWatcher{} + w.OnNewLicense(License{}) + w.OnManagerStopped() + }) + + t.Run("proxy call to callback function", func(t *testing.T) { + c := 0 + w := &CallbackWatcher{ + New: func(license License) { c++ }, + Stopped: func() { c++ }, + } + w.OnNewLicense(License{}) + w.OnManagerStopped() + assert.Equal(t, 2, c) + }) +} diff --git a/x-pack/functionbeat/licenser/check.go b/x-pack/functionbeat/licenser/check.go new file mode 100644 index 000000000000..422ba88c85bf --- /dev/null +++ b/x-pack/functionbeat/licenser/check.go @@ -0,0 +1,50 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "github.com/elastic/beats/libbeat/logp" +) + +// CheckFunc signature to implement a function that validate a license. +type CheckFunc func(*logp.Logger, License) bool + +// CheckTrial returns true if the license is in trial and the license is not expired. +func CheckTrial(log *logp.Logger, license License) bool { + log.Debug("Checking trial license") + if license.IsTrial() { + if license.IsTrialExpired() { + log.Error("Trial license is expired") + return false + } + return true + } + return false +} + +// CheckLicenseCover check that the current license cover the requested license. +func CheckLicenseCover(licenseType LicenseType) func(*logp.Logger, License) bool { + return func(log *logp.Logger, license License) bool { + log.Debugf("Checking that license cover %s", licenseType) + if license.Cover(licenseType) && license.IsActive() { + return true + } + return false + } +} + +// CheckBasic returns true if the license is +var CheckBasic = CheckLicenseCover(Basic) + +// Validate uses a set of checks to validate if a license is valid or not and will return true on on the +// first check that validate the license. +func Validate(log *logp.Logger, license License, checks ...CheckFunc) bool { + for _, check := range checks { + if check(log, license) { + return true + } + } + return false +} diff --git a/x-pack/functionbeat/licenser/check_test.go b/x-pack/functionbeat/licenser/check_test.go new file mode 100644 index 000000000000..89ab84cad68e --- /dev/null +++ b/x-pack/functionbeat/licenser/check_test.go @@ -0,0 +1,76 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/logp" +) + +func TestCheckLicense(t *testing.T) { + t.Run("Trial", testCheckTrial) + t.Run("Cover", testCheckLicenseCover) + t.Run("Validate", testValidate) +} + +func testCheckTrial(t *testing.T) { + log := logp.NewLogger("") + + t.Run("valid trial license", func(t *testing.T) { + l := License{ + Mode: Trial, + TrialExpiry: expiryTime(time.Now().Add(1 * time.Hour)), + } + assert.True(t, CheckTrial(log, l)) + }) + + t.Run("expired trial license", func(t *testing.T) { + l := License{ + Mode: Trial, + TrialExpiry: expiryTime(time.Now().Add(-1 * time.Hour)), + } + assert.False(t, CheckTrial(log, l)) + }) + + t.Run("other license", func(t *testing.T) { + l := License{Mode: Basic} + assert.False(t, CheckTrial(log, l)) + }) +} + +func testCheckLicenseCover(t *testing.T) { + log := logp.NewLogger("") + lt := []LicenseType{Basic, Gold, Platinum} + for _, license := range lt { + fn := CheckLicenseCover(license) + + t.Run("active", func(t *testing.T) { + l := License{Mode: license, Status: Active} + assert.True(t, fn(log, l)) + }) + + t.Run("inactive", func(t *testing.T) { + l := License{Mode: license, Status: Inactive} + assert.False(t, fn(log, l)) + }) + } +} + +func testValidate(t *testing.T) { + l := License{Mode: Basic, Status: Active} + t.Run("when one of the check is valid", func(t *testing.T) { + valid := Validate(logp.NewLogger(""), l, CheckLicenseCover(Platinum), CheckLicenseCover(Basic)) + assert.True(t, valid) + }) + + t.Run("when no check is valid", func(t *testing.T) { + valid := Validate(logp.NewLogger(""), l, CheckLicenseCover(Platinum), CheckLicenseCover(Gold)) + assert.False(t, valid) + }) +} diff --git a/x-pack/functionbeat/licenser/elastic_fetcher.go b/x-pack/functionbeat/licenser/elastic_fetcher.go new file mode 100644 index 000000000000..7b8d05fd6255 --- /dev/null +++ b/x-pack/functionbeat/licenser/elastic_fetcher.go @@ -0,0 +1,225 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "encoding/json" + "fmt" + "math/rand" + "net/http" + "strconv" + "time" + + "github.com/pkg/errors" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/libbeat/outputs/elasticsearch" +) + +const xPackURL = "/_xpack" + +// params defaults query parameters to send to the '_xpack' endpoint by default we only need +// machine parseable data. +var params = map[string]string{ + "human": "false", +} + +var stateLookup = map[string]State{ + "inactive": Inactive, + "active": Active, +} + +var licenseLookup = map[string]LicenseType{ + "oss": OSS, + "trial": Trial, + "standard": Standard, + "basic": Basic, + "gold": Gold, + "platinum": Platinum, +} + +// UnmarshalJSON takes a bytes array and convert it to the appropriate license type. +func (t *LicenseType) UnmarshalJSON(b []byte) error { + if len(b) <= 2 { + return fmt.Errorf("invalid string for license type, received: '%s'", string(b)) + } + s := string(b[1 : len(b)-1]) + if license, ok := licenseLookup[s]; ok { + *t = license + return nil + } + + return fmt.Errorf("unknown license type, received: '%s'", s) +} + +// UnmarshalJSON takes a bytes array and convert it to the appropriate state. +func (st *State) UnmarshalJSON(b []byte) error { + // we are only interested in the content between the quotes. + if len(b) <= 2 { + return fmt.Errorf("invalid string for state, received: '%s'", string(b)) + } + + s := string(b[1 : len(b)-1]) + if state, ok := stateLookup[s]; ok { + *st = state + return nil + } + return fmt.Errorf("unknown state, received: '%s'", s) +} + +// UnmarshalJSON takes a bytes array and transform the int64 to a golang time. +func (et *expiryTime) UnmarshalJSON(b []byte) error { + if len(b) < 0 { + return fmt.Errorf("invalid value for expiry time, received: '%s'", string(b)) + } + + ts, err := strconv.Atoi(string(b)) + if err != nil { + return errors.Wrap(err, "could not parse value for expiry time") + } + + *et = expiryTime(time.Unix(0, int64(time.Millisecond)*int64(ts)).UTC()) + return nil +} + +type esclient interface { + Request( + method, + path string, + pipeline string, + params map[string]string, + body interface{}, + ) (int, []byte, error) +} + +// ElasticFetcher wraps an elasticsearch clients to retrieve licensing information +// on a specific cluster. +type ElasticFetcher struct { + client esclient + log *logp.Logger +} + +// NewElasticFetcher creates a new Elastic Fetcher +func NewElasticFetcher(client esclient) *ElasticFetcher { + return &ElasticFetcher{client: client, log: logp.NewLogger("elasticfetcher")} +} + +// Fetch retrieves the license information from an Elasticsearch Client, it will call the `_xpack` +// end point and will return a parsed license. If the `_xpack` endpoint is unreacheable we will +// return the OSS License otherwise we return an error. +func (f *ElasticFetcher) Fetch() (*License, error) { + status, body, err := f.client.Request("GET", xPackURL, "", params, nil) + // When we are running an OSS release of elasticsearch the _xpack endpoint will return a 405, + // "Method Not Allowed", so we return the default OSS license. + if status == http.StatusMethodNotAllowed { + f.log.Debug("Received 'Method Not allowed' (405) response from server, fallback to OSS license") + return OSSLicense, nil + } + + if status == http.StatusUnauthorized { + return nil, errors.New("Unauthorized access, could not connect to the xpack endpoint, verify your credentials") + } + + if status != http.StatusOK { + return nil, fmt.Errorf("error from server, response code: %d", status) + } + + if err != nil { + return nil, errors.Wrap(err, "could not retrieve the license information from the cluster") + } + + license, err := f.parseJSON(body) + if err != nil { + f.log.Debugw("Invalid response from server", "body", string(body)) + return nil, errors.Wrap(err, "could not extract license information from the server response") + } + + return license, nil +} + +// Xpack Response, temporary struct to merge the features into the license struct. +type xpackResponse struct { + License License `json:"license"` + Features features `json:"features"` +} + +func (f *ElasticFetcher) parseJSON(b []byte) (*License, error) { + info := &xpackResponse{} + + if err := json.Unmarshal(b, info); err != nil { + return nil, err + } + + license := info.License + license.Features = info.Features + + return &license, nil +} + +// esClientMux is taking care of round robin request over an array of elasticsearch client, note that +// calling request is not threadsafe. +type esClientMux struct { + clients []elasticsearch.Client + idx int +} + +// Request takes a slice of elasticsearch clients and connect to one randomly and close the connection +// at the end of the function call, if an error occur we return the error and will pick up the next client on the +// next call. Not that we just round robin between hosts, any backoff strategy should be handled by +// the consumer of this type. +func (mux *esClientMux) Request( + method, path string, + pipeline string, + params map[string]string, + body interface{}, +) (int, []byte, error) { + c := mux.clients[mux.idx] + + if err := c.Connect(); err != nil { + return 0, nil, err + } + defer c.Close() + + status, response, err := c.Request(method, path, pipeline, params, body) + if err != nil { + // use next host for next retry + mux.idx = (mux.idx + 1) % len(mux.clients) + } + return status, response, err +} + +// newESClientMux takes a list of clients and randomize where we start and the list of host we are +// querying. +func newESClientMux(clients []elasticsearch.Client) *esClientMux { + // randomize where we start + idx := rand.Intn(len(clients)) + + // randomize the list of round robin hosts. + tmp := make([]elasticsearch.Client, len(clients)) + copy(tmp, clients) + rand.Shuffle(len(tmp), func(i, j int) { + tmp[i], tmp[j] = tmp[j], tmp[i] + }) + + return &esClientMux{idx: idx, clients: tmp} +} + +// Create takes a raw configuration and will create a a license manager based on the elasticsearch +// output configuration, if no output is found we return an error. +func Create(cfg *common.ConfigNamespace, refreshDelay, graceDelay time.Duration) (*Manager, error) { + if !cfg.IsSet() || cfg.Name() != "elasticsearch" { + return nil, ErrNoElasticsearchConfig + } + + clients, err := elasticsearch.NewElasticsearchClients(cfg.Config()) + if err != nil { + return nil, err + } + clientsMux := newESClientMux(clients) + + manager := New(clientsMux, refreshDelay, graceDelay) + return manager, nil +} diff --git a/x-pack/functionbeat/licenser/elastic_fetcher_integration_test.go b/x-pack/functionbeat/licenser/elastic_fetcher_integration_test.go new file mode 100644 index 000000000000..b8def938cc30 --- /dev/null +++ b/x-pack/functionbeat/licenser/elastic_fetcher_integration_test.go @@ -0,0 +1,63 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// +build integration + +package licenser + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common/cli" + "github.com/elastic/beats/libbeat/outputs/elasticsearch" + "github.com/elastic/beats/libbeat/outputs/outil" +) + +const ( + elasticsearchHost = "localhost" + elasticsearchPort = "9200" +) + +func getTestClient() *elasticsearch.Client { + host := "http://" + cli.GetEnvOr("ES_HOST", elasticsearchHost) + ":" + cli.GetEnvOr("ES_POST", elasticsearchPort) + client, err := elasticsearch.NewClient(elasticsearch.ClientSettings{ + URL: host, + Index: outil.MakeSelector(), + Username: cli.GetEnvOr("ES_USER", ""), + Password: cli.GetEnvOr("ES_PASS", ""), + Timeout: 60 * time.Second, + CompressionLevel: 3, + }, nil) + + if err != nil { + panic(err) + } + return client +} + +// Sanity check for schema change on the HTTP response from a live Elasticsearch instance. +func TestElasticsearch(t *testing.T) { + f := NewElasticFetcher(getTestClient()) + license, err := f.Fetch() + if !assert.NoError(t, err) { + return + } + + assert.NotNil(t, license.Get()) + assert.NotNil(t, license.Type) + assert.Equal(t, Active, license.Status) + + assert.NotEmpty(t, license.UUID) + + assert.NotNil(t, license.Features.Graph) + assert.NotNil(t, license.Features.Logstash) + assert.NotNil(t, license.Features.ML) + assert.NotNil(t, license.Features.Monitoring) + assert.NotNil(t, license.Features.Rollup) + assert.NotNil(t, license.Features.Security) + assert.NotNil(t, license.Features.Watcher) +} diff --git a/x-pack/functionbeat/licenser/elastic_fetcher_test.go b/x-pack/functionbeat/licenser/elastic_fetcher_test.go new file mode 100644 index 000000000000..4c71008ce299 --- /dev/null +++ b/x-pack/functionbeat/licenser/elastic_fetcher_test.go @@ -0,0 +1,179 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "encoding/json" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "testing" + "time" + + "github.com/gofrs/uuid" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/outputs/elasticsearch" +) + +func newServerClientPair(t *testing.T, handler http.HandlerFunc) (*httptest.Server, *elasticsearch.Client) { + mux := http.NewServeMux() + mux.Handle("/_xpack/", http.HandlerFunc(handler)) + + server := httptest.NewServer(mux) + + client, err := elasticsearch.NewClient(elasticsearch.ClientSettings{URL: server.URL}, nil) + if err != nil { + t.Fatalf("could not create the elasticsearch client, error: %s", err) + } + + return server, client +} + +func TestParseJSON(t *testing.T) { + t.Run("OSS release of Elasticsearch", func(t *testing.T) { + h := func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "Method Not Allowed", 405) + } + s, c := newServerClientPair(t, h) + defer s.Close() + defer c.Close() + + fetcher := NewElasticFetcher(c) + oss, err := fetcher.Fetch() + if assert.NoError(t, err) { + return + } + + assert.Equal(t, OSSLicense, oss) + }) + + t.Run("malformed JSON", func(t *testing.T) { + h := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("hello bad JSON")) + } + s, c := newServerClientPair(t, h) + defer s.Close() + defer c.Close() + + fetcher := NewElasticFetcher(c) + _, err := fetcher.Fetch() + assert.Error(t, err) + }) + + t.Run("401 response", func(t *testing.T) { + h := func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "Unauthorized", 401) + } + s, c := newServerClientPair(t, h) + defer s.Close() + defer c.Close() + + fetcher := NewElasticFetcher(c) + _, err := fetcher.Fetch() + assert.Equal(t, err.Error(), "Unauthorized access, could not connect to the xpack endpoint, verify your credentials") + }) + + t.Run("any error from the server", func(t *testing.T) { + h := func(w http.ResponseWriter, r *http.Request) { + http.Error(w, "Not found", 404) + } + s, c := newServerClientPair(t, h) + defer s.Close() + defer c.Close() + + fetcher := NewElasticFetcher(c) + _, err := fetcher.Fetch() + assert.Error(t, err) + }) + + t.Run("200 response", func(t *testing.T) { + filepath.Walk("testdata/", func(path string, i os.FileInfo, err error) error { + if i.IsDir() { + return nil + } + + t.Run(path, func(t *testing.T) { + h := func(w http.ResponseWriter, r *http.Request) { + json, err := ioutil.ReadFile(path) + if err != nil { + t.Fatal("could not read JSON") + } + w.Write(json) + } + + s, c := newServerClientPair(t, h) + defer s.Close() + defer c.Close() + + fetcher := NewElasticFetcher(c) + license, err := fetcher.Fetch() + if !assert.NoError(t, err) { + return + } + + id, _ := uuid.FromString("936183d8-f48c-4a3f-959a-a52aa2563279") + assert.Equal(t, id, license.UUID) + + assert.NotNil(t, license.Type) + assert.NotNil(t, license.Mode) + assert.NotNil(t, license.Status) + + assert.False(t, license.Features.Graph.Available) + assert.True(t, license.Features.Graph.Enabled) + + assert.False(t, license.Features.Logstash.Available) + assert.True(t, license.Features.Logstash.Enabled) + + assert.False(t, license.Features.ML.Available) + assert.True(t, license.Features.ML.Enabled) + + assert.True(t, license.Features.Monitoring.Available) + assert.True(t, license.Features.Monitoring.Enabled) + + assert.True(t, license.Features.Rollup.Available) + assert.True(t, license.Features.Rollup.Enabled) + + assert.False(t, license.Features.Security.Available) + assert.True(t, license.Features.Security.Enabled) + + assert.False(t, license.Features.Watcher.Available) + assert.True(t, license.Features.Watcher.Enabled) + }) + + return nil + }) + }) + + t.Run("parse milliseconds", func(t *testing.T) { + t.Run("invalid", func(t *testing.T) { + b := []byte("{ \"v\": \"\"}") + ts := struct { + V expiryTime `json:"v"` + }{} + + err := json.Unmarshal(b, &ts) + assert.Error(t, err) + }) + + t.Run("valid", func(t *testing.T) { + b := []byte("{ \"v\": 1538060781728 }") + ts := struct { + V expiryTime `json:"v"` + }{} + + err := json.Unmarshal(b, &ts) + if !assert.NoError(t, err) { + return + } + + // 2018-09-27 15:06:21.728 +0000 UTC + d := time.Date(2018, 9, 27, 15, 6, 21, 728000000, time.UTC).Sub((time.Time(ts.V))) + assert.Equal(t, time.Duration(0), d) + }) + }) +} diff --git a/x-pack/functionbeat/licenser/license.go b/x-pack/functionbeat/licenser/license.go new file mode 100644 index 000000000000..5634a86a28a1 --- /dev/null +++ b/x-pack/functionbeat/licenser/license.go @@ -0,0 +1,119 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "time" + + "github.com/gofrs/uuid" +) + +// License represents the license of this beat, the license is fetched and returned from +// the elasticsearch cluster. +// +// The x-pack endpoint returns the following JSON response. +// +// "license": { +// "uid": "936183d8-f48c-4a3f-959a-a52aa2563279", +// "type": "platinum", +// "mode": "platinum", +// "status": "active" +// }, +// +// Definition: +// type is the installed license. +// mode is the license in operation. (effective license) +// status is the type installed is active or not. +type License struct { + UUID uuid.UUID `json:"uid"` + Type LicenseType `json:"type"` + Mode LicenseType `json:"mode"` + Status State `json:"status"` + Features features `json:"features"` + TrialExpiry expiryTime `json:"expiry_date_in_millis,omitempty"` +} + +// Features defines the list of features exposed by the elasticsearch cluster. +type features struct { + Graph graph `json:"graph"` + Logstash logstash `json:"logstash"` + ML ml `json:"ml"` + Monitoring monitoring `json:"monitoring"` + Rollup rollup `json:"rollup"` + Security security `json:"security"` + Watcher watcher `json:"watcher"` +} + +type expiryTime time.Time + +// Base define the field common for every feature. +type Base struct { + Enabled bool `json:"enabled"` + Available bool `json:"available"` +} + +// Defines all the avaiables features +type graph struct{ *Base } +type logstash struct{ *Base } +type ml struct{ *Base } +type monitoring struct{ *Base } +type rollup struct{ *Base } +type security struct{ *Base } +type watcher struct{ *Base } + +// Get return the current license +func (l *License) Get() LicenseType { + return l.Mode +} + +// Cover returns true if the provided license is included in the range of license. +// +// Basic -> match basic, gold and platinum +// gold -> match gold and platinum +// platinum -> match platinum only +func (l *License) Cover(license LicenseType) bool { + if l.Mode >= license { + return true + } + return false +} + +// Is returns true if the provided license is an exact match. +func (l *License) Is(license LicenseType) bool { + return l.Mode == license +} + +// IsActive returns true if the current license from the server is active. +func (l *License) IsActive() bool { + return l.Status == Active +} + +// IsTrial returns true if the remote cluster is in trial mode. +func (l *License) IsTrial() bool { + return l.Mode == Trial +} + +// IsTrialExpired returns false if the we are not in trial mode and when we are in trial mode +// we check for the expiry data. +func (l *License) IsTrialExpired() bool { + if !l.IsTrial() { + return false + } + + if time.Time(l.TrialExpiry).Sub(time.Now()) > 0 { + return false + } + + return true +} + +// EqualTo returns true if the two license are the same, we compare license to reduce the number +// message send to the watchers. +func (l *License) EqualTo(other *License) bool { + return l.UUID == other.UUID && + l.Type == other.Type && + l.Mode == other.Mode && + l.Status == other.Status +} diff --git a/x-pack/functionbeat/licenser/license_test.go b/x-pack/functionbeat/licenser/license_test.go new file mode 100644 index 000000000000..174d762851b8 --- /dev/null +++ b/x-pack/functionbeat/licenser/license_test.go @@ -0,0 +1,197 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestLicenseGet(t *testing.T) { + tests := []struct { + name string + t LicenseType + }{ + { + name: "Basic", + t: Basic, + }, + { + name: "Platinum", + t: Platinum, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + l := License{Mode: test.t} + assert.Equal(t, test.t, l.Get()) + }) + } +} + +func TestLicenseIs(t *testing.T) { + tests := []struct { + name string + t LicenseType + query LicenseType + expected bool + }{ + { + name: "Basic and asking for Basic", + t: Basic, + query: Basic, + expected: true, + }, + { + name: "Platinum and asking for Basic", + t: Platinum, + query: Basic, + expected: true, + }, + { + name: "Basic and asking for Platinum", + t: Basic, + query: Platinum, + expected: false, + }, + { + name: "Gold and asking for Gold", + t: Gold, + query: Gold, + expected: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + l := License{Mode: test.t} + assert.Equal(t, test.expected, l.Cover(test.query)) + }) + } +} + +func TestLicenseIsStrict(t *testing.T) { + tests := []struct { + name string + t LicenseType + query LicenseType + expected bool + }{ + { + name: "Basic and asking for Basic", + t: Basic, + query: Basic, + expected: true, + }, + { + name: "Platinum and asking for Basic", + t: Platinum, + query: Basic, + expected: false, + }, + { + name: "Basic and asking for Platinum", + t: Basic, + query: Platinum, + expected: false, + }, + { + name: "Gold and asking for Gold", + t: Gold, + query: Gold, + expected: true, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + l := License{Mode: test.t} + assert.Equal(t, test.expected, l.Is(test.query)) + }) + } +} + +func TestIsActive(t *testing.T) { + tests := []struct { + name string + l License + expected bool + }{ + { + name: "active", + l: License{Status: Active}, + expected: true, + }, + { + name: "inactive", + l: License{Status: Inactive}, + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, test.l.IsActive()) + }) + } +} + +func TestIsTrial(t *testing.T) { + tests := []struct { + name string + l License + expected bool + }{ + { + name: "is a trial license", + l: License{Mode: Trial}, + expected: true, + }, + { + name: "is not a trial license", + l: License{Mode: Basic}, + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, test.l.IsTrial()) + }) + } +} + +func TestIsTrialExpired(t *testing.T) { + tests := []struct { + name string + l License + expected bool + }{ + { + name: "trial is expired", + l: License{Mode: Trial, TrialExpiry: expiryTime(time.Now().Add(-2 * time.Hour))}, + expected: true, + }, + { + name: "trial is not expired", + l: License{Mode: Trial, TrialExpiry: expiryTime(time.Now().Add(2 * time.Minute))}, + expected: false, + }, + { + name: "license is not on trial", + l: License{Mode: Basic, TrialExpiry: expiryTime(time.Now().Add(2 * time.Minute))}, + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, test.l.IsTrialExpired()) + }) + } +} diff --git a/x-pack/functionbeat/licenser/licensetype_string.go b/x-pack/functionbeat/licenser/licensetype_string.go new file mode 100644 index 000000000000..b66f56c7561c --- /dev/null +++ b/x-pack/functionbeat/licenser/licensetype_string.go @@ -0,0 +1,20 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Code generated by "stringer -type=LicenseType -linecomment=true"; DO NOT EDIT. + +package licenser + +import "strconv" + +const _LicenseType_name = "Open sourceTrialBasicStandardGoldPlatinum" + +var _LicenseType_index = [...]uint8{0, 11, 16, 21, 29, 33, 41} + +func (i LicenseType) String() string { + if i < 0 || i >= LicenseType(len(_LicenseType_index)-1) { + return "LicenseType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _LicenseType_name[_LicenseType_index[i]:_LicenseType_index[i+1]] +} diff --git a/x-pack/functionbeat/licenser/manager.go b/x-pack/functionbeat/licenser/manager.go new file mode 100644 index 000000000000..6d1b08dc8e52 --- /dev/null +++ b/x-pack/functionbeat/licenser/manager.go @@ -0,0 +1,354 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "context" + "errors" + "fmt" + "math/rand" + "sync" + "time" + + "github.com/gofrs/uuid" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" +) + +func mustUUIDV4() uuid.UUID { + uuid, err := uuid.NewV4() + if err != nil { + panic(err) + } + return uuid +} + +// OSSLicense default license to use. +var ( + OSSLicense = &License{ + UUID: mustUUIDV4(), + Type: OSS, + Mode: OSS, + Status: Active, + Features: features{ + Graph: graph{}, + Logstash: logstash{}, + ML: ml{}, + Monitoring: monitoring{}, + Rollup: rollup{}, + Security: security{}, + Watcher: watcher{}, + }, + } +) + +// Watcher allows a type to receive a new event when a new license is received. +type Watcher interface { + OnNewLicense(license License) + OnManagerStopped() +} + +// Fetcher interface implements the mechanism to retrieve a License. Currently we only +// support license coming from the '/_xpack' rest api. +type Fetcher interface { + Fetch() (*License, error) +} + +// Errors returned by the manager. +var ( + ErrWatcherAlreadyExist = errors.New("watcher already exist") + ErrWatcherDoesntExist = errors.New("watcher doesn't exist") + + ErrManagerStopped = errors.New("license manager is stopped") + ErrNoLicenseFound = errors.New("no license found") + + ErrNoElasticsearchConfig = errors.New("no elasticsearch output configuration found, verify your configuration") +) + +// Backoff values when the remote cluster is not responding. +var ( + maxBackoff = 60 * time.Second + initBackoff = 1 * time.Second + jitterCap = 1000 // 1000 milliseconds +) + +// Manager keeps tracks of license management, it uses a fetcher usually the ElasticFetcher to +// retrieve a licence from a specific cluster. +// +// Starting the manager will start a go routine to periodically query the license fetcher. +// if an error occur on the fetcher we will retry until we successfully +// receive a new license. During that period we start a grace counter, we assume the license is +// still valid during the grace period, when this period expire we will keep retrying but the previous +// license will be invalidated and we will fallback to the OSS license. +// +// Retrieving the current license: +// - Call the `Get()` on the manager instance. +// - Or register a `Watcher` with the manager to receive the new license and acts on it, you will +// also receive an event when the Manager is stopped. +// +// +// Notes: +// - When the manager is started no license is set by default. +// - When a license is invalidated, we fallback to the OSS License and the watchers get notified. +// - Adding a watcher will automatically send the current license to the newly added watcher if +// available. +type Manager struct { + done chan struct{} + sync.RWMutex + wg sync.WaitGroup + fetcher Fetcher + duration time.Duration + gracePeriod time.Duration + license *License + watchers map[Watcher]Watcher + log *logp.Logger +} + +// New takes an elasticsearch client and wraps it into a fetcher, the fetch will handle the JSON +// and response code from the cluster. +func New(client esclient, duration time.Duration, gracePeriod time.Duration) *Manager { + fetcher := NewElasticFetcher(client) + return NewWithFetcher(fetcher, duration, gracePeriod) +} + +// NewWithFetcher takes a fetcher and return a license manager. +func NewWithFetcher(fetcher Fetcher, duration time.Duration, gracePeriod time.Duration) *Manager { + m := &Manager{ + fetcher: fetcher, + duration: duration, + log: logp.NewLogger("license-manager"), + done: make(chan struct{}), + gracePeriod: gracePeriod, + watchers: make(map[Watcher]Watcher), + } + + return m +} + +// AddWatcher register a new watcher to receive events when the license is retrieved or when the manager +// is closed. +func (m *Manager) AddWatcher(watcher Watcher) error { + m.Lock() + defer m.Unlock() + + if _, ok := m.watchers[watcher]; ok { + return ErrWatcherAlreadyExist + } + + m.watchers[watcher] = watcher + + // when we register a new watchers send the current license unless we did not retrieve it. + if m.license != nil { + watcher.OnNewLicense(*m.license) + } + return nil +} + +// RemoveWatcher removes the watcher if it exist or return an error. +func (m *Manager) RemoveWatcher(watcher Watcher) error { + m.Lock() + defer m.Unlock() + if _, ok := m.watchers[watcher]; ok { + delete(m.watchers, watcher) + return nil + } + return ErrWatcherDoesntExist +} + +// Get return the current active license, it can return an error if the manager is stopped or when +// there is no license in the manager, Instead of querying the Manager it is easier to register a +// watcher to listen to license change. +func (m *Manager) Get() (*License, error) { + m.Lock() + defer m.Unlock() + + select { + case <-m.done: + return nil, ErrManagerStopped + default: + if m.license == nil { + return nil, ErrNoLicenseFound + } + return m.license, nil + } +} + +// Start starts the License manager, the manager will start a go routine to periodically +// retrieve the license from the fetcher. +func (m *Manager) Start() { + // First update should be in sync at startup to ensure a + // consistent state. + m.log.Info("License manager started, retrieving initial license") + m.wg.Add(1) + go m.worker() +} + +// Stop terminates the license manager, the go routine will be stopped and the cached license will +// be removed and no more checks can be done on the manager. +func (m *Manager) Stop() { + select { + case <-m.done: + m.log.Error("License manager already stopped") + default: + } + + defer m.log.Info("License manager stopped") + defer m.notify(func(w Watcher) { + w.OnManagerStopped() + }) + + // stop the periodic check license and wait for it to complete + close(m.done) + m.wg.Wait() + + // invalidate current license + m.Lock() + defer m.Unlock() + m.license = nil +} + +func (m *Manager) notify(op func(Watcher)) { + m.RLock() + defer m.RUnlock() + + if len(m.watchers) == 0 { + m.log.Debugf("No watchers configured") + return + } + + m.log.Debugf("Notifying %d watchers", len(m.watchers)) + for _, w := range m.watchers { + op(w) + } +} + +func (m *Manager) worker() { + defer m.wg.Done() + m.log.Debugf("Starting periodic license check, refresh: %s grace: %s ", m.duration, m.gracePeriod) + defer m.log.Debug("Periodic license check is stopped") + + jitter := rand.Intn(jitterCap) + + // Add some jitter to space requests from a large fleet of beats. + select { + case <-time.After(time.Duration(jitter) * time.Millisecond): + } + + // eager initial check. + m.update() + + // periodically checks license. + for { + select { + case <-m.done: + return + case <-time.After(m.duration): + m.log.Debug("License is too old, updating, grace period: %s", m.gracePeriod) + m.update() + } + } +} + +func (m *Manager) update() { + backoff := common.NewBackoff(m.done, initBackoff, maxBackoff) + startedAt := time.Now() + for { + select { + case <-m.done: + return + default: + license, err := m.fetcher.Fetch() + if err != nil { + m.log.Infof("Cannot retrieve license, retrying later, error: %+v", err) + + // check if the license is still in the grace period. + // permit some operations if the license could not be checked + // right away. This is to smooth any networks problems. + if grace := time.Now().Sub(startedAt); grace > m.gracePeriod { + m.log.Info("Grace period expired, invalidating license") + m.invalidate() + } else { + m.log.Debugf("License is too old, grace time remaining: %s", m.gracePeriod-grace) + } + + backoff.Wait() + continue + } + + // we have a valid license, notify watchers and sleep until next check. + m.log.Infow( + "Valid license retrieved", + "license mode", + license.Get(), + "type", + license.Type, + "status", + license.Status, + ) + m.saveAndNotify(license) + return + } + } +} + +func (m *Manager) saveAndNotify(license *License) { + if !m.save(license) { + return + } + + l := *license + m.notify(func(w Watcher) { + w.OnNewLicense(l) + }) +} + +func (m *Manager) save(license *License) bool { + m.Lock() + defer m.Unlock() + + // License didn't change no need to notify watchers. + if m.license != nil && m.license.EqualTo(license) { + return false + } + defer m.log.Debug("License information updated") + + m.license = license + return true +} + +func (m *Manager) invalidate() { + defer m.log.Debug("Invalidate cached license, fallback to OSS") + m.saveAndNotify(OSSLicense) +} + +// WaitForLicense transforms the async manager into a sync check, this is useful if you want +// to block you application until you have received an initial license from the cluster, the manager +// is not affected and will stay asynchronous. +func WaitForLicense(ctx context.Context, log *logp.Logger, manager *Manager, checks ...CheckFunc) (err error) { + log.Info("Waiting on synchronous license check") + received := make(chan struct{}) + callback := CallbackWatcher{New: func(license License) { + log.Debug("Validating license") + if !Validate(log, license, checks...) { + err = errors.New("invalid license") + } + close(received) + log.Infof("License is valid, mode: %s", license.Get()) + }} + + if err := manager.AddWatcher(&callback); err != nil { + return err + } + defer manager.RemoveWatcher(&callback) + + select { + case <-ctx.Done(): + return fmt.Errorf("license check was interrupted") + case <-received: + } + + return err +} diff --git a/x-pack/functionbeat/licenser/manager_test.go b/x-pack/functionbeat/licenser/manager_test.go new file mode 100644 index 000000000000..f17994179e12 --- /dev/null +++ b/x-pack/functionbeat/licenser/manager_test.go @@ -0,0 +1,345 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/logp" +) + +type message struct { + license *License + err error +} + +type mockFetcher struct { + sync.Mutex + bus chan message + last *message +} + +func newMockFetcher() *mockFetcher { + return &mockFetcher{bus: make(chan message, 1)} +} + +func (m *mockFetcher) Fetch() (*License, error) { + m.Lock() + defer m.Unlock() + for { + select { + case message := <-m.bus: + m.last = &message + + // assume other calls to receive the same value, + // until we change it. + return message.license, message.err + default: + if m.last != nil { + return m.last.license, m.last.err + } + continue + } + } +} + +func (m *mockFetcher) Insert(license *License, err error) { + m.bus <- message{license: license, err: err} +} + +func (m *mockFetcher) Close() { + close(m.bus) +} + +func TestRetrieveLicense(t *testing.T) { + i := &License{ + UUID: mustUUIDV4(), + Type: Basic, + Mode: Basic, + Status: Active, + } + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + t.Run("return an error if the manager is stopped", func(t *testing.T) { + m := NewWithFetcher(mock, time.Duration(2*time.Second), time.Duration(1*time.Second)) + m.Start() + m.Stop() + + _, err := m.Get() + + assert.Error(t, ErrManagerStopped, err) + }) + + t.Run("at startup when no license is retrieved return an error", func(t *testing.T) { + mck := newMockFetcher() + mck.Insert(nil, errors.New("not found")) + defer mck.Close() + + m := NewWithFetcher(mck, time.Duration(2*time.Second), time.Duration(1*time.Second)) + m.Start() + defer m.Stop() + _, err := m.Get() + + assert.Error(t, ErrNoLicenseFound, err) + }) + + t.Run("at startup", func(t *testing.T) { + m := NewWithFetcher(mock, time.Duration(2*time.Second), time.Duration(1*time.Second)) + m.Start() + defer m.Stop() + + // Lets us find the first license. + time.Sleep(1 * time.Second) + _, err := m.Get() + + assert.NoError(t, err) + }) + + t.Run("periodically", func(t *testing.T) { + period := time.Duration(1) + m := NewWithFetcher(mock, period, time.Duration(5*time.Second)) + + m.Start() + defer m.Stop() + + // Lets us find the first license. + time.Sleep(1 * time.Second) + + l, err := m.Get() + if !assert.NoError(t, err) { + return + } + if !assert.True(t, l.Is(Basic)) { + return + } + + i := &License{ + UUID: mustUUIDV4(), + Type: Platinum, + Mode: Platinum, + Status: Active, + } + mock.Insert(i, nil) + + select { + case <-time.After(time.Duration(1 * time.Second)): + l, err := m.Get() + if !assert.NoError(t, err) { + return + } + assert.True(t, l.Is(Platinum)) + } + }) +} + +func TestWatcher(t *testing.T) { + i := &License{ + UUID: mustUUIDV4(), + Type: Basic, + Mode: Basic, + Status: Active, + } + + t.Run("watcher must be uniquely registered", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(2*time.Second), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + w := CallbackWatcher{New: func(license License) {}} + + err := m.AddWatcher(&w) + if assert.NoError(t, err) { + return + } + defer m.RemoveWatcher(&w) + + err = m.AddWatcher(&w) + assert.Error(t, ErrWatcherAlreadyExist, err) + }) + + t.Run("cannot remove non existing watcher", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(2*time.Second), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + w := CallbackWatcher{New: func(license License) {}} + + err := m.RemoveWatcher(&w) + + assert.Error(t, ErrWatcherDoesntExist, err) + }) + + t.Run("adding a watcher trigger a a new license callback", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(2*time.Second), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + chanLicense := make(chan License) + defer close(chanLicense) + + w := CallbackWatcher{ + New: func(license License) { + chanLicense <- license + }, + } + + m.AddWatcher(&w) + defer m.RemoveWatcher(&w) + + select { + case license := <-chanLicense: + assert.Equal(t, Basic, license.Get()) + } + }) + + t.Run("periodically trigger a new license callback when the license change", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(1), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + chanLicense := make(chan License) + defer close(chanLicense) + + w := CallbackWatcher{ + New: func(license License) { + chanLicense <- license + }, + } + + m.AddWatcher(&w) + defer m.RemoveWatcher(&w) + + c := 0 + for { + select { + case license := <-chanLicense: + if c == 0 { + assert.Equal(t, Basic, license.Get()) + mock.Insert(&License{ + UUID: mustUUIDV4(), + Type: Platinum, + Mode: Platinum, + Status: Active, + }, nil) + c++ + continue + } + assert.Equal(t, Platinum, license.Get()) + return + } + } + }) + + t.Run("trigger OnManagerStopped when the manager is stopped", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(1), time.Duration(1*time.Second)) + m.Start() + + var wg sync.WaitGroup + + wg.Add(1) + w := CallbackWatcher{ + Stopped: func() { + wg.Done() + }, + } + + m.AddWatcher(&w) + defer m.RemoveWatcher(&w) + + m.Stop() + + wg.Wait() + }) +} + +func TestWaitForLicense(t *testing.T) { + i := &License{ + UUID: mustUUIDV4(), + Type: Basic, + Mode: Basic, + Status: Active, + } + + t.Run("when license is available and valid", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(1), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + err := WaitForLicense(context.Background(), logp.NewLogger(""), m, CheckBasic) + assert.NoError(t, err) + }) + + t.Run("when license is available and not valid", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(1), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + err := WaitForLicense(context.Background(), logp.NewLogger(""), m, CheckLicenseCover(Platinum)) + assert.Error(t, err) + }) + + t.Run("when license is not available we can still interrupt", func(t *testing.T) { + mock := newMockFetcher() + mock.Insert(i, nil) + defer mock.Close() + + m := NewWithFetcher(mock, time.Duration(1), time.Duration(1*time.Second)) + + m.Start() + defer m.Stop() + + ctx, cancel := context.WithCancel(context.Background()) + executed := make(chan struct{}) + go func() { + err := WaitForLicense(ctx, logp.NewLogger(""), m, CheckLicenseCover(Platinum)) + assert.Error(t, err) + close(executed) + }() + cancel() + <-executed + }) +} diff --git a/x-pack/functionbeat/licenser/state_string.go b/x-pack/functionbeat/licenser/state_string.go new file mode 100644 index 000000000000..eb3144c8dc74 --- /dev/null +++ b/x-pack/functionbeat/licenser/state_string.go @@ -0,0 +1,20 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// Code generated by "stringer -type=State"; DO NOT EDIT. + +package licenser + +import "strconv" + +const _State_name = "InactiveActive" + +var _State_index = [...]uint8{0, 8, 14} + +func (i State) String() string { + if i < 0 || i >= State(len(_State_index)-1) { + return "State(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _State_name[_State_index[i]:_State_index[i+1]] +} diff --git a/x-pack/functionbeat/licenser/testdata/x-pack-trial-6.4.0.json b/x-pack/functionbeat/licenser/testdata/x-pack-trial-6.4.0.json new file mode 100644 index 000000000000..b0741cc9d190 --- /dev/null +++ b/x-pack/functionbeat/licenser/testdata/x-pack-trial-6.4.0.json @@ -0,0 +1,43 @@ +{ + "build": { + "hash": "595516e", + "date": "2018-08-17T23:22:27.102119Z" + }, + "license": { + "uid": "936183d8-f48c-4a3f-959a-a52aa2563279", + "type": "trial", + "mode": "trial", + "status": "active", + "expiry_date_in_millis": 1538060781728 + }, + "features": { + "graph": { + "available": false, + "enabled": true + }, + "logstash": { + "available": false, + "enabled": true + }, + "ml": { + "available": false, + "enabled": true + }, + "monitoring": { + "available": true, + "enabled": true + }, + "rollup": { + "available": true, + "enabled": true + }, + "security": { + "available": false, + "enabled": true + }, + "watcher": { + "available": false, + "enabled": true + } + } +} diff --git a/x-pack/functionbeat/licenser/testdata/xpack-6.4.0.json b/x-pack/functionbeat/licenser/testdata/xpack-6.4.0.json new file mode 100644 index 000000000000..a527dec82f35 --- /dev/null +++ b/x-pack/functionbeat/licenser/testdata/xpack-6.4.0.json @@ -0,0 +1,42 @@ +{ + "build": { + "hash": "053779d", + "date": "2018-07-20T05:25:16.206115Z" + }, + "license": { + "uid": "936183d8-f48c-4a3f-959a-a52aa2563279", + "type": "platinum", + "mode": "platinum", + "status": "active" + }, + "features": { + "graph": { + "available": false, + "enabled": true + }, + "logstash": { + "available": false, + "enabled": true + }, + "ml": { + "available": false, + "enabled": true + }, + "monitoring": { + "available": true, + "enabled": true + }, + "rollup": { + "available": true, + "enabled": true + }, + "security": { + "available": false, + "enabled": true + }, + "watcher": { + "available": false, + "enabled": true + } + } +} diff --git a/x-pack/functionbeat/licenser/types.go b/x-pack/functionbeat/licenser/types.go new file mode 100644 index 000000000000..3c5c51a6b082 --- /dev/null +++ b/x-pack/functionbeat/licenser/types.go @@ -0,0 +1,27 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package licenser + +// LicenseType defines what kind of license is currently available. +type LicenseType int + +//go:generate stringer -type=LicenseType -linecomment=true +const ( + OSS LicenseType = iota // Open source + Trial // Trial + Basic // Basic + Standard // Standard + Gold // Gold + Platinum // Platinum +) + +// State of the license can be active or inactive. +type State int + +//go:generate stringer -type=State +const ( + Inactive State = iota + Active +) diff --git a/x-pack/functionbeat/magefile.go b/x-pack/functionbeat/magefile.go new file mode 100644 index 000000000000..5d6644064c1c --- /dev/null +++ b/x-pack/functionbeat/magefile.go @@ -0,0 +1,81 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +// +build mage + +package main + +import ( + "fmt" + "time" + + "github.com/magefile/mage/mg" + "github.com/magefile/mage/sh" + + "github.com/elastic/beats/dev-tools/mage" +) + +func init() { + mage.BeatDescription = "Functionbeat is a beat implementation for a serverless architecture." +} + +// Build builds the Beat binary. +func Build() error { + return mage.Build(mage.DefaultBuildArgs()) +} + +// GolangCrossBuild build the Beat binary inside of the golang-builder. +// Do not use directly, use crossBuild instead. +func GolangCrossBuild() error { + return mage.GolangCrossBuild(mage.DefaultGolangCrossBuildArgs()) +} + +// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon). +func BuildGoDaemon() error { + return mage.BuildGoDaemon() +} + +// CrossBuild cross-builds the beat for all target platforms. +func CrossBuild() error { + return mage.CrossBuild() +} + +// CrossBuildGoDaemon cross-builds the go-daemon binary using Docker. +func CrossBuildGoDaemon() error { + return mage.CrossBuildGoDaemon() +} + +// Clean cleans all generated files and build artifacts. +func Clean() error { + return mage.Clean() +} + +// Package packages the Beat for distribution. +// Use SNAPSHOT=true to build snapshots. +// Use PLATFORMS to control the target platforms. +func Package() { + start := time.Now() + defer func() { fmt.Println("package ran for", time.Since(start)) }() + + mage.MustUsePackaging("functionbeat", "x-pack/functionbeat/dev-tools/packaging/packages.yml") + + mg.Deps(Update) + mg.Deps(CrossBuild, CrossBuildGoDaemon) + mg.SerialDeps(mage.Package, TestPackages) +} + +// TestPackages tests the generated packages (i.e. file modes, owners, groups). +func TestPackages() error { + return mage.TestPackages() +} + +// Update updates the generated files (aka make update). +func Update() error { + return sh.Run("make", "update") +} + +// Fields generates a fields.yml for the Beat. +func Fields() error { + return mage.GenerateFieldsYAML() +} diff --git a/x-pack/functionbeat/main.go b/x-pack/functionbeat/main.go new file mode 100644 index 000000000000..7ab1bfdf2263 --- /dev/null +++ b/x-pack/functionbeat/main.go @@ -0,0 +1,17 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package main + +import ( + "os" + + "github.com/elastic/beats/x-pack/functionbeat/cmd" +) + +func main() { + if err := cmd.RootCmd.Execute(); err != nil { + os.Exit(1) + } +} diff --git a/x-pack/functionbeat/main_test.go b/x-pack/functionbeat/main_test.go new file mode 100644 index 000000000000..0475e667da80 --- /dev/null +++ b/x-pack/functionbeat/main_test.go @@ -0,0 +1,31 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package main + +// This file is mandatory as otherwise the functionbeat.test binary is not generated correctly. + +import ( + "flag" + "testing" + + "github.com/elastic/beats/x-pack/functionbeat/cmd" +) + +var systemTest *bool + +func init() { + systemTest = flag.Bool("systemTest", false, "Set to true when running system tests") + + cmd.RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("systemTest")) + cmd.RootCmd.PersistentFlags().AddGoFlag(flag.CommandLine.Lookup("test.coverprofile")) +} + +// Test started when the test binary is started. Only calls main. +func TestSystem(t *testing.T) { + + if *systemTest { + main() + } +} diff --git a/x-pack/functionbeat/make.bat b/x-pack/functionbeat/make.bat new file mode 100644 index 000000000000..9fe6b2b801e2 --- /dev/null +++ b/x-pack/functionbeat/make.bat @@ -0,0 +1,11 @@ +@echo off + +REM Windows wrapper for Mage (https://magefile.org/) that installs it +REM to %GOPATH%\bin from the Beats vendor directory. +REM +REM After running this once you may invoke mage.exe directly. + +WHERE mage +IF %ERRORLEVEL% NEQ 0 go install github.com/ph/functionbeat/vendor/github.com/magefile/mage + +mage %* diff --git a/x-pack/functionbeat/provider/aws/api_gateway_proxy.go b/x-pack/functionbeat/provider/aws/api_gateway_proxy.go new file mode 100644 index 000000000000..e2ccbf97c9f6 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/api_gateway_proxy.go @@ -0,0 +1,84 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" + "github.com/elastic/beats/x-pack/functionbeat/provider/aws/transformer" +) + +type message struct { + RequestID string `json:"request_id"` + Status int `json:"status"` + Message string `json:"message"` +} + +// APIGatewayProxy receives events from the web service and forward them to elasticsearch. +type APIGatewayProxy struct { + log *logp.Logger +} + +// NewAPIGatewayProxy creates a new function to receives events from the web api gateway. +func NewAPIGatewayProxy(provider provider.Provider, config *common.Config) (provider.Function, error) { + return &APIGatewayProxy{log: logp.NewLogger("api gateway proxy")}, nil +} + +// Run starts the lambda function and wait for web triggers. +func (a *APIGatewayProxy) Run(_ context.Context, client core.Client) error { + lambda.Start(a.createHandler(client)) + return nil +} + +func (a *APIGatewayProxy) createHandler( + client core.Client, +) func(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { + return func(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { + a.log.Debugf("The handler receives a new event from the gateway (requestID: %s)", request.RequestContext.RequestID) + event := transformer.APIGatewayProxyRequest(request) + if err := client.Publish(event); err != nil { + a.log.Errorf("could not publish event to the pipeline, error: %+v", err) + return buildResponse( + http.StatusInternalServerError, + "an error occurred when sending the event.", + request.RequestContext.RequestID, + ), err + } + client.Wait() + return buildResponse( + http.StatusOK, + "event received successfully.", + request.RequestContext.RequestID, + ), nil + } +} + +func buildResponse( + statusCode int, + responseMsg string, + requestID string, +) events.APIGatewayProxyResponse { + body, _ := json.Marshal(message{Status: statusCode, Message: responseMsg, RequestID: requestID}) + + return events.APIGatewayProxyResponse{ + StatusCode: statusCode, + Headers: map[string]string{"Content-Type": "application/json"}, + Body: string(body), + } +} + +// Name return the name of the lambda function. +func (a *APIGatewayProxy) Name() string { + return "api_gateway_proxy" +} diff --git a/x-pack/functionbeat/provider/aws/api_gateway_proxy_test.go b/x-pack/functionbeat/provider/aws/api_gateway_proxy_test.go new file mode 100644 index 000000000000..81683fbb3278 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/api_gateway_proxy_test.go @@ -0,0 +1,92 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "encoding/json" + "errors" + "net/http" + "testing" + + "github.com/aws/aws-lambda-go/events" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +func TestAPIGatewayProxy(t *testing.T) { + cfg := common.MustNewConfigFrom(map[string]interface{}{ + "name": "foobar", + }) + + t.Run("when publish is succesful", func(t *testing.T) { + t.SkipNow() + client := &arrayBackedClient{} + s, err := NewAPIGatewayProxy(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := s.(*APIGatewayProxy) + handler := c.createHandler(client) + res, err := handler(generateAPIGatewayProxyEvent()) + assert.NoError(t, err) + assert.Equal(t, res.StatusCode, http.StatusOK) + ty, _ := res.Headers["Content-Type"] + assert.Equal(t, "application/json", ty) + + message, err := unserializeResponse(res.Body) + if !assert.NoError(t, err) { + return + } + + assert.Equal(t, "1234", message.RequestID) + assert.Equal(t, "event received successfully.", message.Message) + assert.Equal(t, http.StatusOK, message.Status) + }) + + t.Run("when publish is not succesful", func(t *testing.T) { + e := errors.New("something bad") + client := &arrayBackedClient{err: e} + + s, err := NewAPIGatewayProxy(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := s.(*APIGatewayProxy) + res, err := c.createHandler(client)(generateAPIGatewayProxyEvent()) + assert.Equal(t, e, err) + assert.Equal(t, http.StatusInternalServerError, res.StatusCode) + ty, _ := res.Headers["Content-Type"] + assert.Equal(t, "application/json", ty) + + message, err := unserializeResponse(res.Body) + if !assert.NoError(t, err) { + return + } + + assert.Equal(t, "1234", message.RequestID) + assert.Equal(t, "an error occurred when sending the event.", message.Message) + assert.Equal(t, http.StatusInternalServerError, message.Status) + }) +} + +func generateAPIGatewayProxyEvent() events.APIGatewayProxyRequest { + return events.APIGatewayProxyRequest{ + RequestContext: events.APIGatewayProxyRequestContext{ + RequestID: "1234", + }, + } +} + +func unserializeResponse(raw string) (*message, error) { + message := &message{} + if err := json.Unmarshal([]byte(raw), message); err != nil { + return nil, err + } + return message, nil +} diff --git a/x-pack/functionbeat/provider/aws/aws.go b/x-pack/functionbeat/provider/aws/aws.go new file mode 100644 index 000000000000..be20245f454c --- /dev/null +++ b/x-pack/functionbeat/provider/aws/aws.go @@ -0,0 +1,45 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +// Bundle exposes the trigger supported by the AWS provider. +var Bundle = provider.MustCreate( + "aws", + provider.NewDefaultProvider("aws", NewCLI), + feature.NewDetails("AWS Lambda", "listen to events on AWS lambda", feature.Experimental), +).MustAddFunction("cloudwatch_logs", + NewCloudwatchLogs, + feature.NewDetails( + "Cloudwatch Logs trigger", + "receive events from cloudwatch logs.", + feature.Experimental, + ), +).MustAddFunction("api_gateway_proxy", + NewAPIGatewayProxy, + feature.NewDetails( + "API Gateway proxy trigger", + "receive events from the api gateway proxy", + feature.Experimental, + ), +).MustAddFunction("kinesis", + NewKinesis, + feature.NewDetails( + "Kinesis trigger", + "receive events from a Kinesis stream", + feature.Experimental, + ), +).MustAddFunction("sqs", + NewSQS, + feature.NewDetails( + "SQS trigger", + "receive events from a SQS queue", + feature.Experimental, + ), +).Bundle() diff --git a/x-pack/functionbeat/provider/aws/cli_manager.go b/x-pack/functionbeat/provider/aws/cli_manager.go new file mode 100644 index 000000000000..c70b73b26860 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/cli_manager.go @@ -0,0 +1,360 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "crypto/sha256" + "encoding/base64" + "errors" + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/external" + "github.com/awslabs/goformation/cloudformation" + merrors "github.com/pkg/errors" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +const ( + // AWS lambda currently support go 1.x as a runtime. + runtime = "go1.x" + handlerName = "functionbeat" + + // invalidChars for resource name + invalidChars = ":-/" +) + +// AWSLambdaFunction add 'dependsOn' as a serializable parameters, for no good reason it's +// not supported. +type AWSLambdaFunction struct { + *cloudformation.AWSLambdaFunction + DependsOn []string +} + +type installer interface { + Template() *cloudformation.Template + LambdaConfig() *lambdaConfig +} + +// CLIManager interacts with the AWS Lambda API to deploy, update or remove a function. +// It will take care of creating the main lambda function and ask for each function type for the +// operation that need to be executed to connect the lambda to the triggers. +type CLIManager struct { + provider provider.Provider + awsCfg aws.Config + log *logp.Logger + config *Config +} + +func (c *CLIManager) findFunction(name string) (installer, error) { + fn, err := c.provider.FindFunctionByName(name) + if err != nil { + return nil, err + } + + function, ok := fn.(installer) + if !ok { + return nil, errors.New("incompatible type received, expecting: 'functionManager'") + } + + return function, nil +} + +func (c *CLIManager) template(function installer, name, templateLoc string) *cloudformation.Template { + lambdaConfig := function.LambdaConfig() + + prefix := func(s string) string { + return "fnb" + name + s + } + + // AWS variables references:. + // AWS::Partition: aws, aws-cn, aws-gov. + // AWS::Region: us-east-1, us-east-2, ap-northeast-3, + // AWS::AccountId: account id for the current request. + // AWS::URLSuffix: amazonaws.com + // + // Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/Welcome.html + // Intrinsic function reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html + + // Create the roles for the lambda. + template := cloudformation.NewTemplate() + // doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html + template.Resources["IAMRoleLambdaExecution"] = &cloudformation.AWSIAMRole{ + AssumeRolePolicyDocument: map[string]interface{}{ + "Statement": []interface{}{ + map[string]interface{}{ + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": map[string]interface{}{ + "Service": cloudformation.Join("", []string{ + "lambda.", + cloudformation.Ref("AWS::URLSuffix"), + }), + }, + }, + }, + }, + Path: "/", + RoleName: "functionbeat-lambda-" + name, + // Allow the lambda to write log to cloudwatch logs. + // doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html + Policies: []cloudformation.AWSIAMRole_Policy{ + cloudformation.AWSIAMRole_Policy{ + PolicyName: cloudformation.Join("-", []string{"fnb", "lambda", name}), + PolicyDocument: map[string]interface{}{ + "Statement": []map[string]interface{}{ + map[string]interface{}{ + "Action": []string{"logs:CreateLogStream", "Logs:PutLogEvents"}, + "Effect": "Allow", + "Resource": []string{ + cloudformation.Sub("arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/" + name + ":*"), + }, + }, + }, + }, + }, + }, + } + + // Configure the Dead letter, any failed events will be send to the configured amazon resource name. + var dlc *cloudformation.AWSLambdaFunction_DeadLetterConfig + if lambdaConfig.DeadLetterConfig != nil && len(lambdaConfig.DeadLetterConfig.TargetArn) != 0 { + dlc = &cloudformation.AWSLambdaFunction_DeadLetterConfig{ + TargetArn: lambdaConfig.DeadLetterConfig.TargetArn, + } + } + + // Create the lambda + // Doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html + template.Resources[prefix("")] = &AWSLambdaFunction{ + AWSLambdaFunction: &cloudformation.AWSLambdaFunction{ + Code: &cloudformation.AWSLambdaFunction_Code{ + S3Bucket: c.bucket(), + S3Key: templateLoc, + }, + Description: lambdaConfig.Description, + Environment: &cloudformation.AWSLambdaFunction_Environment{ + // Configure which function need to be run by the lambda function. + Variables: map[string]string{ + "BEAT_STRICT_PERMS": "false", // Disable any check on disk, we are running with really differents permission on lambda. + "ENABLED_FUNCTIONS": name, + }, + }, + DeadLetterConfig: dlc, + FunctionName: name, + Role: cloudformation.GetAtt("IAMRoleLambdaExecution", "Arn"), + Runtime: runtime, + Handler: handlerName, + MemorySize: lambdaConfig.MemorySize.Megabytes(), + ReservedConcurrentExecutions: lambdaConfig.Concurrency, + Timeout: int(lambdaConfig.Timeout.Seconds()), + }, + DependsOn: []string{"IAMRoleLambdaExecution"}, + } + + // Create the log group for the specific function lambda. + template.Resources[prefix("LogGroup")] = &cloudformation.AWSLogsLogGroup{ + LogGroupName: "/aws/lambda/" + name, + } + + return template +} + +// stackName cloudformation stack are unique per function. +func (c *CLIManager) stackName(name string) string { + return "fnb-" + name + "-stack" +} + +func (c *CLIManager) deployTemplate(update bool, name string) error { + c.log.Debug("Compressing all assets into an artifact") + content, err := core.MakeZip() + if err != nil { + return err + } + c.log.Debugf("Compression is successful (zip size: %d bytes)", len(content)) + + function, err := c.findFunction(name) + if err != nil { + return err + } + + fnTemplate := function.Template() + + codeLoc := codeKey(name, content) + + to := c.template(function, name, codeLoc) + if err := mergeTemplate(to, fnTemplate); err != nil { + return err + } + + json, err := to.JSON() + if err != nil { + return err + } + + c.log.Debugf("Using cloudformation template:\n%s", json) + + executer := newExecutor(c.log) + executer.Add(newOpEnsureBucket(c.log, c.awsCfg, c.bucket())) + executer.Add(newOpUploadToBucket(c.log, c.awsCfg, c.bucket(), codeLoc, content)) + executer.Add(newOpUploadToBucket( + c.log, + c.awsCfg, + c.bucket(), + "functionbeat-deployment/"+name+"/cloudformation-template-create.json", + json, + )) + if update { + executer.Add(newOpUpdateCloudFormation( + c.log, + c.awsCfg, + "https://s3.amazonaws.com/"+c.bucket()+"/functionbeat-deployment/"+name+"/cloudformation-template-create.json", + c.stackName(name), + )) + } else { + executer.Add(newOpCreateCloudFormation( + c.log, + c.awsCfg, + "https://s3.amazonaws.com/"+c.bucket()+"/functionbeat-deployment/"+name+"/cloudformation-template-create.json", + c.stackName(name), + )) + } + + executer.Add(newOpWaitCloudFormation(c.log, c.awsCfg, c.stackName(name))) + executer.Add(newOpDeleteFileBucket(c.log, c.awsCfg, c.bucket(), codeLoc)) + + if err := executer.Execute(); err != nil { + if rollbackErr := executer.Rollback(); rollbackErr != nil { + return merrors.Wrapf(err, "could not rollback, error: %s", rollbackErr) + } + return err + } + return nil +} + +// Deploy delegate deploy to the actual function implementation. +func (c *CLIManager) Deploy(name string) error { + c.log.Debugf("Deploying function: %s", name) + defer c.log.Debugf("Deploy finish for function '%s'", name) + + if err := c.deployTemplate(false, name); err != nil { + return err + } + c.log.Debugf("Successfully created function '%s'", name) + return nil +} + +// Update updates lambda using cloudformation. +func (c *CLIManager) Update(name string) error { + c.log.Debugf("Starting updating function '%s'", name) + defer c.log.Debugf("Update complete for function '%s'", name) + + if err := c.deployTemplate(true, name); err != nil { + return err + } + + c.log.Debugf("Successfully updated function: '%s'") + return nil +} + +// Remove removes a stack and unregister any resources created. +func (c *CLIManager) Remove(name string) error { + c.log.Debugf("Removing function: %s", name) + defer c.log.Debugf("Removal of function '%s' complete", name) + + executer := newExecutor(c.log) + executer.Add(newOpDeleteCloudFormation(c.log, c.awsCfg, c.stackName(name))) + executer.Add(newWaitDeleteCloudFormation(c.log, c.awsCfg, c.stackName(name))) + + if err := executer.Execute(); err != nil { + if rollbackErr := executer.Rollback(); rollbackErr != nil { + return merrors.Wrapf(err, "could not rollback, error: %s", rollbackErr) + } + return err + } + return nil +} + +func (c *CLIManager) bucket() string { + return string(c.config.DeployBucket) +} + +// NewCLI returns the interface to manage function on Amazon lambda. +func NewCLI( + log *logp.Logger, + cfg *common.Config, + provider provider.Provider, +) (provider.CLIManager, error) { + awsCfg, err := external.LoadDefaultAWSConfig() + if err != nil { + return nil, err + } + + config := &Config{} + if err := cfg.Unpack(config); err != nil { + return nil, err + } + + return &CLIManager{ + config: config, + provider: provider, + awsCfg: awsCfg, + log: logp.NewLogger("aws lambda cli"), + }, nil +} + +// mergeTemplate takes two cloudformation and merge them, if a key already exist we return an error. +func mergeTemplate(to, from *cloudformation.Template) error { + merge := func(m1 map[string]interface{}, m2 map[string]interface{}) error { + for k, v := range m2 { + if _, ok := m1[k]; ok { + return fmt.Errorf("key %s already exist in the template map", k) + } + m1[k] = v + } + return nil + } + + err := merge(to.Parameters, from.Parameters) + if err != nil { + return err + } + + err = merge(to.Mappings, from.Mappings) + if err != nil { + return err + } + + err = merge(to.Conditions, from.Conditions) + if err != nil { + return err + } + + err = merge(to.Resources, from.Resources) + if err != nil { + return err + } + + err = merge(to.Outputs, from.Outputs) + if err != nil { + return err + } + + return nil +} + +func normalizeResourceName(s string) string { + return common.RemoveChars(s, invalidChars) +} + +func codeKey(name string, content []byte) string { + sha := sha256.Sum256(content) + checksum := base64.RawURLEncoding.EncodeToString(sha[:]) + return "functionbeat-deployment/" + name + "-" + checksum + "/functionbeat.zip" +} diff --git a/x-pack/functionbeat/provider/aws/cli_manager_test.go b/x-pack/functionbeat/provider/aws/cli_manager_test.go new file mode 100644 index 000000000000..6f4a2906d728 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/cli_manager_test.go @@ -0,0 +1,71 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" +) + +func TestCodeKey(t *testing.T) { + t.Run("same bytes content return the same key", func(t *testing.T) { + name := "hello" + content, err := common.RandomBytes(100) + if !assert.NoError(t, err) { + return + } + + assert.Equal(t, codeKey(name, content), codeKey(name, content)) + }) + + t.Run("different bytes return a different key", func(t *testing.T) { + name := "hello" + content, err := common.RandomBytes(100) + if !assert.NoError(t, err) { + return + } + + other, err := common.RandomBytes(100) + if !assert.NoError(t, err) { + return + } + + assert.NotEqual(t, codeKey(name, content), codeKey(name, other)) + }) +} + +func TestNormalize(t *testing.T) { + tests := []struct { + title string + candidate string + chars string + expected string + }{ + { + title: "when the string contains invalid chars", + candidate: "/var/log-alpha/tmp:ok", + expected: "varlogalphatmpok", + }, + { + title: "when we have an empty string", + candidate: "", + expected: "", + }, + { + title: "when we don't have any invalid chars", + candidate: "hello", + expected: "hello", + }, + } + + for _, test := range tests { + t.Run(test.title, func(t *testing.T) { + assert.Equal(t, test.expected, normalizeResourceName(test.candidate)) + }) + } +} diff --git a/x-pack/functionbeat/provider/aws/cloudwatch_logs.go b/x-pack/functionbeat/provider/aws/cloudwatch_logs.go new file mode 100644 index 000000000000..01e0d9043aa9 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/cloudwatch_logs.go @@ -0,0 +1,212 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "context" + "encoding/json" + "errors" + "fmt" + "regexp" + "strconv" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" + "github.com/awslabs/goformation/cloudformation" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" + "github.com/elastic/beats/x-pack/functionbeat/provider/aws/transformer" +) + +var ( + logGroupNamePattern = "^[\\.\\-_/#A-Za-z0-9]+$" + logGroupNameRE = regexp.MustCompile(logGroupNamePattern) +) + +// CloudwatchLogsConfig is the configuration for the cloudwatchlogs event type. +type CloudwatchLogsConfig struct { + Triggers []*CloudwatchLogsTriggerConfig `config:"triggers"` + Description string `config:"description"` + Name string `config:"name" validate:"nonzero,required"` + LambdaConfig *lambdaConfig `config:",inline"` +} + +// CloudwatchLogsTriggerConfig is the configuration for the specific triggers for cloudwatch. +type CloudwatchLogsTriggerConfig struct { + LogGroupName logGroupName `config:"log_group_name" validate:"nonzero,required"` + FilterPattern string `config:"filter_pattern"` +} + +// Validate validates the configuration. +func (cfg *CloudwatchLogsConfig) Validate() error { + if len(cfg.Triggers) == 0 { + return errors.New("you need to specify at least one trigger") + } + return nil +} + +// DOC: see validations rules at https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html +type logGroupName string + +// Unpack takes a string and validate the log group format. +func (l *logGroupName) Unpack(s string) error { + const max = 512 + const min = 1 + + if len(s) > max { + return fmt.Errorf("log group name '%s' is too long, maximum length is %d", s, max) + } + + if len(s) < min { + return fmt.Errorf("log group name too short, minimum length is %d", min) + } + + if !logGroupNameRE.MatchString(s) { + return fmt.Errorf( + "invalid characters in log group name '%s', name must match regular expression: '%s'", + s, + logGroupNamePattern, + ) + } + *l = logGroupName(s) + return nil +} + +// CloudwatchLogs receives CloudwatchLogs events from a lambda function and forward the logs to +// an Elasticsearch cluster. +type CloudwatchLogs struct { + log *logp.Logger + config *CloudwatchLogsConfig +} + +// NewCloudwatchLogs create a new function to listen to cloudwatch logs events. +func NewCloudwatchLogs(provider provider.Provider, cfg *common.Config) (provider.Function, error) { + config := &CloudwatchLogsConfig{ + LambdaConfig: DefaultLambdaConfig, + } + if err := cfg.Unpack(config); err != nil { + return nil, err + } + return &CloudwatchLogs{log: logp.NewLogger("cloudwatch_logs"), config: config}, nil +} + +// Run start the AWS lambda handles and will transform any events received to the pipeline. +func (c *CloudwatchLogs) Run(_ context.Context, client core.Client) error { + lambda.Start(c.createHandler(client)) + return nil +} + +func (c *CloudwatchLogs) createHandler( + client core.Client, +) func(request events.CloudwatchLogsEvent) error { + return func(request events.CloudwatchLogsEvent) error { + parsedEvent, err := request.AWSLogs.Parse() + if err != nil { + c.log.Errorf("Could not parse events from cloudwatch logs, error: %+v", err) + return err + } + + c.log.Debugf( + "The handler receives %d events (logStream: %s, owner: %s, logGroup: %s, messageType: %s)", + len(parsedEvent.LogEvents), + parsedEvent.LogStream, + parsedEvent.Owner, + parsedEvent.LogGroup, + parsedEvent.MessageType, + ) + + events := transformer.CloudwatchLogs(parsedEvent) + if err := client.PublishAll(events); err != nil { + c.log.Errorf("Could not publish events to the pipeline, error: %+v", err) + return err + } + client.Wait() + return nil + } +} + +// Name returns the name of the function. +func (c CloudwatchLogs) Name() string { + return "cloudwatch_logs" +} + +// AWSLogsSubscriptionFilter overrides the type from goformation to allow to pass an empty string. +// The API support an empty string, but requires one, the original type does not permit that. +type AWSLogsSubscriptionFilter struct { + DestinationArn string `json:"DestinationArn,omitempty"` + FilterPattern string `json:"FilterPattern"` + LogGroupName string `json:"LogGroupName,omitempty"` +} + +// 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 + DeletionPolicy cloudformation.DeletionPolicy `json:"DeletionPolicy,omitempty"` + }{ + Type: r.AWSCloudFormationType(), + Properties: (Properties)(r), + }) +} + +// AWSCloudFormationType return the AWS type. +func (r *AWSLogsSubscriptionFilter) AWSCloudFormationType() string { + return "AWS::Logs::SubscriptionFilter" +} + +// Template returns the cloudformation template for configuring the service with the specified triggers. +func (c *CloudwatchLogs) Template() *cloudformation.Template { + prefix := func(suffix string) string { + return "fnb" + c.config.Name + suffix + } + + template := cloudformation.NewTemplate() + for idx, trigger := range c.config.Triggers { + // doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-permission.html + template.Resources[prefix("Permission"+strconv.Itoa(idx))] = &cloudformation.AWSLambdaPermission{ + Action: "lambda:InvokeFunction", + FunctionName: cloudformation.GetAtt(prefix(""), "Arn"), + Principal: cloudformation.Join("", []string{ + "logs.", + cloudformation.Ref("AWS::Region"), // Use the configuration region. + ".", + cloudformation.Ref("AWS::URLSuffix"), // awsamazon.com or .com.ch + }), + SourceArn: cloudformation.Join( + "", + []string{ + "arn:", + cloudformation.Ref("AWS::Partition"), + ":logs:", + cloudformation.Ref("AWS::Region"), + ":", + cloudformation.Ref("AWS::AccountId"), + ":log-group:", + string(trigger.LogGroupName), + ":*", + }, + ), + } + + // doc: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-subscriptionfilter.html + template.Resources[prefix("SubscriptionFilter"+normalizeResourceName(string(trigger.LogGroupName)))] = &AWSLogsSubscriptionFilter{ + DestinationArn: cloudformation.GetAtt(prefix(""), "Arn"), + FilterPattern: trigger.FilterPattern, + LogGroupName: string(trigger.LogGroupName), + } + } + return template +} + +// LambdaConfig returns the configuration to use when creating the lambda. +func (c *CloudwatchLogs) LambdaConfig() *lambdaConfig { + return c.config.LambdaConfig +} diff --git a/x-pack/functionbeat/provider/aws/cloudwatch_logs_test.go b/x-pack/functionbeat/provider/aws/cloudwatch_logs_test.go new file mode 100644 index 000000000000..eb0dc1e0c219 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/cloudwatch_logs_test.go @@ -0,0 +1,152 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "bytes" + "compress/gzip" + "encoding/base64" + "encoding/json" + "errors" + "testing" + "time" + + "github.com/aws/aws-lambda-go/events" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +type arrayBackedClient struct { + Events []beat.Event + err error +} + +func (a *arrayBackedClient) Publish(event beat.Event) error { + if a.err != nil { + return a.err + } + a.Events = append(a.Events, event) + return nil +} + +func (a *arrayBackedClient) PublishAll(events []beat.Event) error { + if a.err != nil { + return a.err + } + a.Events = append(a.Events, events...) + return nil +} + +func (a *arrayBackedClient) Wait() { return } +func (a *arrayBackedClient) Close() error { return nil } + +func TestCloudwatchLogs(t *testing.T) { + cfg := common.MustNewConfigFrom(map[string]interface{}{ + "name": "foobar", + "description": "my long description", + "role": "arn:aws:iam::00000000:role/functionbeat", + "triggers": []map[string]interface{}{ + map[string]interface{}{ + "log_group_name": "foo", + "filter_name": "bar", + }, + }, + }) + + t.Run("when publish is succesful", func(t *testing.T) { + client := &arrayBackedClient{} + cwl, err := NewCloudwatchLogs(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := cwl.(*CloudwatchLogs) + handler := c.createHandler(client) + + err = handler(generateCloudwatchLogRawEvent()) + + assert.NoError(t, err) + }) + + t.Run("when publish is not succesful", func(t *testing.T) { + e := errors.New("something bad") + client := &arrayBackedClient{err: e} + cwl, err := NewCloudwatchLogs(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := cwl.(*CloudwatchLogs) + handler := c.createHandler(client) + + err = handler(generateCloudwatchLogRawEvent()) + + assert.Equal(t, e, err) + }) +} + +func generateCloudwatchLogRawEvent() events.CloudwatchLogsEvent { + rawEvent := events.CloudwatchLogsData{ + Owner: "foobar", + LogGroup: "foo", + LogStream: "/var/foobar", + LogEvents: []events.CloudwatchLogsLogEvent{ + events.CloudwatchLogsLogEvent{ + ID: "1234", + Timestamp: time.Now().Unix(), + Message: "hello world", + }, + }, + } + + b, _ := json.Marshal(&rawEvent) + + data := new(bytes.Buffer) + encoder := base64.NewEncoder(base64.StdEncoding, data) + zw := gzip.NewWriter(encoder) + zw.Write(b) + zw.Close() + encoder.Close() + + return events.CloudwatchLogsEvent{ + AWSLogs: events.CloudwatchLogsRawData{ + Data: data.String(), + }, + } +} + +func TestLogGroupName(t *testing.T) { + t.Run("valid name", func(t *testing.T) { + l := logGroupName("") + err := l.Unpack("helloworld") + if !assert.NoError(t, err) { + return + } + + assert.Equal(t, logGroupName("helloworld"), l) + }) + + t.Run("fail if contains invalid chars", func(t *testing.T) { + l := logGroupName("") + err := l.Unpack("hello world") + assert.Error(t, err) + }) + + t.Run("fail if too short", func(t *testing.T) { + l := logGroupName("") + err := l.Unpack("") + assert.Error(t, err) + }) + + t.Run("fail if above 512 chars", func(t *testing.T) { + r, _ := common.RandomBytes(513) + l := logGroupName("") + err := l.Unpack(string(r[:513])) + assert.Error(t, err) + }) +} diff --git a/x-pack/functionbeat/provider/aws/config.go b/x-pack/functionbeat/provider/aws/config.go new file mode 100644 index 000000000000..2d94135acd15 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/config.go @@ -0,0 +1,110 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "fmt" + "time" + "unicode" + + humanize "github.com/dustin/go-humanize" + + "github.com/elastic/beats/libbeat/common/cfgwarn" +) + +// Config expose the configuration option the AWS provider. +type Config struct { + DeployBucket bucket `config:"deploy_bucket" validate:"nonzero,required"` +} + +// maxMegabytes maximums memory that a lambda can use. +const maxMegabytes = 3008 + +// DefaultLambdaConfig confguration for AWS lambda function. +var DefaultLambdaConfig = &lambdaConfig{ + MemorySize: 128 * 1024 * 1024, + Timeout: time.Second * 3, + Concurrency: 0, // unreserve +} + +type lambdaConfig struct { + Concurrency int `config:"concurrency" validate:"positive"` + DeadLetterConfig *deadLetterConfig `config:"dead_letter_config"` + Description string `config:"description"` + MemorySize MemSizeFactor64 `config:"memory_size"` + Timeout time.Duration `config:"timeout" validate:"nonzero,positive"` +} + +func (c *lambdaConfig) Validate() error { + if c.MemorySize.Megabytes() == 0 { + return fmt.Errorf("'memory_size' need to be higher than 0 and must be a factor 64") + } + + if c.MemorySize.Megabytes() > maxMegabytes { + return fmt.Errorf("'memory_size' must be lower than %d", maxMegabytes) + } + + return nil +} + +type deadLetterConfig struct { + TargetArn string `config:"target_arn"` +} + +// MemSizeFactor64 implements a human understandable format for bytes but also make sure that all +// values used are a factory of 64. +type MemSizeFactor64 int + +// Unpack converts a size defined from a human readable format into bytes and ensure that the value +// is a factoru of 64. +func (m *MemSizeFactor64) Unpack(v string) error { + sz, err := humanize.ParseBytes(v) + if isRawBytes(v) { + cfgwarn.Deprecate("7.0", "size now requires a unit (KiB, MiB, etc...), current value: %s.", v) + } + if err != nil { + return err + } + + if sz%64 != 0 { + return fmt.Errorf("number is not a factor of 64, %d bytes (user value: %s)", sz, v) + } + + *m = MemSizeFactor64(sz) + return nil +} + +// Megabytes return the value in megatebytes. +func (m *MemSizeFactor64) Megabytes() int { + return int(*m) / 1024 / 1024 +} + +func isRawBytes(v string) bool { + for _, c := range v { + if !unicode.IsDigit(c) { + return false + } + } + return true +} + +type bucket string + +// Do some high level validation on the bucket name, they have strict validations on the name on the API side. +// DOC: https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules +func (b *bucket) Unpack(s string) error { + const max = 63 + const min = 3 + if len(s) > max { + return fmt.Errorf("bucket name '%s' is too long, name are restricted to %d chars", s, max) + } + + if len(s) < min { + return fmt.Errorf("bucket name '%s' is too short, name need to be at least %d chars long", s, min) + } + + *b = bucket(s) + return nil +} diff --git a/x-pack/functionbeat/provider/aws/config_test.go b/x-pack/functionbeat/provider/aws/config_test.go new file mode 100644 index 000000000000..715c0288e376 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/config_test.go @@ -0,0 +1,70 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMemSizeFactor64(t *testing.T) { + t.Run("human format", func(t *testing.T) { + t.Run("value is a factor of 64", func(t *testing.T) { + v := MemSizeFactor64(0) + err := v.Unpack("128MiB") + if !assert.NoError(t, err) { + return + } + assert.Equal(t, MemSizeFactor64(128*1024*1024), v) + }) + }) + + t.Run("raw value", func(t *testing.T) { + t.Run("value is a factor of 64", func(t *testing.T) { + v := MemSizeFactor64(0) + err := v.Unpack(fmt.Sprintf("%d", 128*1024*1024)) + if !assert.NoError(t, err) { + return + } + assert.Equal(t, MemSizeFactor64(128*1024*1024), v) + }) + + t.Run("value is not a factor of 64", func(t *testing.T) { + v := MemSizeFactor64(0) + err := v.Unpack("121") + assert.Error(t, err) + }) + }) + + t.Run("returns the value in megabyte", func(t *testing.T) { + v := MemSizeFactor64(128 * 1024 * 1024) + assert.Equal(t, 128, v.Megabytes()) + }) +} + +func TestBucket(t *testing.T) { + t.Run("valid bucket name", func(t *testing.T) { + b := bucket("") + err := b.Unpack("hello-bucket") + if !assert.NoError(t, err) { + return + } + assert.Equal(t, bucket("hello-bucket"), b) + }) + + t.Run("too long", func(t *testing.T) { + b := bucket("") + err := b.Unpack("hello-bucket-abc12345566789012345678901234567890123456789012345678901234567890") + assert.Error(t, err) + }) + + t.Run("too short", func(t *testing.T) { + b := bucket("") + err := b.Unpack("he") + assert.Error(t, err) + }) +} diff --git a/x-pack/functionbeat/provider/aws/executor.go b/x-pack/functionbeat/provider/aws/executor.go new file mode 100644 index 000000000000..ea1f60baca63 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/executor.go @@ -0,0 +1,100 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "errors" + + "github.com/elastic/beats/libbeat/logp" +) + +var ( + errNeverRun = errors.New("executor was never executed") + errCannotAdd = errors.New("cannot add to an already executed executor") + errAlreadyExecuted = errors.New("executor already executed") +) + +type executor struct { + operations []doer + undos []undoer + completed bool + log *logp.Logger +} + +type doer interface { + Execute() error +} + +type undoer interface { + Rollback() error +} + +func newExecutor(log *logp.Logger) *executor { + if log == nil { + log = logp.NewLogger("") + } + + log = log.Named("executor") + return &executor{log: log} +} + +func (e *executor) Execute() (err error) { + e.log.Debugf("The executor is executing '%d' operations for converging state", len(e.operations)) + if e.IsCompleted() { + return errAlreadyExecuted + } + for _, operation := range e.operations { + err = operation.Execute() + if err != nil { + break + } + v, ok := operation.(undoer) + if ok { + e.undos = append(e.undos, v) + } + } + if err == nil { + e.log.Debug("All operations successful") + } + e.markCompleted() + return err +} + +func (e *executor) Rollback() (err error) { + e.log.Debugf("The executor is rolling back previous execution, '%d' operations to rollback", len(e.undos)) + if !e.IsCompleted() { + return errNeverRun + } + for i := len(e.undos) - 1; i >= 0; i-- { + operation := e.undos[i] + err = operation.Rollback() + if err != nil { + break + } + } + + if err == nil { + e.log.Debug("The rollback is successful") + } else { + e.log.Debug("The rollback is incomplete") + } + return err +} + +func (e *executor) Add(operation ...doer) error { + if e.IsCompleted() { + return errCannotAdd + } + e.operations = append(e.operations, operation...) + return nil +} + +func (e *executor) markCompleted() { + e.completed = true +} + +func (e *executor) IsCompleted() bool { + return e.completed +} diff --git a/x-pack/functionbeat/provider/aws/executor_test.go b/x-pack/functionbeat/provider/aws/executor_test.go new file mode 100644 index 000000000000..baa94d1f4bc2 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/executor_test.go @@ -0,0 +1,176 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +type MockUndoer struct { + mock.Mock +} + +func (m *MockUndoer) Execute() error { + args := m.Called() + return args.Error(0) +} + +func (m *MockUndoer) Rollback() error { + args := m.Called() + return args.Error(0) +} + +type MockDoer struct { + mock.Mock +} + +func (m *MockDoer) Execute() error { + args := m.Called() + return args.Error(0) +} + +func TestExecutor(t *testing.T) { + t.Run("executes all the tasks", testAll) + t.Run("stop execution on first error", testError) + t.Run("stop execution and allow rollback on undoer", testUndoer) + t.Run("stop rollback if one rollback fail", testFailRollback) + t.Run("an execution cannot be run twice", testCannotRunTwice) + t.Run("cannot add operation to a completed execution", testCannotAddCompleted) +} + +func testAll(t *testing.T) { + executor := newExecutor(nil) + m1 := &MockDoer{} + m1.On("Execute").Return(nil) + + m2 := &MockDoer{} + m2.On("Execute").Return(nil) + + executor.Add(m1, m2) + err := executor.Execute() + if !assert.NoError(t, err) { + return + } + + m1.AssertExpectations(t) + m2.AssertExpectations(t) +} + +func testError(t *testing.T) { + executor := newExecutor(nil) + m1 := &MockDoer{} + m1.On("Execute").Return(nil) + + m2 := &MockDoer{} + e := errors.New("something bad") + m2.On("Execute").Return(e) + + m3 := &MockDoer{} + executor.Add(m1, m2, m3) + err := executor.Execute() + if assert.Equal(t, e, err) { + return + } + + m1.AssertExpectations(t) + m2.AssertExpectations(t) + m3.AssertExpectations(t) +} + +func testUndoer(t *testing.T) { + executor := newExecutor(nil) + m1 := &MockUndoer{} + m1.On("Execute").Return(nil) + m1.On("Rollback").Return(nil) + + m2 := &MockDoer{} + e := errors.New("something bad") + m2.On("Execute").Return(e) + + m3 := &MockDoer{} + executor.Add(m1, m2, m3) + err := executor.Execute() + if !assert.Equal(t, e, err) { + return + } + + err = executor.Rollback() + if !assert.NoError(t, err) { + return + } + + m1.AssertExpectations(t) + m2.AssertExpectations(t) + m3.AssertExpectations(t) +} + +func testFailRollback(t *testing.T) { + e := errors.New("error on execution") + e2 := errors.New("error on rollback") + + executor := newExecutor(nil) + m1 := &MockUndoer{} + m1.On("Execute").Return(nil) + + m2 := &MockUndoer{} + m2.On("Execute").Return(nil) + m2.On("Rollback").Return(e2) + + m3 := &MockUndoer{} + m3.On("Execute").Return(e) + + executor.Add(m1, m2, m3) + + err := executor.Execute() + if !assert.Equal(t, e, err) { + return + } + + err = executor.Rollback() + if !assert.Error(t, err) { + return + } + + m1.AssertExpectations(t) + m2.AssertExpectations(t) + m3.AssertExpectations(t) +} + +func testCannotRunTwice(t *testing.T) { + executor := newExecutor(nil) + m1 := &MockDoer{} + m1.On("Execute").Return(nil) + + executor.Add(m1) + err := executor.Execute() + if !assert.NoError(t, err) { + return + } + + m1.AssertExpectations(t) + + assert.True(t, executor.IsCompleted()) + assert.Error(t, errAlreadyExecuted, executor.Execute()) +} + +func testCannotAddCompleted(t *testing.T) { + executor := newExecutor(nil) + m1 := &MockDoer{} + m1.On("Execute").Return(nil) + + executor.Add(m1) + err := executor.Execute() + if !assert.NoError(t, err) { + return + } + + m1.AssertExpectations(t) + + assert.Error(t, executor.Add(&MockDoer{})) +} diff --git a/x-pack/functionbeat/provider/aws/kinesis.go b/x-pack/functionbeat/provider/aws/kinesis.go new file mode 100644 index 000000000000..6c88b26ff260 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/kinesis.go @@ -0,0 +1,53 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "context" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" + "github.com/elastic/beats/x-pack/functionbeat/provider/aws/transformer" +) + +// Kinesis receives events from a kinesis stream and forward them to elasticsearch. +type Kinesis struct { + log *logp.Logger +} + +// NewKinesis creates a new function to receives events from a kinesis stream. +func NewKinesis(provider provider.Provider, config *common.Config) (provider.Function, error) { + return &Kinesis{log: logp.NewLogger("kinesis")}, nil +} + +// Run starts the lambda function and wait for web triggers. +func (k *Kinesis) Run(_ context.Context, client core.Client) error { + lambda.Start(k.createHandler(client)) + return nil +} + +func (k *Kinesis) createHandler(client core.Client) func(request events.KinesisEvent) error { + return func(request events.KinesisEvent) error { + k.log.Debugf("The handler receives %d events", len(request.Records)) + + events := transformer.KinesisEvent(request) + if err := client.PublishAll(events); err != nil { + k.log.Errorf("Could not publish events to the pipeline, error: %+v", err) + return err + } + client.Wait() + return nil + } +} + +// Name return the name of the lambda function. +func (k *Kinesis) Name() string { + return "kinesis" +} diff --git a/x-pack/functionbeat/provider/aws/kinesis_test.go b/x-pack/functionbeat/provider/aws/kinesis_test.go new file mode 100644 index 000000000000..33c6aba91831 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/kinesis_test.go @@ -0,0 +1,70 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "errors" + "testing" + + "github.com/aws/aws-lambda-go/events" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +func TestKinesis(t *testing.T) { + cfg := common.MustNewConfigFrom(map[string]interface{}{ + "name": "foobar", + }) + + t.Run("when publish is succesful", func(t *testing.T) { + client := &arrayBackedClient{} + k, err := NewKinesis(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := k.(*Kinesis) + handler := c.createHandler(client) + err = handler(generateKinesisEvent()) + assert.NoError(t, err) + }) + + t.Run("when publish is not succesful", func(t *testing.T) { + e := errors.New("something bad") + client := &arrayBackedClient{err: e} + + k, err := NewKinesis(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := k.(*Kinesis) + handler := c.createHandler(client) + err = handler(generateKinesisEvent()) + assert.Equal(t, e, err) + }) +} + +func generateKinesisEvent() events.KinesisEvent { + return events.KinesisEvent{ + Records: []events.KinesisEventRecord{ + events.KinesisEventRecord{ + AwsRegion: "east-1", + EventID: "1234", + EventName: "connect", + EventSource: "web", + EventSourceArn: "arn:aws:iam::00000000:role/functionbeat", + Kinesis: events.KinesisRecord{ + Data: []byte("hello world"), + PartitionKey: "abc123", + SequenceNumber: "12345", + KinesisSchemaVersion: "v1", + }, + }, + }, + } +} diff --git a/x-pack/functionbeat/provider/aws/op_create_cloudformation.go b/x-pack/functionbeat/provider/aws/op_create_cloudformation.go new file mode 100644 index 000000000000..efafd893aa9f --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_create_cloudformation.go @@ -0,0 +1,57 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudformation" + "github.com/gofrs/uuid" + + "github.com/elastic/beats/libbeat/logp" +) + +type opCreateCloudFormation struct { + log *logp.Logger + svc *cloudformation.CloudFormation + templateURL string + stackName string +} + +func newOpCreateCloudFormation( + log *logp.Logger, + cfg aws.Config, + templateURL, stackName string, +) *opCreateCloudFormation { + return &opCreateCloudFormation{ + log: log, + svc: cloudformation.New(cfg), + templateURL: templateURL, + stackName: stackName, + } +} + +func (o *opCreateCloudFormation) Execute() error { + o.log.Debug("Creating CloudFormation create stack request") + uuid, err := uuid.NewV4() + if err != nil { + return err + } + input := &cloudformation.CreateStackInput{ + ClientRequestToken: aws.String(uuid.String()), + StackName: aws.String(o.stackName), + TemplateURL: aws.String(o.templateURL), + Capabilities: []cloudformation.Capability{ + cloudformation.CapabilityCapabilityNamedIam, + }, + } + + req := o.svc.CreateStackRequest(input) + resp, err := req.Send() + if err != nil { + o.log.Debugf("Could not create the cloud formation stack request, resp: %v", resp) + return err + } + return nil +} diff --git a/x-pack/functionbeat/provider/aws/op_delete_cloudformation.go b/x-pack/functionbeat/provider/aws/op_delete_cloudformation.go new file mode 100644 index 000000000000..12b55f163c62 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_delete_cloudformation.go @@ -0,0 +1,46 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudformation" + "github.com/gofrs/uuid" + + "github.com/elastic/beats/libbeat/logp" +) + +type opDeleteCloudFormation struct { + log *logp.Logger + svc *cloudformation.CloudFormation + stackName string +} + +func (o *opDeleteCloudFormation) Execute() error { + uuid, err := uuid.NewV4() + if err != nil { + return err + } + input := &cloudformation.DeleteStackInput{ + ClientRequestToken: aws.String(uuid.String()), + StackName: aws.String(o.stackName), + } + + req := o.svc.DeleteStackRequest(input) + resp, err := req.Send() + if err != nil { + o.log.Debugf("Could not delete the stack, response: %v", resp) + return err + } + return nil +} + +func newOpDeleteCloudFormation( + log *logp.Logger, + cfg aws.Config, + stackName string, +) *opDeleteCloudFormation { + return &opDeleteCloudFormation{log: log, svc: cloudformation.New(cfg), stackName: stackName} +} diff --git a/x-pack/functionbeat/provider/aws/op_delete_file_bucket.go b/x-pack/functionbeat/provider/aws/op_delete_file_bucket.go new file mode 100644 index 000000000000..344afe2d8b2a --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_delete_file_bucket.go @@ -0,0 +1,50 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + + "github.com/elastic/beats/libbeat/logp" +) + +type opDeleteFileBucket struct { + log *logp.Logger + svc *s3.S3 + bucketName string + path string +} + +func newOpDeleteFileBucket( + log *logp.Logger, + config aws.Config, + bucketName, path string, +) *opDeleteFileBucket { + return &opDeleteFileBucket{ + log: log, + svc: s3.New(config), + bucketName: bucketName, + path: path, + } +} + +func (o *opDeleteFileBucket) Execute() error { + o.log.Debugf("Removing file '%s' on bucket '%s'", o.path, o.bucketName) + input := &s3.DeleteObjectInput{ + Bucket: aws.String(o.bucketName), + Key: aws.String(o.path), + } + + req := o.svc.DeleteObjectRequest(input) + resp, err := req.Send() + + if err != nil { + o.log.Debugf("Could not remove object to S3, resp: %v", resp) + return err + } + o.log.Debug("Remove successful") + return nil +} diff --git a/x-pack/functionbeat/provider/aws/op_ensure_bucket.go b/x-pack/functionbeat/provider/aws/op_ensure_bucket.go new file mode 100644 index 000000000000..0d5aac689fa3 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_ensure_bucket.go @@ -0,0 +1,55 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "fmt" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/awserr" + "github.com/aws/aws-sdk-go-v2/service/s3" + + "github.com/elastic/beats/libbeat/logp" +) + +// This error is not provided by the S3 error package. +const notFound = "NotFound" + +type opEnsureBucket struct { + log *logp.Logger + svc *s3.S3 + bucketName string +} + +func newOpEnsureBucket(log *logp.Logger, cfg aws.Config, bucketName string) *opEnsureBucket { + return &opEnsureBucket{log: log, svc: s3.New(cfg), bucketName: bucketName} +} + +func (o *opEnsureBucket) Execute() error { + o.log.Debugf("Verifying presence of S3 bucket: %s", o.bucketName) + + check := &s3.HeadBucketInput{Bucket: aws.String(o.bucketName)} + reqCheck := o.svc.HeadBucketRequest(check) + _, err := reqCheck.Send() + if err == nil { + // The bucket exists and we have permission to access it. + return nil + } + + if aerr, ok := err.(awserr.Error); ok { + if aerr.Code() == notFound { + // bucket do not exist let's create it. + input := &s3.CreateBucketInput{Bucket: aws.String(o.bucketName)} + req := o.svc.CreateBucketRequest(input) + resp, err := req.Send() + if err != nil { + o.log.Debugf("Could not create bucket, resp: %v", resp) + return err + } + } + } + + return fmt.Errorf("bucket '%s' already exist and you don't have permission to access it", o.bucketName) +} diff --git a/x-pack/functionbeat/provider/aws/op_update_cloudformation.go b/x-pack/functionbeat/provider/aws/op_update_cloudformation.go new file mode 100644 index 000000000000..cd02dccccd8c --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_update_cloudformation.go @@ -0,0 +1,56 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudformation" + "github.com/gofrs/uuid" + + "github.com/elastic/beats/libbeat/logp" +) + +type opUpdateCloudFormation struct { + log *logp.Logger + svc *cloudformation.CloudFormation + templateURL string + stackName string +} + +func (o *opUpdateCloudFormation) Execute() error { + uuid, err := uuid.NewV4() + if err != nil { + return err + } + input := &cloudformation.UpdateStackInput{ + ClientRequestToken: aws.String(uuid.String()), + StackName: aws.String(o.stackName), + TemplateURL: aws.String(o.templateURL), + Capabilities: []cloudformation.Capability{ + cloudformation.CapabilityCapabilityNamedIam, + }, + } + + req := o.svc.UpdateStackRequest(input) + resp, err := req.Send() + if err != nil { + o.log.Debug("Could not update the cloudformation stack, resp: %s", resp) + return err + } + return nil +} + +func newOpUpdateCloudFormation( + log *logp.Logger, + cfg aws.Config, + templateURL, stackName string, +) *opUpdateCloudFormation { + return &opUpdateCloudFormation{ + log: log, + svc: cloudformation.New(cfg), + templateURL: templateURL, + stackName: stackName, + } +} diff --git a/x-pack/functionbeat/provider/aws/op_upload_to_bucket.go b/x-pack/functionbeat/provider/aws/op_upload_to_bucket.go new file mode 100644 index 000000000000..1e3a83be4215 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_upload_to_bucket.go @@ -0,0 +1,67 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "bytes" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/s3" + + "github.com/elastic/beats/libbeat/logp" +) + +type opUploadToBucket struct { + log *logp.Logger + svc *s3.S3 + bucketName string + path string + raw []byte + config aws.Config +} + +func newOpUploadToBucket( + log *logp.Logger, + config aws.Config, + bucketName, path string, + raw []byte, +) *opUploadToBucket { + return &opUploadToBucket{ + log: log, + svc: s3.New(config), + bucketName: bucketName, + path: path, + raw: raw, + config: config, + } +} + +func (o *opUploadToBucket) Execute() error { + o.log.Debugf("Uploading file '%s' to bucket '%s' with size %d bytes", o.path, o.bucketName, len(o.raw)) + input := &s3.PutObjectInput{ + Bucket: aws.String(o.bucketName), + Body: bytes.NewReader(o.raw), + Key: aws.String(o.path), + } + req := o.svc.PutObjectRequest(input) + resp, err := req.Send() + + if err != nil { + o.log.Debugf("Could not upload object to S3, resp: %v", resp) + return err + } + o.log.Debug("Upload successful") + return nil +} + +func (o *opUploadToBucket) Rollback() error { + // The error will be logged but we do not enforce a hard failure because the file could have + // been removed before. + err := newOpDeleteFileBucket(o.log, o.config, o.bucketName, o.path).Execute() + if err != nil { + o.log.Debugf("Fail to delete file on bucket, error: %+v", err) + } + return nil +} diff --git a/x-pack/functionbeat/provider/aws/op_wait_cloud_formation.go b/x-pack/functionbeat/provider/aws/op_wait_cloud_formation.go new file mode 100644 index 000000000000..fee4bd430bb1 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_wait_cloud_formation.go @@ -0,0 +1,72 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudformation" + + "github.com/elastic/beats/libbeat/logp" +) + +var periodicCheck = 10 * time.Second + +type opCloudWaitCloudFormation struct { + log *logp.Logger + svc *cloudformation.CloudFormation + stackName string +} + +func newOpWaitCloudFormation( + log *logp.Logger, + cfg aws.Config, + stackName string, +) *opCloudWaitCloudFormation { + return &opCloudWaitCloudFormation{ + log: log, + svc: cloudformation.New(cfg), + stackName: stackName, + } +} + +func (o *opCloudWaitCloudFormation) Execute() error { + o.log.Debug("Waiting for cloudformation confirmation") + status, reason, err := queryStackStatus(o.svc, o.stackName) + + // List of States from the cloud formation API. + // https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Stack.html + for { + o.log.Debugf( + "Retrieving information on stack '%s' from cloudformation, current status: %v", + o.stackName, + *status, + ) + + if err != nil { + return err + } + + switch *status { + case cloudformation.StackStatusUpdateComplete: // OK + return nil + case cloudformation.StackStatusCreateComplete: // OK + return nil + case cloudformation.StackStatusCreateFailed: + return fmt.Errorf("failed to create the stack '%s', reason: %v", o.stackName, reason) + case cloudformation.StackStatusRollbackFailed: + return fmt.Errorf("failed to create and rollback the stack '%s', reason: %v", o.stackName, reason) + case cloudformation.StackStatusRollbackComplete: + return fmt.Errorf("failed to create the stack '%s', reason: %v", o.stackName, reason) + } + + select { + case <-time.After(periodicCheck): + status, reason, err = queryStackStatus(o.svc, o.stackName) + } + } +} diff --git a/x-pack/functionbeat/provider/aws/op_wait_delete_cloud_formation.go b/x-pack/functionbeat/provider/aws/op_wait_delete_cloud_formation.go new file mode 100644 index 000000000000..3f3d46db79f9 --- /dev/null +++ b/x-pack/functionbeat/provider/aws/op_wait_delete_cloud_formation.go @@ -0,0 +1,77 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "fmt" + "strings" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/service/cloudformation" + + "github.com/elastic/beats/libbeat/logp" +) + +type opWaitDeleteCloudFormation struct { + log *logp.Logger + svc *cloudformation.CloudFormation + stackName string +} + +func (o *opWaitDeleteCloudFormation) Execute() error { + o.log.Debug("Waiting for cloudformation delete confirmation") + status, reason, err := queryStackStatus(o.svc, o.stackName) + + // List of States from the cloud formation API. + // https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_Stack.html + for { + if err != nil { + // Timing its possible that the stack doesn't exist at that point. + if strings.Index(err.Error(), fmt.Sprintf("Stack with id %s does not exist", o.stackName)) != -1 { + return nil + } + return err + } + + o.log.Debugf( + "Retrieving information on stack '%s' from cloudformation, current status: %v", + o.stackName, + *status, + ) + + switch *status { + case cloudformation.StackStatusDeleteComplete: // OK + return nil + case cloudformation.StackStatusDeleteFailed: + return fmt.Errorf("failed to delete the stack '%s', reason: %v", o.stackName, reason) + case cloudformation.StackStatusRollbackFailed: + return fmt.Errorf("failed to delete and rollback the stack '%s', reason: %v", o.stackName, reason) + case cloudformation.StackStatusRollbackComplete: + return fmt.Errorf("failed to delete the stack '%s', reason: %v", o.stackName, reason) + } + + select { + case <-time.After(periodicCheck): + status, reason, err = queryStackStatus(o.svc, o.stackName) + } + } +} + +func newWaitDeleteCloudFormation(log *logp.Logger, cfg aws.Config, stackName string) *opWaitDeleteCloudFormation { + return &opWaitDeleteCloudFormation{log: log, svc: cloudformation.New(cfg), stackName: stackName} +} + +func queryStackStatus(svc *cloudformation.CloudFormation, stackName string) (*cloudformation.StackStatus, *string, error) { + input := &cloudformation.DescribeStacksInput{StackName: aws.String(stackName)} + req := svc.DescribeStacksRequest(input) + resp, err := req.Send() + if err != nil { + return nil, nil, err + } + + stack := resp.Stacks[0] + return &stack.StackStatus, stack.StackStatusReason, nil +} diff --git a/x-pack/functionbeat/provider/aws/sqs.go b/x-pack/functionbeat/provider/aws/sqs.go new file mode 100644 index 000000000000..fd7a93c07a8f --- /dev/null +++ b/x-pack/functionbeat/provider/aws/sqs.go @@ -0,0 +1,107 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "context" + "errors" + + "github.com/aws/aws-lambda-go/events" + "github.com/aws/aws-lambda-go/lambda" + "github.com/awslabs/goformation/cloudformation" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" + "github.com/elastic/beats/x-pack/functionbeat/provider/aws/transformer" +) + +const batchSize = 10 + +// SQSConfig is the configuration for the SQS event type. +type SQSConfig struct { + Triggers []*SQSTriggerConfig `config:"triggers"` + Description string `config:"description"` + Name string `config:"name" validate:"nonzero,required"` + LambdaConfig *lambdaConfig `config:",inline"` +} + +// SQSTriggerConfig configuration for the current trigger. +type SQSTriggerConfig struct { + EventSourceArn string `config:"event_source_arn"` +} + +// Validate validates the configuration. +func (cfg *SQSConfig) Validate() error { + if len(cfg.Triggers) == 0 { + return errors.New("you need to specify at least one trigger") + } + return nil +} + +// SQS receives events from the web service and forward them to elasticsearch. +type SQS struct { + log *logp.Logger + config *SQSConfig +} + +// NewSQS creates a new function to receives events from a SQS queue. +func NewSQS(provider provider.Provider, cfg *common.Config) (provider.Function, error) { + config := &SQSConfig{LambdaConfig: DefaultLambdaConfig} + if err := cfg.Unpack(config); err != nil { + return nil, err + } + return &SQS{log: logp.NewLogger("sqs"), config: config}, nil +} + +// Run starts the lambda function and wait for web triggers. +func (s *SQS) Run(_ context.Context, client core.Client) error { + lambda.Start(s.createHandler(client)) + return nil +} + +func (s *SQS) createHandler(client core.Client) func(request events.SQSEvent) error { + return func(request events.SQSEvent) error { + s.log.Debugf("The handler receives %d events", len(request.Records)) + + events := transformer.SQS(request) + if err := client.PublishAll(events); err != nil { + s.log.Errorf("Could not publish events to the pipeline, error: %+v", err) + return err + } + client.Wait() + return nil + } +} + +// Name return the name of the lambda function. +func (s *SQS) Name() string { + return "sqs" +} + +// Template returns the cloudformation template for configuring the service with the specified triggers. +func (s *SQS) Template() *cloudformation.Template { + template := cloudformation.NewTemplate() + + prefix := func(suffix string) string { + return "fnb" + s.config.Name + suffix + } + + for _, trigger := range s.config.Triggers { + resourceName := prefix("SQS") + normalizeResourceName(trigger.EventSourceArn) + template.Resources[resourceName] = &cloudformation.AWSLambdaEventSourceMapping{ + BatchSize: batchSize, + EventSourceArn: trigger.EventSourceArn, + FunctionName: cloudformation.GetAtt(prefix(""), "Arn"), + } + } + return template +} + +// LambdaConfig returns the configuration to use when creating the lambda. +func (s *SQS) LambdaConfig() *lambdaConfig { + return s.config.LambdaConfig +} diff --git a/x-pack/functionbeat/provider/aws/sqs_test.go b/x-pack/functionbeat/provider/aws/sqs_test.go new file mode 100644 index 000000000000..db4aa93dc05e --- /dev/null +++ b/x-pack/functionbeat/provider/aws/sqs_test.go @@ -0,0 +1,67 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package aws + +import ( + "errors" + "testing" + + "github.com/aws/aws-lambda-go/events" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +func TestSQS(t *testing.T) { + cfg := common.MustNewConfigFrom(map[string]interface{}{ + "name": "foobar", + "triggers": []map[string]interface{}{ + map[string]interface{}{ + "event_source_arn": "abc1234", + }, + }, + }) + + t.Run("when publish is succesful", func(t *testing.T) { + client := &arrayBackedClient{} + s, err := NewSQS(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := s.(*SQS) + handler := c.createHandler(client) + err = handler(generateSQSEvent()) + assert.NoError(t, err) + }) + + t.Run("when publish is not succesful", func(t *testing.T) { + e := errors.New("something bad") + client := &arrayBackedClient{err: e} + + s, err := NewSQS(&provider.DefaultProvider{}, cfg) + if !assert.NoError(t, err) { + return + } + + c, _ := s.(*SQS) + handler := c.createHandler(client) + err = handler(generateSQSEvent()) + assert.Equal(t, e, err) + }) +} + +func generateSQSEvent() events.SQSEvent { + return events.SQSEvent{ + Records: []events.SQSMessage{ + events.SQSMessage{ + MessageId: "1234", + ReceiptHandle: "12345", + Body: "hello world", + }, + }, + } +} diff --git a/x-pack/functionbeat/provider/aws/transformer/transformer.go b/x-pack/functionbeat/provider/aws/transformer/transformer.go new file mode 100644 index 000000000000..2b78bddaac9c --- /dev/null +++ b/x-pack/functionbeat/provider/aws/transformer/transformer.go @@ -0,0 +1,99 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package transformer + +import ( + "time" + + "github.com/aws/aws-lambda-go/events" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common" +) + +// Centralize anything related to ECS into a common file. +// TODO: Look at the fields to align them with ECS. +// TODO: how to keep the fields in sync with AWS? +// TODO: api gateway proxy a lot more information is available. + +// CloudwatchLogs takes an CloudwatchLogsData and transform it into a beat event. +func CloudwatchLogs(request events.CloudwatchLogsData) []beat.Event { + events := make([]beat.Event, len(request.LogEvents)) + + for idx, logEvent := range request.LogEvents { + events[idx] = beat.Event{ + Timestamp: time.Now(), // TODO: time.Unix(logEvent.Timestamp, 0), + Fields: common.MapStr{ + "message": logEvent.Message, + "id": logEvent.ID, + "owner": request.Owner, + "log_stream": request.LogStream, + "log_group": request.LogGroup, + "message_type": request.MessageType, + "subscription_filters": request.SubscriptionFilters, + }, + } + } + + return events +} + +// APIGatewayProxyRequest takes a web request on the api gateway proxy and transform it into a beat event. +func APIGatewayProxyRequest(request events.APIGatewayProxyRequest) beat.Event { + return beat.Event{ + Timestamp: time.Now(), + Fields: common.MapStr{ + "resource": request.Resource, + "path": request.Path, + "method": request.HTTPMethod, + "headers": request.Headers, // TODO: ECS map[string] + "query_string": request.QueryStringParameters, // TODO: map[string], might conflict with ECS + "path_parameters": request.PathParameters, + "body": request.Body, // TODO: could be JSON, json processor? could be used by other functions. + "is_base64_encoded": request.IsBase64Encoded, + }, + } +} + +// KinesisEvent takes a kinesis event and create multiples beat events. +func KinesisEvent(request events.KinesisEvent) []beat.Event { + events := make([]beat.Event, len(request.Records)) + for idx, record := range request.Records { + events[idx] = beat.Event{ + Timestamp: time.Now(), + Fields: common.MapStr{ + "event_id": record.EventID, + "event_name": record.EventName, + "event_source": record.EventSource, + "event_source_arn": record.EventSourceArn, + "event_version": record.EventVersion, + "aws_region": record.AwsRegion, + // TODO: more meta data at KinesisRecord, need to check doc + }, + } + } + return events +} + +// SQS takes a SQS event and create multiples beat events. +func SQS(request events.SQSEvent) []beat.Event { + events := make([]beat.Event, len(request.Records)) + for idx, record := range request.Records { + events[idx] = beat.Event{ + Timestamp: time.Now(), + Fields: common.MapStr{ + "message_id": record.MessageId, + "receipt_handle": record.ReceiptHandle, + "message": record.Body, + "attributes": record.Attributes, + "event_source": record.EventSource, + "event_source_arn": record.EventSourceARN, + "aws_region": record.AWSRegion, + }, + // TODO: SQS message attributes missing, need to check doc + } + } + return events +} diff --git a/x-pack/functionbeat/provider/cli.go b/x-pack/functionbeat/provider/cli.go new file mode 100644 index 000000000000..900375e2c57f --- /dev/null +++ b/x-pack/functionbeat/provider/cli.go @@ -0,0 +1,26 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" +) + +// CLIManager is the interface implemented by each provider to expose a command CLI interface +// to their interface. +type CLIManager interface { + // Deploy takes a function name and deploy functionbeat and the function configuration to the provider. + Deploy(string) error + + //Update takes a function name and update the configuration to the remote provider. + Update(string) error + + // Remove takes a function name and remove the specific function from the remote provider. + Remove(string) error +} + +// CLIManagerFactory factory method to call to create a new CLI manager +type CLIManagerFactory func(*logp.Logger, *common.Config, Provider) (CLIManager, error) diff --git a/x-pack/functionbeat/provider/default_provider.go b/x-pack/functionbeat/provider/default_provider.go new file mode 100644 index 000000000000..060273691417 --- /dev/null +++ b/x-pack/functionbeat/provider/default_provider.go @@ -0,0 +1,81 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "fmt" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/core" +) + +// DefaultProvider implements the minimal required to retrieve and start functions. +type DefaultProvider struct { + rawConfig *common.Config + config *config.ProviderConfig + registry *Registry + name string + log *logp.Logger + managerFactory CLIManagerFactory +} + +// NewDefaultProvider returns factory methods to handle generic provider. +func NewDefaultProvider(name string, manager CLIManagerFactory) func(*logp.Logger, *Registry, *common.Config) (Provider, error) { + return func(log *logp.Logger, registry *Registry, cfg *common.Config) (Provider, error) { + c := &config.ProviderConfig{} + err := cfg.Unpack(c) + if err != nil { + return nil, err + } + + if manager == nil { + manager = NewNullCli + } + + return &DefaultProvider{ + rawConfig: cfg, + config: c, + registry: registry, + name: name, + log: log, + managerFactory: manager, + }, nil + } +} + +// Name returns the name of the provider. +func (d *DefaultProvider) Name() string { + return d.name +} + +// CreateFunctions takes factory method and returns runnable function. +func (d *DefaultProvider) CreateFunctions(clientFactory clientFactory, enabledFunctions []string) ([]core.Runner, error) { + return CreateFunctions(d.registry, d, enabledFunctions, d.config.Functions, clientFactory) +} + +// FindFunctionByName returns a function instance identified by a unique name or an error if not found. +func (d *DefaultProvider) FindFunctionByName(name string) (Function, error) { + return FindFunctionByName(d.registry, d, d.config.Functions, name) +} + +// CLIManager returns the type responsable of installing, updating and removing remote function +// for a specific provider. +func (d *DefaultProvider) CLIManager() (CLIManager, error) { + return d.managerFactory(nil, d.rawConfig, d) +} + +// nullCLI is used when a provider doesn't implement the CLI to manager functions on the service provider. +type nullCLI struct{} + +// NewNullCli returns a NOOP CliManager. +func NewNullCli(_ *logp.Logger, _ *common.Config, _ Provider) (CLIManager, error) { + return (*nullCLI)(nil), nil +} + +func (*nullCLI) Deploy(_ string) error { return fmt.Errorf("deploy not implemented") } +func (*nullCLI) Update(_ string) error { return fmt.Errorf("update not implemented") } +func (*nullCLI) Remove(_ string) error { return fmt.Errorf("remove not implemented") } diff --git a/x-pack/functionbeat/provider/feature.go b/x-pack/functionbeat/provider/feature.go new file mode 100644 index 000000000000..59990d7a039e --- /dev/null +++ b/x-pack/functionbeat/provider/feature.go @@ -0,0 +1,59 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import "github.com/elastic/beats/libbeat/feature" + +// getNamespace return the namespace for functions of a specific provider. The registry have a flat view +// representation of the plugin world this mean we don't really have a tree, instead what we do is +// to create a unique keys per providers that will only keep the functions of the provider. +func getNamespace(provider string) string { + return namespace + "." + provider + ".functions" +} + +// Feature creates a new Provider feature to be added to the global registry. +// The namespace will be 'functionbeat.provider' in the registry. +func Feature(name string, factory Factory, description feature.Describer) *feature.Feature { + return feature.New(namespace, name, factory, description) +} + +// FunctionFeature Feature creates a new function feature to be added to the global registry +// The namespace will be 'functionbeat.provider.local' in the registry. +func FunctionFeature( + provider, name string, + factory FunctionFactory, + description feature.Describer, +) *feature.Feature { + return feature.New(getNamespace(provider), name, factory, description) +} + +// Builder is used to have a fluent interface to build a set of function for a specific provider, it +// provides a fluent interface to the developper of provider and functions, it wraps the Feature +// functions to make sure the namespace are correctly configured. +type Builder struct { + name string + bundle *feature.Bundle +} + +// MustCreate creates a new provider builder, it is used to define a provider and the function +// it supports. +func MustCreate(name string, factory Factory, description feature.Describer) *Builder { + return &Builder{name: name, bundle: feature.NewBundle(Feature(name, factory, description))} +} + +// Bundle transforms the provider and the functions into a bundle feature. +func (b *Builder) Bundle() *feature.Bundle { + return b.bundle +} + +// MustAddFunction adds a new function type to the provider and return the builder. +func (b *Builder) MustAddFunction( + name string, + factory FunctionFactory, + description feature.Describer, +) *Builder { + b.bundle = feature.MustBundle(b.bundle, FunctionFeature(b.name, name, factory, description)) + return b +} diff --git a/x-pack/functionbeat/provider/feature_test.go b/x-pack/functionbeat/provider/feature_test.go new file mode 100644 index 000000000000..7873604c2edc --- /dev/null +++ b/x-pack/functionbeat/provider/feature_test.go @@ -0,0 +1,51 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/libbeat/logp" +) + +func TestBuilder(t *testing.T) { + provider := "myprovider" + providerFactory := func(_ *logp.Logger, _ *Registry, _ *common.Config) (Provider, error) { + return nil, nil + } + + fnFactory1 := func(_ Provider, _ *common.Config) (Function, error) { return nil, nil } + fnFactory2 := func(_ Provider, _ *common.Config) (Function, error) { return nil, nil } + + b := MustCreate( + provider, + providerFactory, + feature.NewDetails("myprovider", "myprovider", feature.Experimental), + ).MustAddFunction( + "f1", + fnFactory1, + feature.NewDetails("fn1 description", "fn1", feature.Experimental), + ).MustAddFunction("f2", fnFactory2, feature.NewDetails( + "fn1 description", + "fn1", + feature.Experimental, + )).Bundle() + + assert.Equal(t, 3, len(b.Features())) + features := b.Features() + + assert.Equal(t, "myprovider", features[0].Name()) + assert.Equal(t, "functionbeat.provider", features[0].Namespace()) + + assert.Equal(t, "f1", features[1].Name()) + assert.Equal(t, "functionbeat.provider.myprovider.functions", features[1].Namespace()) + + assert.Equal(t, "f2", features[2].Name()) + assert.Equal(t, "functionbeat.provider.myprovider.functions", features[2].Namespace()) +} diff --git a/x-pack/functionbeat/provider/local/local.go b/x-pack/functionbeat/provider/local/local.go new file mode 100644 index 000000000000..9954047583d5 --- /dev/null +++ b/x-pack/functionbeat/provider/local/local.go @@ -0,0 +1,101 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package local + +import ( + "bufio" + "context" + "os" + "time" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/x-pack/functionbeat/core" + "github.com/elastic/beats/x-pack/functionbeat/provider" +) + +const stdinName = "stdin" + +// Bundle exposes the local provider and the STDIN function. +var Bundle = provider.MustCreate( + "local", + provider.NewDefaultProvider("local", provider.NewNullCli), + feature.NewDetails("local events", "allows to trigger events locally.", feature.Experimental), +).MustAddFunction( + stdinName, + NewStdinFunction, + feature.NewDetails(stdinName, "read events from stdin", feature.Experimental), +).Bundle() + +// StdinFunction reads events from STIN and terminates when stdin is completed. +type StdinFunction struct{} + +// NewStdinFunction creates a new StdinFunction +func NewStdinFunction( + provider provider.Provider, + functionConfig *common.Config, +) (provider.Function, error) { + return &StdinFunction{}, nil +} + +// Run reads events from the STDIN and send them to the publisher pipeline, will stop reading by +// either by an external signal to stop or by reaching EOF. When EOF is reached functionbeat will shutdown. +func (s *StdinFunction) Run(ctx context.Context, client core.Client) error { + errChan := make(chan error) + defer close(errChan) + lineChan := make(chan string) + defer close(lineChan) + + // Make the os.Stdin interruptable, the shutdown cleanup will unblock the os.Stdin and the goroutine. + go func(ctx context.Context, lineChan chan string, errChan chan error) { + buf := bufio.NewReader(os.Stdin) + scanner := bufio.NewScanner(buf) + scanner.Split(bufio.ScanLines) + + for scanner.Scan() { + if err := scanner.Err(); err != nil { + errChan <- err + return + } + + select { + case <-ctx.Done(): + return + case lineChan <- scanner.Text(): + } + } + }(ctx, lineChan, errChan) + + for { + select { + case <-ctx.Done(): + return os.Stdin.Close() + case err := <-errChan: + return err + case line := <-lineChan: + event := s.newEvent(line) + err := client.Publish(event) + if err != nil { + return err + } + } + } +} + +func (s *StdinFunction) newEvent(line string) beat.Event { + event := beat.Event{ + Timestamp: time.Now(), + Fields: common.MapStr{ + "message": line, + }, + } + return event +} + +// Name returns the name of the stdin function. +func (s *StdinFunction) Name() string { + return stdinName +} diff --git a/x-pack/functionbeat/provider/provider.go b/x-pack/functionbeat/provider/provider.go new file mode 100644 index 000000000000..90669ae3fbe6 --- /dev/null +++ b/x-pack/functionbeat/provider/provider.go @@ -0,0 +1,77 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/core" +) + +// Create a new pipeline client based on the function configuration. +type clientFactory func(*common.Config) (core.Client, error) + +// Function is temporary +type Function interface { + Run(context.Context, core.Client) error + Name() string +} + +// Provider providers the layer between functionbeat and cloud specific settings, its is responsable to +// return the function that need to be executed. +type Provider interface { + CreateFunctions(clientFactory, []string) ([]core.Runner, error) + FindFunctionByName(string) (Function, error) + CLIManager() (CLIManager, error) + Name() string +} + +// Runnable is the unit of work managed by the coordinator, anything related to the life of a function +// is encapsulated into the runnable. +type Runnable struct { + config *common.Config + function Function + makeClient clientFactory +} + +// Run call the the function's Run method, the method is a specific goroutine, it will block until +// beats shutdown or an error happen. +func (r *Runnable) Run(ctx context.Context) error { + client, err := r.makeClient(r.config) + if err != nil { + return errors.Wrap(err, "could not create a client for the function") + } + defer client.Close() + return r.function.Run(ctx, client) +} + +func (r *Runnable) String() string { + return r.function.Name() +} + +// NewProvider return the provider specified in the configuration or an error. +func NewProvider(cfg *config.Config) (Provider, error) { + // Configure the provider, the provider will take care of the configuration for the + // functions. + registry := NewRegistry(feature.GlobalRegistry()) + providerFunc, err := registry.Lookup(cfg.Provider.Name()) + if err != nil { + return nil, fmt.Errorf("error finding the provider '%s', error: %v", cfg.Provider.Name(), err) + } + + provider, err := providerFunc(logp.NewLogger("provider"), registry, cfg.Provider.Config()) + if err != nil { + return nil, fmt.Errorf("error creating the provider '%s', error: %v", cfg.Provider.Name(), err) + } + + return provider, nil +} diff --git a/x-pack/functionbeat/provider/provider_test.go b/x-pack/functionbeat/provider/provider_test.go new file mode 100644 index 000000000000..3e9c9c7a4eb6 --- /dev/null +++ b/x-pack/functionbeat/provider/provider_test.go @@ -0,0 +1,74 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "context" + "errors" + "testing" + + e "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/beat" + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/x-pack/functionbeat/core" +) + +type simpleFunction struct { + err error +} + +func (s *simpleFunction) Run(ctx context.Context, client core.Client) error { + return s.err +} + +func (s *simpleFunction) Name() string { + return "simpleFunction" +} + +type mockClient struct{} + +func (sc *mockClient) Publish(event beat.Event) error { return nil } +func (sc *mockClient) PublishAll(events []beat.Event) error { return nil } +func (sc *mockClient) Close() error { return nil } +func (sc *mockClient) Wait() {} + +func TestRunnable(t *testing.T) { + t.Run("return an error when we cannot create the client", func(t *testing.T) { + err := errors.New("oops") + runnable := Runnable{ + config: common.NewConfig(), + makeClient: func(cfg *common.Config) (core.Client, error) { return nil, err }, + function: &simpleFunction{err: nil}, + } + + errReceived := runnable.Run(context.Background()) + assert.Equal(t, err, e.Cause(errReceived)) + }) + + t.Run("propagate functions errors to the coordinator", func(t *testing.T) { + err := errors.New("function error") + runnable := Runnable{ + config: common.NewConfig(), + makeClient: func(cfg *common.Config) (core.Client, error) { return &mockClient{}, nil }, + function: &simpleFunction{err: err}, + } + + errReceived := runnable.Run(context.Background()) + assert.Equal(t, err, e.Cause(errReceived)) + }) + + t.Run("when there is no error run and exit normaly", func(t *testing.T) { + runnable := Runnable{ + config: common.NewConfig(), + makeClient: func(cfg *common.Config) (core.Client, error) { return &mockClient{}, nil }, + function: &simpleFunction{err: nil}, + } + + errReceived := runnable.Run(context.Background()) + assert.NoError(t, errReceived) + }) +} diff --git a/x-pack/functionbeat/provider/registry.go b/x-pack/functionbeat/provider/registry.go new file mode 100644 index 000000000000..b36809bcf720 --- /dev/null +++ b/x-pack/functionbeat/provider/registry.go @@ -0,0 +1,184 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "errors" + "fmt" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/config" + "github.com/elastic/beats/x-pack/functionbeat/core" +) + +// Errors generated by the registry when we are retrieving providers or functions from the main registry. +var ( + errInvalidProvider = errors.New("invalid provider name") + errInvalidFunctionName = errors.New("invalid function name") + errInvalidType = errors.New("incomptible type received for the feature") +) + +// namespace is the namespace were providers will be registered in the global registry. +const namespace = "functionbeat.provider" + +// Factory factory to create a concrete provider for a specific cloud service. +type Factory func(*logp.Logger, *Registry, *common.Config) (Provider, error) + +// FunctionFactory factory to create a concrete function. +type FunctionFactory func(Provider, *common.Config) (Function, error) + +// Registry is a wrapper around the global feature registry and will take care of returning the +// the right providers and will do the type assertion for the providers, we hide the fact that +// we are actually accessing a global registry. +type Registry struct { + registry *feature.Registry +} + +// NewRegistry return a new registry. +func NewRegistry(registry *feature.Registry) *Registry { + return &Registry{registry: registry} +} + +// Lookup search the registry for the specific provider, normalization is done inside the +// registry to deal with lower case and uppercase. +func (r *Registry) Lookup(name string) (Factory, error) { + if len(name) == 0 { + return nil, errInvalidProvider + } + + f, err := r.registry.Lookup(namespace, name) + if err != nil { + return nil, err + } + + p, ok := f.Factory().(Factory) + if !ok { + return nil, errInvalidType + } + + return p, nil +} + +// LookupFunction takes a provider and a function and return the corresponding type or an +// error if the function or the provider is not found. +func (r *Registry) LookupFunction(provider, function string) (FunctionFactory, error) { + if len(provider) == 0 { + return nil, errInvalidProvider + } + if len(function) == 0 { + return nil, errInvalidFunctionName + } + + if _, err := r.Lookup(provider); err != nil { + return nil, err + } + + ns := getNamespace(provider) + + f, err := r.registry.Lookup(ns, function) + if err != nil { + return nil, err + } + + fn, ok := f.Factory().(FunctionFactory) + if !ok { + return nil, errInvalidType + } + + return fn, nil +} + +// CreateFunctions create runnable function based on the configurations received. +func CreateFunctions( + registry *Registry, + provider Provider, + enabledFunctions []string, + configs []*common.Config, + clientFactory clientFactory, +) ([]core.Runner, error) { + var runners []core.Runner + + for _, cfg := range configs { + c := config.DefaultFunctionConfig + err := cfg.Unpack(&c) + if err != nil { + return nil, err + } + + if strInSlice(enabledFunctions, c.Name.String()) == -1 { + continue + } + + if !c.Enabled { + return nil, fmt.Errorf("function '%s' not enabled for provider '%s'", c.Name, provider.Name()) + } + + f, err := registry.LookupFunction(provider.Name(), c.Type) + if err != nil { + return nil, err + } + + fn, err := f(provider, cfg) + if err != nil { + return nil, err + } + + runners = append(runners, &Runnable{config: cfg, makeClient: clientFactory, function: fn}) + } + + if len(runners) == 0 { + return nil, fmt.Errorf("no function are enabled for selected provider: '%s'", provider.Name()) + } + return runners, nil +} + +func strInSlice(haystack []string, name string) int { + for idx, s := range haystack { + if s == name { + return idx + } + } + return -1 +} + +// FindFunctionByName returns a function instance identified by a unique name or an error if not found. +func FindFunctionByName( + registry *Registry, + provider Provider, + configs []*common.Config, + name string, +) (Function, error) { + + for _, cfg := range configs { + c := config.FunctionConfig{} + err := cfg.Unpack(&c) + if err != nil { + return nil, err + } + + if c.Name.String() != name { + continue + } + + if !c.Enabled { + return nil, fmt.Errorf("function '%s' not enabled for provider '%s'", name, provider.Name()) + } + + f, err := registry.LookupFunction(provider.Name(), c.Type) + if err != nil { + return nil, err + } + + fn, err := f(provider, cfg) + if err != nil { + return nil, err + } + return fn, nil + } + + return nil, fmt.Errorf("no function with name '%s' exists", name) +} diff --git a/x-pack/functionbeat/provider/registry_test.go b/x-pack/functionbeat/provider/registry_test.go new file mode 100644 index 000000000000..9340a5917e2b --- /dev/null +++ b/x-pack/functionbeat/provider/registry_test.go @@ -0,0 +1,276 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package provider + +import ( + "context" + "errors" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/feature" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/x-pack/functionbeat/core" +) + +type mockProvider struct { + runners []core.Runner + name string +} + +func (m *mockProvider) CreateFunctions(clientFactory clientFactory, _ []string) ([]core.Runner, error) { + return m.runners, nil +} + +func (m *mockProvider) FindFunctionByName(_ string) (Function, error) { + return nil, errors.New("not found") +} + +func (m *mockProvider) Name() string { return m.name } + +func (m *mockProvider) CLIManager() (CLIManager, error) { return nil, nil } + +func TestRegistry(t *testing.T) { + t.Run("provider", testProviderLookup) + t.Run("functions", testFunctionLookup) +} + +type mockFunction struct { + name string +} + +func (mf *mockFunction) Run(ctx context.Context, client core.Client) error { return nil } +func (mf *mockFunction) Name() string { return mf.name } + +func testProviderLookup(t *testing.T) { + name := "myprovider" + myprovider := &mockProvider{} + + providerFn := func(log *logp.Logger, registry *Registry, config *common.Config) (Provider, error) { + return myprovider, nil + } + + f := Feature( + name, + providerFn, + feature.NewDetails(name, "provider for testing", feature.Experimental), + ) + + t.Run("adding and retrieving a provider", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + err := global.Register(f) + if !assert.NoError(t, err) { + return + } + + factory, err := wrapper.Lookup(name) + if !assert.NoError(t, err) { + return + } + + // Compare func pointers instead of comparing the function value. + assert.Equal(t, reflect.ValueOf(providerFn).Pointer(), reflect.ValueOf(factory).Pointer()) + })) + + t.Run("retrieving a non existing provider", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + _, err := wrapper.Lookup("unknown") + assert.Error(t, err) + })) + + t.Run("invalid provider name when doing lookup", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + _, err := wrapper.Lookup("") + assert.Error(t, err) + })) +} + +func testFunctionLookup(t *testing.T) { + name := "myprovider" + myprovider := &mockProvider{} + + providerFn := func(log *logp.Logger, registry *Registry, config *common.Config) (Provider, error) { + return myprovider, nil + } + + f := Feature( + name, + providerFn, + feature.NewDetails(name, "provider for testing", feature.Experimental), + ) + + fnName := "myfunc" + myfunction := &mockFunction{name} + functionFn := func(provider Provider, config *common.Config) (Function, error) { + return myfunction, nil + } + + fnFeature := FunctionFeature(name, fnName, functionFn, feature.NewDetails( + name, + "provider for testing", + feature.Experimental, + )) + + t.Run("adding and retrieving a function", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + err := global.Register(f) + if !assert.NoError(t, err) { + return + } + + err = global.Register(fnFeature) + if !assert.NoError(t, err) { + return + } + + factory, err := wrapper.LookupFunction(name, fnName) + if !assert.NoError(t, err) { + return + } + + // Compare func pointers instead of comparing the function value. + assert.Equal(t, reflect.ValueOf(functionFn).Pointer(), reflect.ValueOf(factory).Pointer()) + })) + + t.Run("return an error if the provider doesn't exist", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + err := global.Register(f) + if !assert.NoError(t, err) { + return + } + + err = global.Register(fnFeature) + if !assert.NoError(t, err) { + return + } + + _, err = wrapper.LookupFunction("I do not exist", fnName) + assert.Error(t, err) + })) + + t.Run("return an error if the function doesn't exist", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + err := global.Register(f) + if !assert.NoError(t, err) { + return + } + + err = global.Register(fnFeature) + if !assert.NoError(t, err) { + return + } + + _, err = wrapper.LookupFunction(name, "I do not exist") + assert.Error(t, err) + })) +} + +func withRegistry(fn func(t *testing.T, global *feature.Registry, registry *Registry)) func(t *testing.T) { + return func(t *testing.T) { + global := feature.NewRegistry() + wrapped := NewRegistry(global) + fn(t, global, wrapped) + } +} + +func testStrInSlice(t *testing.T) { + haystack := []string{"bob", "aline"} + t.Run("when in slice return position", func(t *testing.T) { + assert.Equal(t, 1, strInSlice(haystack, "aline")) + }) + + t.Run("when not in slice return -1", func(t *testing.T) { + assert.Equal(t, -1, strInSlice(haystack, "robert")) + }) +} + +func TestFindFunctionByName(t *testing.T) { + t.Run("when the function is not enabled", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + configs := []*common.Config{ + common.MustNewConfigFrom(map[string]interface{}{ + "name": "mysqs", + "type": "sqs", + "enabled": false, + }), + } + + myprovider := &mockProvider{} + + _, err := FindFunctionByName(wrapper, myprovider, configs, "mysqs") + assert.Error(t, err) + })) + + t.Run("when the function is enabled", withRegistry(func( + t *testing.T, + global *feature.Registry, + wrapper *Registry, + ) { + fnName := "sqs" + configs := []*common.Config{ + common.MustNewConfigFrom(map[string]interface{}{ + "name": "mysqs", + "type": fnName, + "enabled": true, + }), + } + + name := "myprovider" + myprovider := &mockProvider{name: name} + + providerFn := func(log *logp.Logger, registry *Registry, config *common.Config) (Provider, error) { + return myprovider, nil + } + f := Feature(name, providerFn, feature.NewDetails(name, "provider for testing", feature.Experimental)) + + myfunction := &mockFunction{name} + functionFn := func(provider Provider, config *common.Config) (Function, error) { + return myfunction, nil + } + + fnFeature := FunctionFeature(name, fnName, functionFn, feature.NewDetails( + name, + "provider for testing", + feature.Experimental, + )) + + err := global.Register(f) + if !assert.NoError(t, err) { + return + } + + err = global.Register(fnFeature) + if !assert.NoError(t, err) { + return + } + + _, err = FindFunctionByName(wrapper, myprovider, configs, "mysqs") + assert.NoError(t, err) + })) +} diff --git a/x-pack/functionbeat/tests/system/config/functionbeat.yml.j2 b/x-pack/functionbeat/tests/system/config/functionbeat.yml.j2 new file mode 100644 index 000000000000..9ae2bd2d9c4b --- /dev/null +++ b/x-pack/functionbeat/tests/system/config/functionbeat.yml.j2 @@ -0,0 +1,80 @@ +################### Beat Configuration ######################### +functionbeat.provider.local: + functions: + - type: stdin + enabled: true + +############################# Output ########################################## + +# Configure what outputs to use when sending the data collected by the beat. +# You can enable one or multiple outputs by setting enabled option to true. +output: + + ### File as output + file: + # Enabling file output + enabled: true + + # Path to the directory where to save the generated files. The option is mandatory. + path: {{ output_file_path|default(beat.working_dir + "/output") }} + + + # Name of the generated files. The default is `functionbeat` and it generates + # files: `functionbeat`, `functionbeat.1`, `functionbeat.2`, etc. + filename: {{ output_file_filename|default("functionbeat") }} + + # Maximum size in kilobytes of each file. When this size is reached, the files are + # rotated. The default value is 10 MB. + #rotate_every_kb: 10000 + + # Maximum number of files under path. When this number of files is reached, the + # oldest file is deleted and the rest are shifted from last to first. The default + # is 7 files. + #number_of_files: 7 + + + +############################# Beat ######################################### + +# The name of the shipper that publishes the network data. It can be used to group +# all the transactions sent by a single shipper in the web interface. +# If this options is not defined, the hostname is used. +#name: + +# The tags of the shipper are included in their own field with each +# transaction published. Tags make it easy to group servers by different +# logical properties. +#tags: ["service-X", "web-tier"] + + + +############################# Logging ######################################### + +#logging: + # Send all logging output to syslog. On Windows default is false, otherwise + # default is true. + #to_syslog: true + + # Write all logging output to files. Beats automatically rotate files if configurable + # limit is reached. + #to_files: false + + # Enable debug output for selected components. + #selectors: [] + + # Set log level + #level: error + + #files: + # The directory where the log files will written to. + #path: /var/log/functionbeat + + # The name of the files where the logs are written to. + #name: functionbeat + + # Configure log file size limit. If limit is reached, log file will be + # automatically rotated + #rotateeverybytes: 10485760 # = 10MB + + # Number of rotated log files to keep. Oldest files will be deleted first. + #keepfiles: 7 diff --git a/x-pack/functionbeat/tests/system/functionbeat.py b/x-pack/functionbeat/tests/system/functionbeat.py new file mode 100644 index 000000000000..b2af1dbb11a4 --- /dev/null +++ b/x-pack/functionbeat/tests/system/functionbeat.py @@ -0,0 +1,14 @@ +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '../../../../libbeat/tests/system')) +from beat.beat import TestCase + + +class BaseTest(TestCase): + + @classmethod + def setUpClass(self): + self.beat_name = "functionbeat" + self.beat_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) + super(BaseTest, self).setUpClass() diff --git a/x-pack/functionbeat/tests/system/requirements.txt b/x-pack/functionbeat/tests/system/requirements.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/x-pack/functionbeat/tests/system/test_base.py b/x-pack/functionbeat/tests/system/test_base.py new file mode 100644 index 000000000000..30402e377f3b --- /dev/null +++ b/x-pack/functionbeat/tests/system/test_base.py @@ -0,0 +1,21 @@ +from functionbeat import BaseTest + +import os +import unittest + + +class Test(BaseTest): + + @unittest.skip("temporarily disabled") + def test_base(self): + """ + Basic test with exiting Functionbeat normally + """ + self.render_config_template( + path=os.path.abspath(self.working_dir) + "/log/*" + ) + + functionbeat_proc = self.start_beat() + self.wait_until(lambda: self.log_contains("functionbeat is running")) + exit_code = functionbeat_proc.kill_and_wait() + assert exit_code == 0